some intermediate stuff

This commit is contained in:
Greg Shuflin 2025-02-15 02:35:21 -08:00
parent 73f73c2b53
commit 7d781be5cf
3 changed files with 35 additions and 50 deletions

View File

@ -24,52 +24,20 @@
src = ./.;
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
doDist = false;
buildPhase = ''
echo "Current directory structure:"
ls -la
echo "Node modules location:"
ls -la node_modules/.bin || true
# Parcel needs a HOME directory
export HOME=$(mktemp -d)
export NODE_ENV=production
# Move to the package directory where the source is
cd deps/Spazer
# Ensure Parcel cache directory exists and is writable
mkdir -p .parcel-cache
chmod -R 755 .parcel-cache
# Add node_modules/.bin to PATH so parcel can be found
export PATH="$PATH:$(pwd)/../../node_modules/.bin"
# Run the build with explicit entry point for all HTML files
yarn parcel build src/index.html src/**/index.html --no-cache --public-url ./
# Move back to the root directory
cd ../..
yarn parcel build
'';
installPhase = ''
echo "Current directory for install phase:"
pwd
echo "Directory contents:"
ls -la deps/Spazer
mkdir -p $out/dist
if [ -d deps/Spazer/dist ]; then
cp -r deps/Spazer/dist/* $out/dist
else
echo "Error: dist directory not found after build"
echo "Current directory: $(pwd)"
echo "Contents of deps/Spazer:"
ls -la deps/Spazer
exit 1
fi
# Create output directory and copy files
mkdir -p $out
cp -r deps/Spazer/dist/. $out/
'';
distPhase = "true";
buildInputs = with pkgs; [
nodejs
];
@ -78,17 +46,6 @@
yarn
python3 # Sometimes needed by node-gyp
];
# Prevent yarn from trying to download during the build
yarnPreBuild = ''
mkdir -p $HOME/.cache/yarn
mkdir -p $HOME/.config/yarn
chmod -R 755 $HOME/.cache
chmod -R 755 $HOME/.config
'';
# Don't attempt to do any post-build optimizations
dontFixup = true;
};
# Development shell with required dependencies
@ -103,7 +60,7 @@
# Add a simple app that can serve the built files
apps.default = flake-utils.lib.mkApp {
drv = pkgs.writeShellScriptBin "serve-spazer" ''
${pkgs.python3}/bin/python3 -m http.server --directory ${self.packages.${system}.default}/dist 8080
${pkgs.python3}/bin/python3 -m http.server --directory ${self.packages.${system}.default} 8080
'';
};
});

14
src/types/glsl.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
declare module '*.glsl' {
const content: string;
export default content;
}
declare module '*.frag.glsl' {
const content: string;
export default content;
}
declare module '*.vert.glsl' {
const content: string;
export default content;
}

14
tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "node",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": ["./node_modules/@types", "./src/types"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}