From 7d781be5cf106beda7e9cec09b924d7fc2417053 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sat, 15 Feb 2025 02:35:21 -0800 Subject: [PATCH] some intermediate stuff --- flake.nix | 57 ++++++--------------------------------------- src/types/glsl.d.ts | 14 +++++++++++ tsconfig.json | 14 +++++++++++ 3 files changed, 35 insertions(+), 50 deletions(-) create mode 100644 src/types/glsl.d.ts create mode 100644 tsconfig.json diff --git a/flake.nix b/flake.nix index b345d6f..5a7de12 100644 --- a/flake.nix +++ b/flake.nix @@ -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 ''; }; }); diff --git a/src/types/glsl.d.ts b/src/types/glsl.d.ts new file mode 100644 index 0000000..259aa60 --- /dev/null +++ b/src/types/glsl.d.ts @@ -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; +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..bdaf54c --- /dev/null +++ b/tsconfig.json @@ -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"] +} \ No newline at end of file