Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update PNPM commands #2964

Merged
merged 1 commit into from
Jan 18, 2025
Merged

Conversation

ThanatosGit
Copy link
Contributor

@ThanatosGit ThanatosGit commented Jan 17, 2025

Information

Type Breaking change
Doc No

Installation command from https://tsed.dev/introduction/getting-started.html is wrong.

thanatos@DESKTOP-5NP8L7E:~/projects/tsed-repos$ pnpm --version
9.15.4

thanatos@DESKTOP-5NP8L7E:~/projects/tsed-repos/jest-test$ pnpx -p @tsed/cli tsed init .
/home/thanatos/.cache/pnpm/dlx/2eaiiergvzc3777g5qgjrb7sim/19474c44e0b-564:
 ERR_PNPM_FETCH_404  GET https://registry.npmjs.org/-p: Not Found - 404

This error happened while installing a direct dependency of /home/thanatos/.cache/pnpm/dlx/2eaiiergvzc3777g5qgjrb7sim/19474c44e0b-564

-p is not in the npm registry, or you have no permission to fetch it.

No authorization header was set for the request.

Fix

Instead of using the outdated/deprecated pnpx use pnpm dlx and also add peer dependencies.

E.g.

pnpm --package=@tsed/cli --package=@tsed/cli-core dlx tsed init .

Summary by CodeRabbit

  • Documentation
    • Updated project initialization commands in multiple documentation files to use the latest pnpm syntax.
    • Replaced pnpx -p @tsed/cli tsed init with pnpm --package=@tsed/cli dlx tsed init . and pnpx -p @tsed/cli tsed init tsed-prisma with pnpm --package=@tsed/cli dlx tsed init tsed-prisma.
    • Affected files: getting-started.md, migrate-from-express.md, prisma.md.

Copy link

coderabbitai bot commented Jan 17, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request updates the documentation across multiple files to modify the project initialization command for Ts.ED using pnpm. The changes replace the previous command pnpx -p @tsed/cli tsed init with a new syntax: pnpm --package=@tsed/cli dlx tsed init. The modification introduces the --package option and uses dlx instead of pnpx, while maintaining the core functionality of initializing a Ts.ED project.

Changes

File Change Summary
docs/getting-started.md Updated pnpm initialization command
docs/introduction/migrate-from-express.md Updated pnpm initialization command
docs/tutorials/prisma.md Updated pnpm initialization command

Possibly related PRs

  • docs: Update PNPM commands #2964: The changes in this PR directly update the same command for initializing a Ts.ED project using pnpm, aligning with the modifications made in the main PR.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7811df and 8ae92e4.

📒 Files selected for processing (3)
  • docs/getting-started.md (1 hunks)
  • docs/introduction/migrate-from-express.md (1 hunks)
  • docs/tutorials/prisma.md (1 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Romakita
Copy link
Collaborator

Romakita commented Jan 17, 2025

Hi @ThanatosGit
Thanks for the issue. Why pnpm command needs to have peerdeps declared explicitly ? It complexify the command line for nothing because @tsed/cli-core is dependency of @tsed/cli.

See you

@ThanatosGit
Copy link
Contributor Author

Hi,
tbh: That's a good question. PNPM comes with the defaults of .npmrc where auto-install-peers is set to true. See https://pnpm.io/npmrc#auto-install-peers

Neither set the value manually nor relying on the default works for me. It maybe is an issue with pnpm itself doesn't respect the option with dlx?
The output is as following:

thanatos@DESKTOP-5NP8L7E:~/projects/tsed-repos/init-test$ pnpm --package=@tsed/cli dlx tsed init .
Downloading @swc/[email protected]: 17.31 MB/17.31 MB, done
 WARN  1 deprecated subdependencies found: [email protected]
Packages: +83
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 105, reused 0, downloaded 88, added 83, done
.cache/pnpm/dlx/rnzi4ehbwa6qos5yfkxu3ogi6a/19475254ac0-6911/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@swc/core: Running postinstall script, done in 20ms
Downloading @swc/[email protected]: 21.01 MB/21.01 MB, done
 WARN  Issues with peer dependencies found
.
└─┬ @tsed/cli 6.1.6
  └── ✕ missing peer @tsed/cli-core@"*"
Peer dependencies that should be installed:
  @tsed/cli-core@"*"
node:internal/modules/esm/resolve:857
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@tsed/cli-core' imported from /home/thanatos/.cache/pnpm/dlx/rnzi4ehbwa6qos5yfkxu3ogi6a/19475254ac0-6911/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_@[email protected]_@tsed+hook_ey6nmjfbea5ksczo7peoxijdgi/node_modules/@tsed/cli/lib/esm/bin/tsed.js
    at packageResolve (node:internal/modules/esm/resolve:857:9)
    at moduleResolve (node:internal/modules/esm/resolve:926:18)
    at defaultResolve (node:internal/modules/esm/resolve:1056:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
    at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:619:38)
    at ModuleLoader.resolveSync (node:internal/modules/esm/loader:636:52)
    at Object.resolve (node:internal/modules/esm/initialize_import_meta:33:25)
    at file:///home/thanatos/.cache/pnpm/dlx/rnzi4ehbwa6qos5yfkxu3ogi6a/19475254ac0-6911/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_@[email protected]_@tsed+hook_ey6nmjfbea5ksczo7peoxijdgi/node_modules/@tsed/cli/lib/esm/bin/tsed.js:11:53
    at ModuleJob.run (node:internal/modules/esm/module_job:271:25) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v22.13.0

@Romakita
Copy link
Collaborator

Arf... the @tsed/cli-core is a peer not a dependencies.

  "peerDependencies": {
    "@tsed/cli-core": "workspace:*",
    "@tsed/core": ">=8.0.0",
    "@tsed/di": ">=8.0.0",
    "@tsed/hooks": ">=8.0.0",
    "@tsed/logger": ">=7.0.1",
    "@tsed/openspec": ">=8.0.0",
    "@tsed/schema": ">=8.0.0"
  }

But it should be the same issue with other peerDependencies listed above.

@Romakita
Copy link
Collaborator

I merged a PR to try to fix peerDeps for the CLI ^^

@ThanatosGit
Copy link
Contributor Author

ThanatosGit commented Jan 17, 2025

EDIT: Oh, the comment is gone 🙃

thanatos@DESKTOP-5NP8L7E:~/projects/tsed-repos/init-test$ pnpm --package=@tsed/cli dlx tsed init .
 WARN  1 deprecated subdependencies found: [email protected]
Packages: +83
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 105, reused 87, downloaded 1, added 83, done
 WARN  Issues with peer dependencies found
.
└─┬ @tsed/cli 6.1.7
  └── ✕ missing peer @tsed/cli-core@"*"
Peer dependencies that should be installed:
  @tsed/cli-core@"*"  
node:internal/modules/esm/resolve:857
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@tsed/cli-core' imported from /home/thanatos/.cache/pnpm/dlx/rnzi4ehbwa6qos5yfkxu3ogi6a/19475a84609-ed6/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_@[email protected]_@tsed+hook_tsq4m65iv5dbdjdvk6wwew7uhq/node_modules/@tsed/cli/lib/esm/bin/tsed.js
    at packageResolve (node:internal/modules/esm/resolve:857:9)
    at moduleResolve (node:internal/modules/esm/resolve:926:18)
    at defaultResolve (node:internal/modules/esm/resolve:1056:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
    at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:619:38)
    at ModuleLoader.resolveSync (node:internal/modules/esm/loader:636:52)
    at Object.resolve (node:internal/modules/esm/initialize_import_meta:33:25)
    at file:///home/thanatos/.cache/pnpm/dlx/rnzi4ehbwa6qos5yfkxu3ogi6a/19475a84609-ed6/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_@[email protected]_@tsed+hook_tsq4m65iv5dbdjdvk6wwew7uhq/node_modules/@tsed/cli/lib/esm/bin/tsed.js:11:53
    at ModuleJob.run (node:internal/modules/esm/module_job:271:25) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v22.13.0

@Romakita
Copy link
Collaborator

Ok it's fixed now we can use the following command to install cli correctly:

pnpm --package=@tsed/cli@latest dlx tsed init .

@ThanatosGit can you update your PR please ;)

@Romakita
Copy link
Collaborator

@ThanatosGit
Copy link
Contributor Author

I left out @latest because the other cmd's don't contain it either
tsedio/tsed-vitepress-theme#110

@Romakita
Copy link
Collaborator

I added latest for pnpm command because pnpm doesn't install the latest version if you already installed the cli using dlx.

Npm and yarn always try to install latest.

@ThanatosGit
Copy link
Contributor Author

I wasn't aware of that. I tried to find some documentation about it and tried to reproduce.

See console log at the end: That might be because I explicitly requested an older version first and then omitted the version but it was pulling the newer version (because the prompt worked at the second attempt).

According to this comment pnpm even caches the latest tag pnpm/pnpm#8659 (comment) and this might be why it was cached to an older version for you?

Anyways: Should I include @latest now or leave it as it is?

thanatos@DESKTOP-5NP8L7E:~/projects/tsed-repos$ rm -rf /home/thanatos/.cache/pnpm/
thanatos@DESKTOP-5NP8L7E:~/projects/tsed-repos$ echo  $(pnpm store path)
/home/thanatos/.local/share/pnpm/store/v3
thanatos@DESKTOP-5NP8L7E:~/projects/tsed-repos$ rm -rf $(pnpm store path)
thanatos@DESKTOP-5NP8L7E:~/projects/tsed-repos$ pnpm --package=@tsed/[email protected] dlx tsed init .
Downloading @swc/[email protected]: 17.31 MB/17.31 MB, done
Downloading @swc/[email protected]: 21.01 MB/21.01 MB, done
 WARN  1 deprecated subdependencies found: [email protected]
Packages: +83
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 105, reused 0, downloaded 88, added 83, done
.cache/pnpm/dlx/v2cti3auz46hvfggoeecbbntc4/194761c48a7-6eda/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@swc/core: Running postinstall script, done in 21ms
 WARN  Issues with peer dependencies found
.
└─┬ @tsed/cli 6.1.4
  └── ✕ missing peer @tsed/cli-core@"*"
Peer dependencies that should be installed:
  @tsed/cli-core@"*"  
node:internal/modules/esm/resolve:857
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@tsed/cli-core' imported from /home/thanatos/.cache/pnpm/dlx/v2cti3auz46hvfggoeecbbntc4/194761c48a7-6eda/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_@[email protected]_@tsed+hook_ubsk4icuuhyc7nlzmv3upozjh4/node_modules/@tsed/cli/lib/esm/bin/tsed.js
    at packageResolve (node:internal/modules/esm/resolve:857:9)
    at moduleResolve (node:internal/modules/esm/resolve:926:18)
    at defaultResolve (node:internal/modules/esm/resolve:1056:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
    at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:619:38)
    at ModuleLoader.resolveSync (node:internal/modules/esm/loader:636:52)
    at Object.resolve (node:internal/modules/esm/initialize_import_meta:33:25)
    at file:///home/thanatos/.cache/pnpm/dlx/v2cti3auz46hvfggoeecbbntc4/194761c48a7-6eda/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_@[email protected]_@tsed+hook_ubsk4icuuhyc7nlzmv3upozjh4/node_modules/@tsed/cli/lib/esm/bin/tsed.js:11:53
    at ModuleJob.run (node:internal/modules/esm/module_job:271:25) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v22.13.0
thanatos@DESKTOP-5NP8L7E:~/projects/tsed-repos$ pnpm --package=@tsed/cli dlx tsed init .
 WARN  1 deprecated subdependencies found: [email protected]
Packages: +359
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 381, reused 87, downloaded 277, added 359, done
.cache/pnpm/dlx/rnzi4ehbwa6qos5yfkxu3ogi6a/194761c7b13-6f91/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@swc/core: Running postinstall script, done in 21ms
? Choose the target Framework: (Use arrow keys)
❯ Express.js 
  Koa.js 
thanatos@DESKTOP-5NP8L7E:~/projects/tsed-repos$ 

@Romakita
Copy link
Collaborator

we will add @latest later if it's an issue. right know it's ok ;)

@Romakita Romakita merged commit 915574c into tsedio:production Jan 18, 2025
10 checks passed
@Romakita
Copy link
Collaborator

🎉 This PR is included in version 8.4.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants