From 95b63a408a26664e4c534cf21d80e3e0f2827277 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Wed, 7 Jun 2023 11:40:27 -0400 Subject: [PATCH 1/2] Add things about pnpm --- guides/advanced-use/cli-commands-reference.md | 5 ++++ guides/advanced-use/debugging.md | 6 ++-- guides/appendix/configuration.md | 2 +- guides/basic-use/assets-and-dependencies.md | 30 ++++++++++++------- guides/basic-use/cli-commands.md | 2 +- guides/basic-use/index.md | 8 ++--- guides/writing-addons/addon-blueprints.md | 2 +- guides/writing-addons/intro-tutorial.md | 12 ++++---- 8 files changed, 40 insertions(+), 27 deletions(-) diff --git a/guides/advanced-use/cli-commands-reference.md b/guides/advanced-use/cli-commands-reference.md index 04b23a05..dc355e6f 100644 --- a/guides/advanced-use/cli-commands-reference.md +++ b/guides/advanced-use/cli-commands-reference.md @@ -88,6 +88,7 @@ ember addon --skip-git (Boolean) (Default: false) aliases: -sg --yarn (Boolean) + --pnpm (Boolean) --directory (String) aliases: -dir --lang (String) Sets the base human language of the addon's own test application via index.html @@ -645,6 +646,7 @@ ember init uses {{ember-welcome-page}}. Use --no-welcome to skip it. --yarn (Boolean) + --pnpm (Boolean) --name (String) (Default: "") aliases: -n --lang (String) Sets the base human language of the application via index.html @@ -666,6 +668,8 @@ ember install aliases: -E, --exact --yarn (Boolean) Use --yarn to enforce yarn usage, or --no-yarn to enforce npm + --pnpm (Boolean) Use --pnpm to enforce pnpm + usage, or --no-pnpm to enforce npm ``` ### `ember new` @@ -691,6 +695,7 @@ ember new uses {{ember-welcome-page}}. Use --no-welcome to skip it. --yarn (Boolean) + --pnpm (Boolean) --directory (String) aliases: -dir --lang (String) Sets the base human language of the application via index.html diff --git a/guides/advanced-use/debugging.md b/guides/advanced-use/debugging.md index 4388faca..e22b10d3 100644 --- a/guides/advanced-use/debugging.md +++ b/guides/advanced-use/debugging.md @@ -85,9 +85,9 @@ the all-purpose technique of "turning it on and off" can apply to Ember CLI as w Some common steps are to stop the server, try one or more of these steps, and start the server again: -- Run `npm install` or `yarn install` -- Delete the `node_modules` directory and run `npm install` or `yarn install` -- Delete the `dist` directory (found in apps with versions < 3.4), delete `node_modules`, and `npm install` or `yarn install` +- Run `npm install`, `yarn install`, or `pnpm install` +- Delete the `node_modules` directory and run `npm install`, `yarn install`, or `pnpm install` +- Delete the `dist` directory (found in apps with versions < 3.4), delete `node_modules`, and `npm install`, `yarn install`, or `pnpm install` [1]: https://nodejs.org/api/debugger.html [2]: https://docs.npmjs.com/cli/link diff --git a/guides/appendix/configuration.md b/guides/appendix/configuration.md index 81a8afd8..ff6d1967 100644 --- a/guides/appendix/configuration.md +++ b/guides/appendix/configuration.md @@ -31,7 +31,7 @@ For a complete list of command line options run `ember help`. Some configuration is exposed through your `package.json` file. -If you have a nested repo structure (e.g., a monorepo using yarn workspaces) and want to allow `ember s` from the root of the repo, you can configure your `package.json` to look like: +If you have a nested repo structure (e.g., a monorepo using pnpm or yarn workspaces) and want to allow `ember s` from the root of the repo, you can configure your `package.json` to look like: ```json {data-filename=package.json} { diff --git a/guides/basic-use/assets-and-dependencies.md b/guides/basic-use/assets-and-dependencies.md index 7ad7e63e..c4c2e0f7 100644 --- a/guides/basic-use/assets-and-dependencies.md +++ b/guides/basic-use/assets-and-dependencies.md @@ -17,33 +17,33 @@ The code itself goes in `node_modules` during `npm install`, just like in many n plus folders like `vendor` and `public` that can hold many other files of the developer's choice -## npm and Yarn +## Package Managers -Ember CLI supports both [npm](https://www.npmjs.com) and [Yarn](https://yarnpkg.com/) +Ember CLI supports [npm](https://www.npmjs.com), [Yarn](https://yarnpkg.com/), and [pnpm](https://pnpm.io) for node modules management. By default, new apps use `npm`. Both tools offer similar functionality, and which one to choose is up to the developer's preference. -Dependencies listed in `package.json` can be installed with either `npm install` or `yarn install`. The files for those packages are added to the `node_modules` folder of the app. +Dependencies listed in `package.json` can be installed with `npm install`, `yarn install`, or `pnpm install`. The files for those packages are added to the `node_modules` folder of the app. -There are two ways to switch from `npm` to `yarn`. -Either include an option when the app is created, like `ember new --yarn`, -or run `yarn install` to generate a `yarn.lock` file. -Ember will detect the `yarn.lock` file and start using it instead +There are two ways to switch from the default package manager, `npm`. +Either include an option when the app is created, like `ember new --yarn` or `ember new --pnpm`, +or run `yarn install` or `pnpm install` to generate the package manager's asosciated lockfile file. +Ember will detect the lockfile and start using it instead for any `ember install some-addon-name` commands. Don't forget to delete the `package-lock.json` file if the app already has one. @@ -52,10 +52,10 @@ file are present, Ember CLI will default to using Yarn. However, having both files causes confusion for collaborators and is incompatible with some CI systems. -To switch from `yarn` to `npm`, delete the `yarn.lock` +To switch back to `npm`, delete the lockfile from your package manager and run `npm install` to generate a `package-lock.json`. -To have Ember CLI use `yarn` by default for all new projects, create a `.ember-cli` file in your home directory with: +To have Ember CLI use `yarn` or `pnpm` by default for all new projects, create a `.ember-cli` file in your home directory with: ```json { @@ -63,10 +63,18 @@ To have Ember CLI use `yarn` by default for all new projects, create a `.ember-c } ``` +or +```json +{ + "pnpm": true +} +``` + Further documentation about npm and Yarn is available at their official documentation pages: * [npm](https://www.npmjs.com) +* [pnpm](https://pnpm.io) * [Yarn](https://yarnpkg.com) ### The `node_modules` directory diff --git a/guides/basic-use/cli-commands.md b/guides/basic-use/cli-commands.md index 958e8aae..4cce8720 100644 --- a/guides/basic-use/cli-commands.md +++ b/guides/basic-use/cli-commands.md @@ -61,7 +61,7 @@ ember new camping-trip-tracker --yarn ### Learn more - [Ember Quickstart Guide](https://guides.emberjs.com/release/getting-started/quick-start/) for creating a first app -- [npm and Yarn](../assets-and-dependencies/#npmandyarn) for more on using package managers with Ember CLI +- [npm, Yarn, and pnpm](../assets-and-dependencies/#package-managers) for more on using package managers with Ember CLI ## Serve the app locally diff --git a/guides/basic-use/index.md b/guides/basic-use/index.md index af3eb633..276963cd 100644 --- a/guides/basic-use/index.md +++ b/guides/basic-use/index.md @@ -2,16 +2,16 @@ Learn how to install the Ember CLI on Linux, Mac, and Windows. ## Prerequisites -* [npm](https://www.npmjs.com/get-npm) or [yarn](https://yarnpkg.com/en/docs/install) +* [npm](https://www.npmjs.com/get-npm), [yarn](https://yarnpkg.com/en/docs/install), or [pnpm](https://pnpm.io/installation) * [git](https://git-scm.com/) is recommended, but not required * Recent version of [node](https://nodejs.org/en/download/), which comes included in `yarn` or `npm` * Mac and Linux users may need [Watchman](https://facebook.github.io/watchman/) (not the npm version!) First, we need to have a package manager installed. A package manager installs new dependencies from the command line, whether they are used as commands or in the app itself. -Follow these installation instructions for [npm](https://www.npmjs.com/get-npm) or [yarn](https://yarnpkg.com/en/docs/install). -While these two tools have somewhat different features, both are compatible with Ember app development. +Follow these installation instructions for [npm](https://www.npmjs.com/get-npm), [yarn](https://yarnpkg.com/en/docs/install), or [pnpm](https://pnpm.io/installation). +While these tools have somewhat different features, both are compatible with Ember app development. -We'll know installation is successful when `npm --version` or `yarn --version` returns the version number. +We'll know installation is successful when `npm --version`, `yarn --version`, or `pnpm --version` returns the version number. It is recommended to install the most recent LTS (long-term support) version of `node`. Restart the console after installing your package manager. diff --git a/guides/writing-addons/addon-blueprints.md b/guides/writing-addons/addon-blueprints.md index f2b1c486..76e88b9a 100644 --- a/guides/writing-addons/addon-blueprints.md +++ b/guides/writing-addons/addon-blueprints.md @@ -67,7 +67,7 @@ The default blueprint is recognized because it normally has the same name as the ### Blueprints in development -When developing and testing your addon using either `npm link` or `yarn link` your addon's blueprint will not automatically run. To manually run and test the blue print you would use the following command: +When developing and testing your addon using `npm link`, `yarn link`, or `pnpm link` your addon's blueprint will not automatically run. To manually run and test the blue print you would use the following command: ```shell ember generate diff --git a/guides/writing-addons/intro-tutorial.md b/guides/writing-addons/intro-tutorial.md index 7d9ec033..89a09e8f 100644 --- a/guides/writing-addons/intro-tutorial.md +++ b/guides/writing-addons/intro-tutorial.md @@ -50,17 +50,17 @@ Our goal is to be able to pass the `buttonLabel` value to the addon, just like w ### Trying out the addon template in an app -There are several options to see the addon in action. We could use `npm link` or `yarn link` to try it out locally or publish the addon online. We'll use `link` while we are still developing and testing. +There are several options to see the addon in action. We could use `npm link`, `yarn link`, or `pnpm link` to try it out locally or publish the addon online. We'll use `link` while we are still developing and testing. **From the addon project directory:** 1. Since our addon uses a template, we need the template precompiler to be a `dependency` and not a `devDependency`. In the addon's `package.json`, move the entry for `ember-cli-htmlbars` into the `dependencies` listing. If this step is missed, there is a clear error message when we try to start the app that uses our addon. -2. `yarn install` or `npm install` -3. Run the command `yarn link` or `npm link` +2. `pnpm install`, `yarn install`, or `npm install` +3. Run the command `yarn link` or `npm link`. This step may be skipped if using `pnpm`. **From the directory of the app using the addon:** -1. `yarn link ` or `npm link `. +1. `pnpm link ../path/to-/the-addon`, `yarn link ` or `npm link `. 2. In the Ember app's `package.json`, add a `devDependencies` entry for your addon, like `"addon-name": "*"`. The `*` means that it will include all version numbers of our addon. -3. Run `yarn install` or `npm install` in the app. (If you are using the app for the first time, you can use `npm install --prefer-offline` or `npm install --offline` instead. These alternative commands can speed up installation, because `npm install` checks the online npm registry for your addon instead of your local storage.) +3. Run `pnpm install`, `yarn install`, or `npm install` in the app. (If you are using the app for the first time, you can use `npm install --prefer-offline` or `npm install --offline` instead. These alternative commands can speed up installation, because `npm install` checks the online npm registry for your addon instead of your local storage.) 4. Add a reference to your addon's component somewhere in an app template, like `` 5. Run a local server with `ember serve` and visit [http://localhost:4200](http://localhost:4200) @@ -69,7 +69,7 @@ We should now see our addon in action! **Having problems?** - Check to make sure that your `package.json` is valid, looking for missing commas or trailing commas. - "Template precompiler" errors mean that you skipped Step 1 and 2 above. -- `404 not found` means we forgot to `yarn` or `npm install` +- `404 not found` means we forgot to `pnpm install`, `yarn install` or `npm install` - Make sure all the files have been saved. - Did you rename or relocate any files after they were created? This is prone to mistakes, and the resulting errors can be really strange. It is best to create files using the CLI. From fd2a067c4a6a46e4b6c0f9b858d4cb018a3c2252 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Fri, 23 Jun 2023 14:50:05 -0400 Subject: [PATCH 2/2] Fix spelling --- .local.dic | 1 + guides/basic-use/assets-and-dependencies.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.local.dic b/.local.dic index 290fc935..019fdbc8 100644 --- a/.local.dic +++ b/.local.dic @@ -74,6 +74,7 @@ nginx NiM NTFS PowerShell +pnpm pre-made Pre-Octane preloading diff --git a/guides/basic-use/assets-and-dependencies.md b/guides/basic-use/assets-and-dependencies.md index c4c2e0f7..22f72630 100644 --- a/guides/basic-use/assets-and-dependencies.md +++ b/guides/basic-use/assets-and-dependencies.md @@ -42,7 +42,7 @@ Dependencies listed in `package.json` can be installed with `npm install`, `yarn There are two ways to switch from the default package manager, `npm`. Either include an option when the app is created, like `ember new --yarn` or `ember new --pnpm`, -or run `yarn install` or `pnpm install` to generate the package manager's asosciated lockfile file. +or run `yarn install` or `pnpm install` to generate the package manager's associated lockfile file. Ember will detect the lockfile and start using it instead for any `ember install some-addon-name` commands. Don't forget to delete the `package-lock.json` file if the app