Permit running without node_modules #39

Open
xrdawson wants to merge 3 commits from run_without_node_modules_npx into main
xrdawson commented 2023-09-27 21:11:59 +00:00 (Migrated from extrastatic.dev)

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',
}
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', } ```
xrdawson commented 2023-09-27 21:12:57 +00:00 (Migrated from extrastatic.dev)

changed the description

changed the description
xrdawson commented 2023-09-28 13:34:01 +00:00 (Migrated from extrastatic.dev)

added 2 commits

Compare with previous version

added 2 commits <ul><li>21e61f30 - Add npx debuggig</li><li>2097a0c5 - Add runtime detection runtime.js</li></ul> [Compare with previous version](/svekyll/svekyll-cli/-/merge_requests/17/diffs?diff_id=3266&start_sha=d7e617990c750e829845a0bd63e057f2835c60e8)
xrdawson commented 2023-10-19 16:02:21 +00:00 (Migrated from extrastatic.dev)

mentioned in issue #1

mentioned in issue #1
This pull request has changes conflicting with the target branch.
  • svekyll-cli.js
  • svekyll/cli.js
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin run_without_node_modules_npx:run_without_node_modules_npx
git switch run_without_node_modules_npx

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff run_without_node_modules_npx
git switch run_without_node_modules_npx
git rebase main
git switch main
git merge --ff-only run_without_node_modules_npx
git switch run_without_node_modules_npx
git rebase main
git switch main
git merge --no-ff run_without_node_modules_npx
git switch main
git merge --squash run_without_node_modules_npx
git switch main
git merge --ff-only run_without_node_modules_npx
git switch main
git merge run_without_node_modules_npx
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
svekyll/svekyll-cli!39
No description provided.