From efc74a73666a4d4a948742117456da5b733c3874 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Thu, 11 Apr 2024 17:47:14 +0200 Subject: [PATCH] docs: add plugin to format package manager scripts (#12254) --- docs/faq.md | 2 +- docs/guides/installation.md | 6 +----- docs/guides/ng-schematics.md | 2 +- docs/troubleshooting.md | 2 +- examples/README.md | 14 +++++++++++++- packages/ng-schematics/README.md | 2 +- website/docusaurus.config.js | 3 +++ website/package-lock.json | 27 +++++++++++++++++++++++++++ website/package.json | 1 + 9 files changed, 49 insertions(+), 10 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index d68f59621ec..f04f8e61dce 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -120,7 +120,7 @@ is `latest` -- Puppeteer isn't tied to a particular Firefox version. To fetch Firefox Nightly as part of Puppeteer installation: -```bash +```bash npm2yarn PUPPETEER_PRODUCT=firefox npm i puppeteer ``` diff --git a/docs/guides/installation.md b/docs/guides/installation.md index cda8ebbaa7c..08eb464cfab 100644 --- a/docs/guides/installation.md +++ b/docs/guides/installation.md @@ -2,12 +2,8 @@ To use Puppeteer in your project, run: -```bash +```bash npm2yarn npm i puppeteer -# or using yarn -yarn add puppeteer -# or using pnpm -pnpm i puppeteer ``` When you install Puppeteer, it automatically downloads a recent version of diff --git a/docs/guides/ng-schematics.md b/docs/guides/ng-schematics.md index 975f74a704a..2c84b7bc9ef 100644 --- a/docs/guides/ng-schematics.md +++ b/docs/guides/ng-schematics.md @@ -85,7 +85,7 @@ node tools/smoke.mjs The schematics utilize `@angular-devkit/schematics/testing` for verifying correct file creation and `package.json` updates. To execute the test suit: -```bash +```bash npm2yarn npm run test ``` diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 7bf4e1b4f74..5a677d089fc 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -28,7 +28,7 @@ the installation directory. For example, -```bash +```bash npm2yarn PUPPETEER_CACHE_DIR=$(pwd) npm install puppeteer PUPPETEER_CACHE_DIR=$(pwd) node ``` diff --git a/examples/README.md b/examples/README.md index 92e83eb39c6..b87324b7e0b 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,6 +1,18 @@ # Running the examples -Assuming you have a checkout of the Puppeteer repo and have run `npm i` (or `yarn`) to install the dependencies, and `npm run build` (or `yarn run build`) to build the project, the examples can be run from the root folder like so: +Assuming you have a checkout of the Puppeteer repo and install the dependencies: + +```bash npm2yarn +npm install +``` + +Build the project: + +```bash npm2yarn +npm run build +``` + +The examples can be run from the root folder like so: ```bash NODE_PATH=../ node examples/search.js diff --git a/packages/ng-schematics/README.md b/packages/ng-schematics/README.md index 975f74a704a..2c84b7bc9ef 100644 --- a/packages/ng-schematics/README.md +++ b/packages/ng-schematics/README.md @@ -85,7 +85,7 @@ node tools/smoke.mjs The schematics utilize `@angular-devkit/schematics/testing` for verifying correct file creation and `package.json` updates. To execute the test suit: -```bash +```bash npm2yarn npm run test ``` diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 2f7a9a35837..2372ddf7f9b 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -236,6 +236,9 @@ const config = { path: DOC_PATH, routeBasePath: DOC_ROUTE_BASE_PATH, sidebarPath: require.resolve('./sidebars.js'), + remarkPlugins: [ + [require('@docusaurus/remark-plugin-npm2yarn'), {sync: true}], + ], }, theme: { customCss: require.resolve('./src/css/custom.css'), diff --git a/website/package-lock.json b/website/package-lock.json index 41892bcb694..67982f5e80e 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -11,6 +11,7 @@ "@docusaurus/core": "3.2.1", "@docusaurus/plugin-client-redirects": "3.2.1", "@docusaurus/preset-classic": "3.2.1", + "@docusaurus/remark-plugin-npm2yarn": "3.2.1", "@mdx-js/react": "3.0.1", "clsx": "2.1.0", "prism-react-renderer": "2.3.1", @@ -2593,6 +2594,21 @@ "react": "*" } }, + "node_modules/@docusaurus/remark-plugin-npm2yarn": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@docusaurus/remark-plugin-npm2yarn/-/remark-plugin-npm2yarn-3.2.1.tgz", + "integrity": "sha512-10sLhtIp2O0T7uEqVz82T4luXjnKiishwRbCAO+HgdFTsoVWs3RmrZHdk4Y5/s4Kgl2ptUPZIec3RdPoTY9vcA==", + "dependencies": { + "mdast-util-mdx": "^3.0.0", + "npm-to-yarn": "^2.2.1", + "tslib": "^2.6.0", + "unified": "^11.0.3", + "unist-util-visit": "^5.0.0" + }, + "engines": { + "node": ">=18.0" + } + }, "node_modules/@docusaurus/theme-classic": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/@docusaurus/theme-classic/-/theme-classic-3.2.1.tgz", @@ -10542,6 +10558,17 @@ "node": ">=8" } }, + "node_modules/npm-to-yarn": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/npm-to-yarn/-/npm-to-yarn-2.2.1.tgz", + "integrity": "sha512-O/j/ROyX0KGLG7O6Ieut/seQ0oiTpHF2tXAcFbpdTLQFiaNtkyTXXocM1fwpaa60dg1qpWj0nHlbNhx6qwuENQ==", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/nebrelbug/npm-to-yarn?sponsor=1" + } + }, "node_modules/nprogress": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz", diff --git a/website/package.json b/website/package.json index eb6c56e5e0b..029295d1c07 100644 --- a/website/package.json +++ b/website/package.json @@ -18,6 +18,7 @@ "@docusaurus/core": "3.2.1", "@docusaurus/plugin-client-redirects": "3.2.1", "@docusaurus/preset-classic": "3.2.1", + "@docusaurus/remark-plugin-npm2yarn": "3.2.1", "@mdx-js/react": "3.0.1", "clsx": "2.1.0", "prism-react-renderer": "2.3.1",