ExtraStatic: powerful and easy publishing

Skip to content
Snippets Groups Projects

Permit running without node_modules

Open Chris Dawson requested to merge run_without_node_modules_npx into main

Right now svekyll-cli expects node_modules for pulling templates. This works if you have installed svekyll-cli a priori using package.json, but not when running *npx svekyll-cli. We can probably fix this by detecting when we are running that way and augmenting the paths appropriately.

Running SVEKYLL_REPORT=1 pnpx svekyll-cli | grep pnpx results in nothing:

This is what we see with SVEKYLL_REPORT=1 npx svekyll-cli | grep npx

  _: '/home/chrisdawson/.yarn/bin/npx'

I was hoping we could see clearly from the environment that npx or pnpx was running the show, but it isn't that easy. We will probably need to check to see if node_modules exists, and if not, the search through the NODE_PATHs, etc.

This is what we see with SVEKYLL_REPORT=1 npx svekyll-cli (after some filtering). So NODE_PATH includes the pnpm tmp path, and perhaps we can figure out the templates from there.

SVEKYLL_REPORT=1 pnpx svekyll-cli build
.../.pnpm-home/store/v3/tmp/dlx-316838   |  WARN  deprecated mkdirp@0.3.0
.../.pnpm-home/store/v3/tmp/dlx-316838   |  WARN  deprecated stable@0.1.8
.../.pnpm-home/store/v3/tmp/dlx-316838   | +469 +++++++++++++++++++++++++++++++++++++++++++++++
.../.pnpm-home/store/v3/tmp/dlx-316838   | Progress: resolved 490, reused 467, downloaded 1, added 469, done
 WARN  Issues with peer dependencies found
.
└─┬ svekyll-cli 0.0.85
  ├─┬ layercake 7.6.1
  │ └── ✕ missing peer typescript@^5.0.2
  ├─┬ svelte-preprocess 5.0.4
  │ └── ✕ missing peer typescript@">=3.9.5 || ^4.0.0 || ^5.0.0"
  └─┬ vite-plugin-singlefile 0.13.5
    └── ✕ missing peer rollup@>=2.79.0
Peer dependencies that should be installed:
  rollup@>=2.79.0              typescript@">=5.0.2 <6.0.0"  
SVEKYLL cwd /home/chrisdawson/Projects/ExtraStatic/blogs/blog-example-com
SVEKYLL ENV {
  SHELL: '/run/current-system/sw/bin/bash',
  PNPM_HOME: '/home/chrisdawson/.pnpm-home',
  SYSTEMD_EXEC_PID: '2273',
  NIXPKGS_CONFIG: '/etc/nix/nixpkgs-config.nix',
  CXX: 'g++',
  XAUTHORITY: '/home/chrisdawson/.Xauthority',
  TEMPDIR: '/run/user/1000',
  system: 'x86_64-linux',
  HOME: '/home/chrisdawson',
  SVEKYLL_REPORT: '1',
  MANAGERPID: '2104',
  READELF: 'readelf',
  GTK_A11Y: 'none',
  KDE_SESSION_UID: '1000',
  USER: 'chrisdawson',
  COLORFGBG: '0;15',
  TZDIR: '/etc/zoneinfo',
  TERMINFO_DIRS: '/home/chrisdawson/.nix-profile/share/terminfo:/etc/profiles/per-user/chrisdawson/share/terminfo:/nix/var/nix/profiles/default/share/terminfo:/run/current-system/sw/share/terminfo',
  LD_LIBRARY_PATH: '/nix/store/j25bk9yxdqcvrirx4vvrxpaiw1cfr0sm-  NODE_PATH: '/nix/store/0g3sc6fhnhsxx8d837kyj06qcbjind1b-nodejs-18.16.1/lib/node_modules:/home/chrisdawson/.pnpm-home/global/5/.pnpm/node_modules:/home/chrisdawson/.pnpm-home/store/v3/tmp/dlx-316838/node_modules/.pnpm/node_modules',
  TMP: '/run/user/1000',
  OBJDUMP: 'objdump',
  PATH: '/home/chrisdawson/.pnpm-home/store/v3/tmp/dlx-316838/node_modules/.bin:/home/chrisdawson/.yarn/bin:/home/chrisdawson/.yarn/bin:/home/chrisdawson/.yarn/bin',
  propagatedBuildInputs: '',
  CC: 'gcc',
  CONFIG_SHELL: '/nix/store/7q1b1bsmxi91zci6g8714rcljl620y7f-bash-5.2-p15/bin/bash',
  __structuredAttrs: '',
  RANLIB: 'ranlib',
}
Edited by Chris Dawson

Merge request reports

Pipeline #2923 passed

Pipeline passed for 2097a0c5 on run_without_node_modules_npx

Ready to merge by members who can write to the target branch.
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading