From f6ec757aa0119eea53dc193a680e7282de68f419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lorber?= Date: Thu, 7 Oct 2021 16:06:42 +0200 Subject: [PATCH] feat: npm init docusaurus, yarn create docusaurus (#5635) * initial create-docusaurus impl * cleanup * @docusaurus/init renamed to create-docusaurus * 0.0.6 * update lockfile * fix lint * remove npm2yarn for "npm init" because npm2yarn doesn't convert it and yarn result fails to execute * prettier * add correct version * prettier * prettier * prettier * prettier * fix annoying --config .prettierrc issue --- .eslintignore | 3 ++- .eslintrc.js | 6 +++--- .github/workflows/v2-build-size-report.yml | 4 ---- .github/workflows/v2-build-time-perf.yml | 3 --- .github/workflows/v2-lighthouse-report.yml | 4 ---- .github/workflows/v2-tests-e2e.yml | 4 ---- .github/workflows/v2-tests-windows.yml | 4 ---- .github/workflows/v2-tests.yml | 4 ---- .gitignore | 1 + .prettierignore | 3 ++- .stylelintignore | 2 +- README.md | 4 ++-- admin/local-third-party-project-testing.md | 2 +- admin/publish.md | 8 +++----- admin/scripts/test-release.sh | 4 ++-- generateExamples.js | 8 ++++---- package.json | 6 +++--- .../README.md | 16 ++++++++++++---- .../bin/index.js | 4 ++-- .../package.json | 7 ++++--- .../src/index.ts | 0 .../templates/README.md | 2 +- .../templates/classic-typescript/package.json | 0 .../src/components/HomepageFeatures.module.css | 0 .../src/components/HomepageFeatures.tsx | 0 .../src/pages/index.module.css | 0 .../classic-typescript/src/pages/index.tsx | 0 .../templates/classic-typescript/tsconfig.json | 0 .../templates/classic/docusaurus.config.js | 0 .../templates/classic/package.json | 0 .../classic/src/components/HomepageFeatures.js | 0 .../src/components/HomepageFeatures.module.css | 0 .../templates/classic/src/css/custom.css | 0 .../templates/classic/src/pages/index.js | 0 .../classic/src/pages/index.module.css | 0 .../templates/facebook/.eslintrc.js | 0 .../templates/facebook/.prettierignore | 0 .../templates/facebook/.prettierrc | 0 .../templates/facebook/.stylelintrc.js | 0 .../templates/facebook/README.md | 0 .../templates/facebook/babel.config.js | 0 .../templates/facebook/docusaurus.config.js | 0 .../templates/facebook/gitignore | 0 .../templates/facebook/package.json | 0 .../templates/facebook/sidebars.js | 0 .../templates/facebook/src/css/custom.css | 0 .../templates/facebook/src/pages/index.js | 0 .../facebook/src/pages/styles.module.css | 0 .../templates/facebook/static/img/oss_logo.png | Bin .../templates/shared/README.md | 0 .../templates/shared/babel.config.js | 0 .../shared/blog/2019-05-28-first-blog-post.md | 0 .../shared/blog/2019-05-29-long-blog-post.md | 0 .../shared/blog/2021-08-01-mdx-blog-post.mdx | 0 .../docusaurus-plushie-banner.jpeg | Bin .../shared/blog/2021-08-26-welcome/index.md | 0 .../templates/shared/blog/authors.yml | 0 .../templates/shared/docs/intro.md | 2 +- .../shared/docs/tutorial-basics/_category_.json | 0 .../docs/tutorial-basics/congratulations.md | 0 .../docs/tutorial-basics/create-a-blog-post.md | 0 .../docs/tutorial-basics/create-a-document.md | 0 .../docs/tutorial-basics/create-a-page.md | 0 .../docs/tutorial-basics/deploy-your-site.md | 0 .../docs/tutorial-basics/markdown-features.mdx | 0 .../shared/docs/tutorial-extras/_category_.json | 0 .../tutorial-extras/manage-docs-versions.md | 0 .../docs/tutorial-extras/translate-your-site.md | 0 .../templates/shared/gitignore | 0 .../templates/shared/sidebars.js | 0 .../templates/shared/src/pages/markdown-page.md | 0 .../templates/shared/static/.nojekyll | 0 .../templates/shared/static/img/docusaurus.png | Bin .../templates/shared/static/img/favicon.ico | Bin .../templates/shared/static/img/logo.svg | 0 .../static/img/tutorial/docsVersionDropdown.png | Bin .../static/img/tutorial/localeDropdown.png | Bin .../static/img/undraw_docusaurus_mountain.svg | 0 .../static/img/undraw_docusaurus_react.svg | 0 .../static/img/undraw_docusaurus_tree.svg | 0 .../tsconfig.json | 0 website/docs/i18n/i18n-crowdin.mdx | 2 +- website/docs/i18n/i18n-git.md | 2 +- website/docs/i18n/i18n-tutorial.md | 2 +- website/docs/installation.md | 12 ++++++------ website/docs/introduction.md | 2 +- website/docs/migration/migration-manual.md | 2 +- website/docs/typescript-support.md | 2 +- .../version-2.0.0-beta.5/i18n/i18n-crowdin.mdx | 2 +- .../version-2.0.0-beta.5/i18n/i18n-git.md | 2 +- .../version-2.0.0-beta.5/i18n/i18n-tutorial.md | 2 +- .../version-2.0.0-beta.5/installation.md | 12 ++++++------ .../version-2.0.0-beta.5/introduction.md | 2 +- .../migration/migration-manual.md | 2 +- .../version-2.0.0-beta.5/typescript-support.md | 2 +- .../version-2.0.0-beta.6/i18n/i18n-crowdin.mdx | 2 +- .../version-2.0.0-beta.6/i18n/i18n-git.md | 2 +- .../version-2.0.0-beta.6/i18n/i18n-tutorial.md | 2 +- .../version-2.0.0-beta.6/installation.md | 12 ++++++------ .../version-2.0.0-beta.6/introduction.md | 2 +- .../migration/migration-manual.md | 2 +- .../version-2.0.0-beta.6/typescript-support.md | 2 +- 102 files changed, 80 insertions(+), 93 deletions(-) rename packages/{docusaurus-init => create-docusaurus}/README.md (69%) rename packages/{docusaurus-init => create-docusaurus}/bin/index.js (93%) rename packages/{docusaurus-init => create-docusaurus}/package.json (82%) rename packages/{docusaurus-init => create-docusaurus}/src/index.ts (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/README.md (75%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic-typescript/package.json (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic-typescript/src/components/HomepageFeatures.module.css (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic-typescript/src/components/HomepageFeatures.tsx (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic-typescript/src/pages/index.module.css (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic-typescript/src/pages/index.tsx (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic-typescript/tsconfig.json (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic/docusaurus.config.js (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic/package.json (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic/src/components/HomepageFeatures.js (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic/src/components/HomepageFeatures.module.css (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic/src/css/custom.css (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic/src/pages/index.js (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/classic/src/pages/index.module.css (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/.eslintrc.js (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/.prettierignore (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/.prettierrc (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/.stylelintrc.js (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/README.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/babel.config.js (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/docusaurus.config.js (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/gitignore (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/package.json (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/sidebars.js (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/src/css/custom.css (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/src/pages/index.js (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/src/pages/styles.module.css (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/facebook/static/img/oss_logo.png (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/README.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/babel.config.js (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/blog/2019-05-28-first-blog-post.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/blog/2019-05-29-long-blog-post.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/blog/2021-08-01-mdx-blog-post.mdx (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/blog/2021-08-26-welcome/index.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/blog/authors.yml (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/docs/intro.md (92%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/docs/tutorial-basics/_category_.json (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/docs/tutorial-basics/congratulations.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/docs/tutorial-basics/create-a-blog-post.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/docs/tutorial-basics/create-a-document.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/docs/tutorial-basics/create-a-page.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/docs/tutorial-basics/deploy-your-site.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/docs/tutorial-basics/markdown-features.mdx (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/docs/tutorial-extras/_category_.json (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/docs/tutorial-extras/manage-docs-versions.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/docs/tutorial-extras/translate-your-site.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/gitignore (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/sidebars.js (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/src/pages/markdown-page.md (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/static/.nojekyll (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/static/img/docusaurus.png (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/static/img/favicon.ico (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/static/img/logo.svg (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/static/img/tutorial/docsVersionDropdown.png (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/static/img/tutorial/localeDropdown.png (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/static/img/undraw_docusaurus_mountain.svg (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/static/img/undraw_docusaurus_react.svg (100%) rename packages/{docusaurus-init => create-docusaurus}/templates/shared/static/img/undraw_docusaurus_tree.svg (100%) rename packages/{docusaurus-init => create-docusaurus}/tsconfig.json (100%) diff --git a/.eslintignore b/.eslintignore index 39f4f1bbf6d3..d6041c53405c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -15,4 +15,5 @@ packages/docusaurus-*/lib/* packages/docusaurus-*/lib-next/ packages/docusaurus-plugin-ideal-image/copyUntypedFiles.js -packages/docusaurus-init/templates/facebook/.eslintrc.js +packages/create-docusaurus/lib/* +packages/create-docusaurus/templates/facebook/.eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js index 427c59ef5497..886bd74c917a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -136,9 +136,9 @@ module.exports = { overrides: [ { files: [ - 'packages/docusaurus-init/templates/**/*.js', - 'packages/docusaurus-init/templates/**/*.ts', - 'packages/docusaurus-init/templates/**/*.tsx', + 'packages/create-docusaurus/templates/**/*.js', + 'packages/create-docusaurus/templates/**/*.ts', + 'packages/create-docusaurus/templates/**/*.tsx', ], rules: { 'header/header': OFF, diff --git a/.github/workflows/v2-build-size-report.yml b/.github/workflows/v2-build-size-report.yml index f81e754c6b0a..db30f8d925b9 100644 --- a/.github/workflows/v2-build-size-report.yml +++ b/.github/workflows/v2-build-size-report.yml @@ -9,10 +9,6 @@ on: pull_request: branches: - main - paths-ignore: - - 'website-1.x/**' - - 'packages/docusaurus-1.x/**' - - 'packages/docusaurus-init-1.x/**' jobs: build: diff --git a/.github/workflows/v2-build-time-perf.yml b/.github/workflows/v2-build-time-perf.yml index 79e08546693c..227c3b7232a5 100644 --- a/.github/workflows/v2-build-time-perf.yml +++ b/.github/workflows/v2-build-time-perf.yml @@ -6,9 +6,6 @@ on: - main paths-ignore: - 'website/docs/**' - - 'website-1.x/**' - - 'packages/docusaurus-1.x/**' - - 'packages/docusaurus-init-1.x/**' jobs: build: diff --git a/.github/workflows/v2-lighthouse-report.yml b/.github/workflows/v2-lighthouse-report.yml index dc03732340e3..6714047231f9 100644 --- a/.github/workflows/v2-lighthouse-report.yml +++ b/.github/workflows/v2-lighthouse-report.yml @@ -4,10 +4,6 @@ on: pull_request_target: branches: - main - paths-ignore: - - 'website-1.x/**' - - 'packages/docusaurus-1.x/**' - - 'packages/docusaurus-init-1.x/**' jobs: build: diff --git a/.github/workflows/v2-tests-e2e.yml b/.github/workflows/v2-tests-e2e.yml index 43ca2d425efa..61f49a6d509b 100644 --- a/.github/workflows/v2-tests-e2e.yml +++ b/.github/workflows/v2-tests-e2e.yml @@ -7,10 +7,6 @@ on: pull_request: branches: - main - paths-ignore: - - 'website-1.x/**' - - 'packages/docusaurus-1.x/**' - - 'packages/docusaurus-init-1.x/**' jobs: yarn-v1: diff --git a/.github/workflows/v2-tests-windows.yml b/.github/workflows/v2-tests-windows.yml index 42e2587c0e46..cca5a8979a2b 100644 --- a/.github/workflows/v2-tests-windows.yml +++ b/.github/workflows/v2-tests-windows.yml @@ -4,10 +4,6 @@ on: pull_request: branches: - main - paths-ignore: - - 'website-1.x/**' - - 'packages/docusaurus-1.x/**' - - 'packages/docusaurus-init-1.x/**' jobs: build: diff --git a/.github/workflows/v2-tests.yml b/.github/workflows/v2-tests.yml index 4f6546d86ac2..de1cb4aa7f07 100644 --- a/.github/workflows/v2-tests.yml +++ b/.github/workflows/v2-tests.yml @@ -4,10 +4,6 @@ on: pull_request: branches: - main - paths-ignore: - - 'website-1.x/**' - - 'packages/docusaurus-1.x/**' - - 'packages/docusaurus-init-1.x/**' jobs: test: diff --git a/.gitignore b/.gitignore index 640b8f236a91..58532e1f0277 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ types test-website test-website-in-workspace +packages/create-docusaurus/lib/ packages/docusaurus/lib/ packages/docusaurus-*/lib/* packages/docusaurus-*/lib-next/ diff --git a/.prettierignore b/.prettierignore index 352d361bc1ed..3aceea61ebf1 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,7 +7,8 @@ coverage packages/docusaurus/lib/ packages/docusaurus-*/lib/* packages/docusaurus-*/lib-next/ -packages/docusaurus-init/templates/*/docusaurus.config.js +packages/create-docusaurus/lib/* +packages/create-docusaurus/templates/*/docusaurus.config.js __fixtures__ website/i18n diff --git a/.stylelintignore b/.stylelintignore index df85da0e8276..665165dff2d3 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -1,2 +1,2 @@ -packages/docusaurus-init/templates/ +packages/create-docusaurus/templates/ examples diff --git a/README.md b/README.md index 86fa9f2f7a74..fb25e8fd8a6b 100644 --- a/README.md +++ b/README.md @@ -48,13 +48,13 @@ Short on time? Check out our [5-minute tutorial ⏱️](https://tutorial.docusau Use the initialization cli to create your site: ```bash -npx @docusaurus/init@latest init [name] [template] +npm init docusaurus@latest [name] [template] ``` Example: ```bash -npx @docusaurus/init@latest init my-website classic +npm init docusaurus@latest my-website classic ``` ## Contributing diff --git a/admin/local-third-party-project-testing.md b/admin/local-third-party-project-testing.md index ae4c0e6fdc80..833ff7c90149 100644 --- a/admin/local-third-party-project-testing.md +++ b/admin/local-third-party-project-testing.md @@ -6,7 +6,7 @@ There are two reasonable ways to use a local version of the Docusaurus npm packa ## Install from a local Docusaurus repo -> If you want to use the docusaurus-init script for testing, you will have to update the `initialize.js` file to point to the local Docusaurus repo instead of installing it from the npm server. In some ways, it is just easier to do the manual steps. +> If you want to use the docusaurus init script for testing, you will have to update the `initialize.js` file to point to the local Docusaurus repo instead of installing it from the npm server. In some ways, it is just easier to do the manual steps. ### Install the package from the Docusaurus repo diff --git a/admin/publish.md b/admin/publish.md index 4fede306937b..19c704488bd4 100644 --- a/admin/publish.md +++ b/admin/publish.md @@ -153,12 +153,11 @@ npm access ls-packages "@docusaurus/theme-live-codeblock": "read-write", "@docusaurus/plugin-google-analytics": "read-write", "@docusaurus/plugin-google-gtag": "read-write", - "@docusaurus/init": "read-write", "@docusaurus/plugin-content-docs-legacy": "read-write", "@docusaurus/plugin-ideal-image": "read-write", "@docusaurus/types": "read-write", + "create-docusaurus": "read-write", "docusaurus": "read-write", - "docusaurus-init": "read-write", "stylelint-copyright": "read-write" } @@ -166,11 +165,10 @@ npm access ls-packages It can happen that some accesses are not granted, as an admin might add you to the @docusaurus NPM organization, but you don't have access to the packages that are not in that organization. -Please **double-check your permissions on these 3 packages**, otherwise you'll publish a half-release and will have to release a new version. +Please **double-check your permissions on these packages**, otherwise you'll publish a half-release and will have to release a new version. ``` - "docusaurus": "read-write", - "docusaurus-init": "read-write", + "create-docusaurus": "read-write", "stylelint-copyright": "read-write" ``` diff --git a/admin/scripts/test-release.sh b/admin/scripts/test-release.sh index 896915ebc68a..7536c0813e21 100755 --- a/admin/scripts/test-release.sh +++ b/admin/scripts/test-release.sh @@ -32,7 +32,7 @@ shift $((OPTIND-1)) if [ ! -z $EXTRA_OPTS ] then - echo docusaurus-init extra options = ${EXTRA_OPTS} + echo create-docusaurus extra options = ${EXTRA_OPTS} fi # Run Docker container with private npm registry Verdaccio @@ -48,7 +48,7 @@ npx --no-install lerna publish --exact --yes --no-verify-access --no-git-reset - git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout -- # Build skeleton website with new version -npm_config_registry="$CUSTOM_REGISTRY_URL" npx @docusaurus/init@"$NEW_VERSION" init test-website classic $EXTRA_OPTS +npm_config_registry="$CUSTOM_REGISTRY_URL" npm init docusaurus@"$NEW_VERSION" test-website classic $EXTRA_OPTS # Stop Docker container if [[ -z "${KEEP_CONTAINER:-}" ]] && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then diff --git a/generateExamples.js b/generateExamples.js index a6381c3ceb81..64c34254abda 100644 --- a/generateExamples.js +++ b/generateExamples.js @@ -27,7 +27,7 @@ function generateTemplateExample(template) { // /!\ we use the published init script on purpose, // because using the local init script is too early and could generate upcoming/unavailable config options // remember CodeSandbox templates will use the published version, not the repo version - `npx @docusaurus/init@latest init examples/${template} ${command}`, + `npm init docusaurus@latest examples/${template} ${command}`, // `node ./packages/docusaurus-init/bin/index.js init examples/${template} ${template}`, { stdio: 'inherit', @@ -175,9 +175,9 @@ function run() { console.log('## Generate example folders...'); console.log(''); const excludes = ['README.md', 'shared']; - const templates = readdirSync('./packages/docusaurus-init/templates').filter( - (name) => !excludes.includes(name), - ); + const templates = readdirSync( + './packages/create-docusaurus/templates', + ).filter((name) => !excludes.includes(name)); console.log(`Will generate examples for templates: ${templates}`); templates.forEach(generateTemplateExample); console.log('Commiting changes'); diff --git a/package.json b/package.json index 74e542329720..1df9b693a623 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "packages/*", "website", "test-website-in-workspace", - "packages/docusaurus-init/templates/*", + "packages/create-docusaurus/templates/*", "admin/new.docusaurus.io" ], "scripts": { @@ -119,10 +119,10 @@ "lint-staged": { "*.{js,jsx,ts,tsx}": [ "eslint --fix", - "prettier --write" + "prettier --config .prettierrc --write" ], "*.{md,mdx}": [ - "prettier --write" + "prettier --config .prettierrc --write" ] }, "engines": { diff --git a/packages/docusaurus-init/README.md b/packages/create-docusaurus/README.md similarity index 69% rename from packages/docusaurus-init/README.md rename to packages/create-docusaurus/README.md index 798fc6302cb1..0da2968c6b72 100644 --- a/packages/docusaurus-init/README.md +++ b/packages/create-docusaurus/README.md @@ -1,6 +1,14 @@ -# `@docusaurus/init` +# `create-docusaurus` -Create Docusaurus apps easily. +Create Docusaurus apps easily with simplified commands: + +```bash +npm init docusaurus +``` + +```bash +yarn create docusaurus +``` ## Usage @@ -13,7 +21,7 @@ For Docusaurus maintainers, templates can be tested with: ```bash cd `git rev-parse --show-toplevel` # Back to repo root rm -rf test-website -yarn docusaurus-init init test-website classic +yarn create-docusaurus test-website classic cd test-website yarn start ``` @@ -25,7 +33,7 @@ Use the following to test the templates against local packages: ```bash cd `git rev-parse --show-toplevel` # Back to repo root rm -rf test-website-in-workspace -yarn docusaurus-init init test-website-in-workspace classic +yarn create-docusaurus test-website-in-workspace classic cd test-website-in-workspace yarn start ``` diff --git a/packages/docusaurus-init/bin/index.js b/packages/create-docusaurus/bin/index.js similarity index 93% rename from packages/docusaurus-init/bin/index.js rename to packages/create-docusaurus/bin/index.js index 4e5ef5ff6ac8..2585601056c2 100755 --- a/packages/docusaurus-init/bin/index.js +++ b/packages/create-docusaurus/bin/index.js @@ -36,7 +36,7 @@ program .usage(' [options]'); program - .command('init [siteName] [template] [rootDir]') + .command('init [siteName] [template] [rootDir]', {isDefault: true}) .option('--use-npm') .option('--skip-install') .option('--typescript') @@ -59,6 +59,6 @@ program.arguments('').action((cmd) => { program.parse(process.argv); -if (!process.argv.slice(2).length) { +if (!process.argv.slice(1).length) { program.outputHelp(); } diff --git a/packages/docusaurus-init/package.json b/packages/create-docusaurus/package.json similarity index 82% rename from packages/docusaurus-init/package.json rename to packages/create-docusaurus/package.json index 513ad2aee076..5c824f32d431 100755 --- a/packages/docusaurus-init/package.json +++ b/packages/create-docusaurus/package.json @@ -1,21 +1,22 @@ { - "name": "@docusaurus/init", + "name": "create-docusaurus", "version": "2.0.0-beta.6", "description": "Create Docusaurus apps easily.", "repository": { "type": "git", "url": "https://github.com/facebook/docusaurus.git", - "directory": "packages/docusaurus-init" + "directory": "packages/create-docusaurus" }, "bugs": { "url": "https://github.com/facebook/docusaurus/issues" }, "scripts": { + "create-docusaurus": "create-docusaurus", "build": "tsc", "watch": "tsc --watch" }, "bin": { - "docusaurus-init": "bin/index.js" + "create-docusaurus": "bin/index.js" }, "publishConfig": { "access": "public" diff --git a/packages/docusaurus-init/src/index.ts b/packages/create-docusaurus/src/index.ts similarity index 100% rename from packages/docusaurus-init/src/index.ts rename to packages/create-docusaurus/src/index.ts diff --git a/packages/docusaurus-init/templates/README.md b/packages/create-docusaurus/templates/README.md similarity index 75% rename from packages/docusaurus-init/templates/README.md rename to packages/create-docusaurus/templates/README.md index 882b078e990d..ae83b4501667 100644 --- a/packages/docusaurus-init/templates/README.md +++ b/packages/create-docusaurus/templates/README.md @@ -1,6 +1,6 @@ # Templates -Official templates provided by Docusaurus. They are designed to be selected when using the `npx @docusaurus/init init [name] [template]` CLI command. +Official templates provided by Docusaurus. They are designed to be selected when using the `npm init docusaurus` CLI command. ## Guide to Test Templates for Developer diff --git a/packages/docusaurus-init/templates/classic-typescript/package.json b/packages/create-docusaurus/templates/classic-typescript/package.json similarity index 100% rename from packages/docusaurus-init/templates/classic-typescript/package.json rename to packages/create-docusaurus/templates/classic-typescript/package.json diff --git a/packages/docusaurus-init/templates/classic-typescript/src/components/HomepageFeatures.module.css b/packages/create-docusaurus/templates/classic-typescript/src/components/HomepageFeatures.module.css similarity index 100% rename from packages/docusaurus-init/templates/classic-typescript/src/components/HomepageFeatures.module.css rename to packages/create-docusaurus/templates/classic-typescript/src/components/HomepageFeatures.module.css diff --git a/packages/docusaurus-init/templates/classic-typescript/src/components/HomepageFeatures.tsx b/packages/create-docusaurus/templates/classic-typescript/src/components/HomepageFeatures.tsx similarity index 100% rename from packages/docusaurus-init/templates/classic-typescript/src/components/HomepageFeatures.tsx rename to packages/create-docusaurus/templates/classic-typescript/src/components/HomepageFeatures.tsx diff --git a/packages/docusaurus-init/templates/classic-typescript/src/pages/index.module.css b/packages/create-docusaurus/templates/classic-typescript/src/pages/index.module.css similarity index 100% rename from packages/docusaurus-init/templates/classic-typescript/src/pages/index.module.css rename to packages/create-docusaurus/templates/classic-typescript/src/pages/index.module.css diff --git a/packages/docusaurus-init/templates/classic-typescript/src/pages/index.tsx b/packages/create-docusaurus/templates/classic-typescript/src/pages/index.tsx similarity index 100% rename from packages/docusaurus-init/templates/classic-typescript/src/pages/index.tsx rename to packages/create-docusaurus/templates/classic-typescript/src/pages/index.tsx diff --git a/packages/docusaurus-init/templates/classic-typescript/tsconfig.json b/packages/create-docusaurus/templates/classic-typescript/tsconfig.json similarity index 100% rename from packages/docusaurus-init/templates/classic-typescript/tsconfig.json rename to packages/create-docusaurus/templates/classic-typescript/tsconfig.json diff --git a/packages/docusaurus-init/templates/classic/docusaurus.config.js b/packages/create-docusaurus/templates/classic/docusaurus.config.js similarity index 100% rename from packages/docusaurus-init/templates/classic/docusaurus.config.js rename to packages/create-docusaurus/templates/classic/docusaurus.config.js diff --git a/packages/docusaurus-init/templates/classic/package.json b/packages/create-docusaurus/templates/classic/package.json similarity index 100% rename from packages/docusaurus-init/templates/classic/package.json rename to packages/create-docusaurus/templates/classic/package.json diff --git a/packages/docusaurus-init/templates/classic/src/components/HomepageFeatures.js b/packages/create-docusaurus/templates/classic/src/components/HomepageFeatures.js similarity index 100% rename from packages/docusaurus-init/templates/classic/src/components/HomepageFeatures.js rename to packages/create-docusaurus/templates/classic/src/components/HomepageFeatures.js diff --git a/packages/docusaurus-init/templates/classic/src/components/HomepageFeatures.module.css b/packages/create-docusaurus/templates/classic/src/components/HomepageFeatures.module.css similarity index 100% rename from packages/docusaurus-init/templates/classic/src/components/HomepageFeatures.module.css rename to packages/create-docusaurus/templates/classic/src/components/HomepageFeatures.module.css diff --git a/packages/docusaurus-init/templates/classic/src/css/custom.css b/packages/create-docusaurus/templates/classic/src/css/custom.css similarity index 100% rename from packages/docusaurus-init/templates/classic/src/css/custom.css rename to packages/create-docusaurus/templates/classic/src/css/custom.css diff --git a/packages/docusaurus-init/templates/classic/src/pages/index.js b/packages/create-docusaurus/templates/classic/src/pages/index.js similarity index 100% rename from packages/docusaurus-init/templates/classic/src/pages/index.js rename to packages/create-docusaurus/templates/classic/src/pages/index.js diff --git a/packages/docusaurus-init/templates/classic/src/pages/index.module.css b/packages/create-docusaurus/templates/classic/src/pages/index.module.css similarity index 100% rename from packages/docusaurus-init/templates/classic/src/pages/index.module.css rename to packages/create-docusaurus/templates/classic/src/pages/index.module.css diff --git a/packages/docusaurus-init/templates/facebook/.eslintrc.js b/packages/create-docusaurus/templates/facebook/.eslintrc.js similarity index 100% rename from packages/docusaurus-init/templates/facebook/.eslintrc.js rename to packages/create-docusaurus/templates/facebook/.eslintrc.js diff --git a/packages/docusaurus-init/templates/facebook/.prettierignore b/packages/create-docusaurus/templates/facebook/.prettierignore similarity index 100% rename from packages/docusaurus-init/templates/facebook/.prettierignore rename to packages/create-docusaurus/templates/facebook/.prettierignore diff --git a/packages/docusaurus-init/templates/facebook/.prettierrc b/packages/create-docusaurus/templates/facebook/.prettierrc similarity index 100% rename from packages/docusaurus-init/templates/facebook/.prettierrc rename to packages/create-docusaurus/templates/facebook/.prettierrc diff --git a/packages/docusaurus-init/templates/facebook/.stylelintrc.js b/packages/create-docusaurus/templates/facebook/.stylelintrc.js similarity index 100% rename from packages/docusaurus-init/templates/facebook/.stylelintrc.js rename to packages/create-docusaurus/templates/facebook/.stylelintrc.js diff --git a/packages/docusaurus-init/templates/facebook/README.md b/packages/create-docusaurus/templates/facebook/README.md similarity index 100% rename from packages/docusaurus-init/templates/facebook/README.md rename to packages/create-docusaurus/templates/facebook/README.md diff --git a/packages/docusaurus-init/templates/facebook/babel.config.js b/packages/create-docusaurus/templates/facebook/babel.config.js similarity index 100% rename from packages/docusaurus-init/templates/facebook/babel.config.js rename to packages/create-docusaurus/templates/facebook/babel.config.js diff --git a/packages/docusaurus-init/templates/facebook/docusaurus.config.js b/packages/create-docusaurus/templates/facebook/docusaurus.config.js similarity index 100% rename from packages/docusaurus-init/templates/facebook/docusaurus.config.js rename to packages/create-docusaurus/templates/facebook/docusaurus.config.js diff --git a/packages/docusaurus-init/templates/facebook/gitignore b/packages/create-docusaurus/templates/facebook/gitignore similarity index 100% rename from packages/docusaurus-init/templates/facebook/gitignore rename to packages/create-docusaurus/templates/facebook/gitignore diff --git a/packages/docusaurus-init/templates/facebook/package.json b/packages/create-docusaurus/templates/facebook/package.json similarity index 100% rename from packages/docusaurus-init/templates/facebook/package.json rename to packages/create-docusaurus/templates/facebook/package.json diff --git a/packages/docusaurus-init/templates/facebook/sidebars.js b/packages/create-docusaurus/templates/facebook/sidebars.js similarity index 100% rename from packages/docusaurus-init/templates/facebook/sidebars.js rename to packages/create-docusaurus/templates/facebook/sidebars.js diff --git a/packages/docusaurus-init/templates/facebook/src/css/custom.css b/packages/create-docusaurus/templates/facebook/src/css/custom.css similarity index 100% rename from packages/docusaurus-init/templates/facebook/src/css/custom.css rename to packages/create-docusaurus/templates/facebook/src/css/custom.css diff --git a/packages/docusaurus-init/templates/facebook/src/pages/index.js b/packages/create-docusaurus/templates/facebook/src/pages/index.js similarity index 100% rename from packages/docusaurus-init/templates/facebook/src/pages/index.js rename to packages/create-docusaurus/templates/facebook/src/pages/index.js diff --git a/packages/docusaurus-init/templates/facebook/src/pages/styles.module.css b/packages/create-docusaurus/templates/facebook/src/pages/styles.module.css similarity index 100% rename from packages/docusaurus-init/templates/facebook/src/pages/styles.module.css rename to packages/create-docusaurus/templates/facebook/src/pages/styles.module.css diff --git a/packages/docusaurus-init/templates/facebook/static/img/oss_logo.png b/packages/create-docusaurus/templates/facebook/static/img/oss_logo.png similarity index 100% rename from packages/docusaurus-init/templates/facebook/static/img/oss_logo.png rename to packages/create-docusaurus/templates/facebook/static/img/oss_logo.png diff --git a/packages/docusaurus-init/templates/shared/README.md b/packages/create-docusaurus/templates/shared/README.md similarity index 100% rename from packages/docusaurus-init/templates/shared/README.md rename to packages/create-docusaurus/templates/shared/README.md diff --git a/packages/docusaurus-init/templates/shared/babel.config.js b/packages/create-docusaurus/templates/shared/babel.config.js similarity index 100% rename from packages/docusaurus-init/templates/shared/babel.config.js rename to packages/create-docusaurus/templates/shared/babel.config.js diff --git a/packages/docusaurus-init/templates/shared/blog/2019-05-28-first-blog-post.md b/packages/create-docusaurus/templates/shared/blog/2019-05-28-first-blog-post.md similarity index 100% rename from packages/docusaurus-init/templates/shared/blog/2019-05-28-first-blog-post.md rename to packages/create-docusaurus/templates/shared/blog/2019-05-28-first-blog-post.md diff --git a/packages/docusaurus-init/templates/shared/blog/2019-05-29-long-blog-post.md b/packages/create-docusaurus/templates/shared/blog/2019-05-29-long-blog-post.md similarity index 100% rename from packages/docusaurus-init/templates/shared/blog/2019-05-29-long-blog-post.md rename to packages/create-docusaurus/templates/shared/blog/2019-05-29-long-blog-post.md diff --git a/packages/docusaurus-init/templates/shared/blog/2021-08-01-mdx-blog-post.mdx b/packages/create-docusaurus/templates/shared/blog/2021-08-01-mdx-blog-post.mdx similarity index 100% rename from packages/docusaurus-init/templates/shared/blog/2021-08-01-mdx-blog-post.mdx rename to packages/create-docusaurus/templates/shared/blog/2021-08-01-mdx-blog-post.mdx diff --git a/packages/docusaurus-init/templates/shared/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg b/packages/create-docusaurus/templates/shared/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg similarity index 100% rename from packages/docusaurus-init/templates/shared/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg rename to packages/create-docusaurus/templates/shared/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg diff --git a/packages/docusaurus-init/templates/shared/blog/2021-08-26-welcome/index.md b/packages/create-docusaurus/templates/shared/blog/2021-08-26-welcome/index.md similarity index 100% rename from packages/docusaurus-init/templates/shared/blog/2021-08-26-welcome/index.md rename to packages/create-docusaurus/templates/shared/blog/2021-08-26-welcome/index.md diff --git a/packages/docusaurus-init/templates/shared/blog/authors.yml b/packages/create-docusaurus/templates/shared/blog/authors.yml similarity index 100% rename from packages/docusaurus-init/templates/shared/blog/authors.yml rename to packages/create-docusaurus/templates/shared/blog/authors.yml diff --git a/packages/docusaurus-init/templates/shared/docs/intro.md b/packages/create-docusaurus/templates/shared/docs/intro.md similarity index 92% rename from packages/docusaurus-init/templates/shared/docs/intro.md rename to packages/create-docusaurus/templates/shared/docs/intro.md index 61b5ad2a7284..e762190b4941 100644 --- a/packages/docusaurus-init/templates/shared/docs/intro.md +++ b/packages/create-docusaurus/templates/shared/docs/intro.md @@ -17,7 +17,7 @@ Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new Generate a new Docusaurus site using the **classic template**: ```shell -npx @docusaurus/init@latest init my-website classic +npm init docusaurus@latest my-website classic ``` ## Start your site diff --git a/packages/docusaurus-init/templates/shared/docs/tutorial-basics/_category_.json b/packages/create-docusaurus/templates/shared/docs/tutorial-basics/_category_.json similarity index 100% rename from packages/docusaurus-init/templates/shared/docs/tutorial-basics/_category_.json rename to packages/create-docusaurus/templates/shared/docs/tutorial-basics/_category_.json diff --git a/packages/docusaurus-init/templates/shared/docs/tutorial-basics/congratulations.md b/packages/create-docusaurus/templates/shared/docs/tutorial-basics/congratulations.md similarity index 100% rename from packages/docusaurus-init/templates/shared/docs/tutorial-basics/congratulations.md rename to packages/create-docusaurus/templates/shared/docs/tutorial-basics/congratulations.md diff --git a/packages/docusaurus-init/templates/shared/docs/tutorial-basics/create-a-blog-post.md b/packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-blog-post.md similarity index 100% rename from packages/docusaurus-init/templates/shared/docs/tutorial-basics/create-a-blog-post.md rename to packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-blog-post.md diff --git a/packages/docusaurus-init/templates/shared/docs/tutorial-basics/create-a-document.md b/packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-document.md similarity index 100% rename from packages/docusaurus-init/templates/shared/docs/tutorial-basics/create-a-document.md rename to packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-document.md diff --git a/packages/docusaurus-init/templates/shared/docs/tutorial-basics/create-a-page.md b/packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-page.md similarity index 100% rename from packages/docusaurus-init/templates/shared/docs/tutorial-basics/create-a-page.md rename to packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-page.md diff --git a/packages/docusaurus-init/templates/shared/docs/tutorial-basics/deploy-your-site.md b/packages/create-docusaurus/templates/shared/docs/tutorial-basics/deploy-your-site.md similarity index 100% rename from packages/docusaurus-init/templates/shared/docs/tutorial-basics/deploy-your-site.md rename to packages/create-docusaurus/templates/shared/docs/tutorial-basics/deploy-your-site.md diff --git a/packages/docusaurus-init/templates/shared/docs/tutorial-basics/markdown-features.mdx b/packages/create-docusaurus/templates/shared/docs/tutorial-basics/markdown-features.mdx similarity index 100% rename from packages/docusaurus-init/templates/shared/docs/tutorial-basics/markdown-features.mdx rename to packages/create-docusaurus/templates/shared/docs/tutorial-basics/markdown-features.mdx diff --git a/packages/docusaurus-init/templates/shared/docs/tutorial-extras/_category_.json b/packages/create-docusaurus/templates/shared/docs/tutorial-extras/_category_.json similarity index 100% rename from packages/docusaurus-init/templates/shared/docs/tutorial-extras/_category_.json rename to packages/create-docusaurus/templates/shared/docs/tutorial-extras/_category_.json diff --git a/packages/docusaurus-init/templates/shared/docs/tutorial-extras/manage-docs-versions.md b/packages/create-docusaurus/templates/shared/docs/tutorial-extras/manage-docs-versions.md similarity index 100% rename from packages/docusaurus-init/templates/shared/docs/tutorial-extras/manage-docs-versions.md rename to packages/create-docusaurus/templates/shared/docs/tutorial-extras/manage-docs-versions.md diff --git a/packages/docusaurus-init/templates/shared/docs/tutorial-extras/translate-your-site.md b/packages/create-docusaurus/templates/shared/docs/tutorial-extras/translate-your-site.md similarity index 100% rename from packages/docusaurus-init/templates/shared/docs/tutorial-extras/translate-your-site.md rename to packages/create-docusaurus/templates/shared/docs/tutorial-extras/translate-your-site.md diff --git a/packages/docusaurus-init/templates/shared/gitignore b/packages/create-docusaurus/templates/shared/gitignore similarity index 100% rename from packages/docusaurus-init/templates/shared/gitignore rename to packages/create-docusaurus/templates/shared/gitignore diff --git a/packages/docusaurus-init/templates/shared/sidebars.js b/packages/create-docusaurus/templates/shared/sidebars.js similarity index 100% rename from packages/docusaurus-init/templates/shared/sidebars.js rename to packages/create-docusaurus/templates/shared/sidebars.js diff --git a/packages/docusaurus-init/templates/shared/src/pages/markdown-page.md b/packages/create-docusaurus/templates/shared/src/pages/markdown-page.md similarity index 100% rename from packages/docusaurus-init/templates/shared/src/pages/markdown-page.md rename to packages/create-docusaurus/templates/shared/src/pages/markdown-page.md diff --git a/packages/docusaurus-init/templates/shared/static/.nojekyll b/packages/create-docusaurus/templates/shared/static/.nojekyll similarity index 100% rename from packages/docusaurus-init/templates/shared/static/.nojekyll rename to packages/create-docusaurus/templates/shared/static/.nojekyll diff --git a/packages/docusaurus-init/templates/shared/static/img/docusaurus.png b/packages/create-docusaurus/templates/shared/static/img/docusaurus.png similarity index 100% rename from packages/docusaurus-init/templates/shared/static/img/docusaurus.png rename to packages/create-docusaurus/templates/shared/static/img/docusaurus.png diff --git a/packages/docusaurus-init/templates/shared/static/img/favicon.ico b/packages/create-docusaurus/templates/shared/static/img/favicon.ico similarity index 100% rename from packages/docusaurus-init/templates/shared/static/img/favicon.ico rename to packages/create-docusaurus/templates/shared/static/img/favicon.ico diff --git a/packages/docusaurus-init/templates/shared/static/img/logo.svg b/packages/create-docusaurus/templates/shared/static/img/logo.svg similarity index 100% rename from packages/docusaurus-init/templates/shared/static/img/logo.svg rename to packages/create-docusaurus/templates/shared/static/img/logo.svg diff --git a/packages/docusaurus-init/templates/shared/static/img/tutorial/docsVersionDropdown.png b/packages/create-docusaurus/templates/shared/static/img/tutorial/docsVersionDropdown.png similarity index 100% rename from packages/docusaurus-init/templates/shared/static/img/tutorial/docsVersionDropdown.png rename to packages/create-docusaurus/templates/shared/static/img/tutorial/docsVersionDropdown.png diff --git a/packages/docusaurus-init/templates/shared/static/img/tutorial/localeDropdown.png b/packages/create-docusaurus/templates/shared/static/img/tutorial/localeDropdown.png similarity index 100% rename from packages/docusaurus-init/templates/shared/static/img/tutorial/localeDropdown.png rename to packages/create-docusaurus/templates/shared/static/img/tutorial/localeDropdown.png diff --git a/packages/docusaurus-init/templates/shared/static/img/undraw_docusaurus_mountain.svg b/packages/create-docusaurus/templates/shared/static/img/undraw_docusaurus_mountain.svg similarity index 100% rename from packages/docusaurus-init/templates/shared/static/img/undraw_docusaurus_mountain.svg rename to packages/create-docusaurus/templates/shared/static/img/undraw_docusaurus_mountain.svg diff --git a/packages/docusaurus-init/templates/shared/static/img/undraw_docusaurus_react.svg b/packages/create-docusaurus/templates/shared/static/img/undraw_docusaurus_react.svg similarity index 100% rename from packages/docusaurus-init/templates/shared/static/img/undraw_docusaurus_react.svg rename to packages/create-docusaurus/templates/shared/static/img/undraw_docusaurus_react.svg diff --git a/packages/docusaurus-init/templates/shared/static/img/undraw_docusaurus_tree.svg b/packages/create-docusaurus/templates/shared/static/img/undraw_docusaurus_tree.svg similarity index 100% rename from packages/docusaurus-init/templates/shared/static/img/undraw_docusaurus_tree.svg rename to packages/create-docusaurus/templates/shared/static/img/undraw_docusaurus_tree.svg diff --git a/packages/docusaurus-init/tsconfig.json b/packages/create-docusaurus/tsconfig.json similarity index 100% rename from packages/docusaurus-init/tsconfig.json rename to packages/create-docusaurus/tsconfig.json diff --git a/website/docs/i18n/i18n-crowdin.mdx b/website/docs/i18n/i18n-crowdin.mdx index 45a44e223579..dd0b77172c1b 100644 --- a/website/docs/i18n/i18n-crowdin.mdx +++ b/website/docs/i18n/i18n-crowdin.mdx @@ -51,7 +51,7 @@ The end result can be seen at [docusaurus-crowdin-example.netlify.app](https://d Initialize a new Docusaurus site: ```bash -npx @docusaurus/init@latest init website classic +npm init docusaurus@latest website classic ``` Add the site configuration for the French language: diff --git a/website/docs/i18n/i18n-git.md b/website/docs/i18n/i18n-git.md index 95b95d538aff..5a595909f5fc 100644 --- a/website/docs/i18n/i18n-git.md +++ b/website/docs/i18n/i18n-git.md @@ -39,7 +39,7 @@ This is a walk-through of using Git to translate a newly initialized English Doc Initialize a new Docusaurus site: ```bash -npx @docusaurus/init@latest init website classic +npm init docusaurus@latest website classic ``` Add the site configuration for the French language: diff --git a/website/docs/i18n/i18n-tutorial.md b/website/docs/i18n/i18n-tutorial.md index 61149335e8b6..aae7d0580696 100644 --- a/website/docs/i18n/i18n-tutorial.md +++ b/website/docs/i18n/i18n-tutorial.md @@ -8,7 +8,7 @@ This tutorial will walk you through the basis of the **Docusaurus i18n system**. We will add **French** translations to a **newly initialized English Docusaurus website**. -Initialize a new site with `npx @docusaurus/init@latest init website classic` (like [this one](https://github.com/facebook/docusaurus/tree/main/examples/classic)). +Initialize a new site with `npm init docusaurus@latest website classic` (like [this one](https://github.com/facebook/docusaurus/tree/main/examples/classic)). ## Configure your site {#configure-your-site} diff --git a/website/docs/installation.md b/website/docs/installation.md index a4cd6b8783cc..b56f467eba9d 100644 --- a/website/docs/installation.md +++ b/website/docs/installation.md @@ -23,33 +23,33 @@ Use **[docusaurus.new](https://docusaurus.new)** to test Docusaurus immediately The easiest way to install Docusaurus is to use the command line tool that helps you scaffold a skeleton Docusaurus website. You can run this command anywhere in a new empty repository or within an existing repository, it will create a new directory containing the scaffolded files. ```bash -npx @docusaurus/init@latest init [name] [template] +npm init docusaurus@latest [name] [template] ``` Example: ```bash -npx @docusaurus/init@latest init my-website classic +npm init docusaurus@latest website classic ``` -If you do not specify `name` or `template`, it will prompt you for them. We recommend the `classic` template so that you can get started quickly and it contains features found in Docusaurus 1. The `classic` template contains `@docusaurus/preset-classic` which includes standard documentation, a blog, custom pages, and a CSS framework (with dark mode support). You can get up and running extremely quickly with the classic template and customize things later on when you have gained more familiarity with Docusaurus. +If you do not specify `name` or `template`, it will prompt you for them. We recommend the `classic` template so that you can get started quickly, and it contains features found in Docusaurus 1. The `classic` template contains `@docusaurus/preset-classic` which includes standard documentation, a blog, custom pages, and a CSS framework (with dark mode support). You can get up and running extremely quickly with the classic template and customize things later on when you have gained more familiarity with Docusaurus. **[FB-Only]:** If you are setting up a new Docusaurus website for a Facebook open source project, use the `facebook` template instead, which comes with some useful Facebook-specific defaults: ```bash -npx @docusaurus/init@latest init my-website facebook +npm init docusaurus@latest my-website facebook ``` If you want to skip installing dependencies, use the `--skip-install` option, like the following: ```bash -npx @docusaurus/init@latest init my-website classic --skip-install +npm init docusaurus@latest my-website classic --skip-install ``` You can also use the template's TypeScript variant by passing the `--typescript` flag. ```bash -npx @docusaurus/init@latest init my-website classic --typescript +npm init docusaurus@latest my-website classic --typescript ``` ## Project structure {#project-structure} diff --git a/website/docs/introduction.md b/website/docs/introduction.md index f3daf7c3467d..cf2783fee44a 100644 --- a/website/docs/introduction.md +++ b/website/docs/introduction.md @@ -26,7 +26,7 @@ Create a new Docusaurus site and follow the **very short** embedded tutorial. Install [Node.js](https://nodejs.org/en/download/) and create a new Docusaurus site: ```bash -npx @docusaurus/init@latest init my-website classic +npm init docusaurus@latest my-website classic ``` Start the site: diff --git a/website/docs/migration/migration-manual.md b/website/docs/migration/migration-manual.md index e915c815e64e..a20d3622fbb3 100644 --- a/website/docs/migration/migration-manual.md +++ b/website/docs/migration/migration-manual.md @@ -122,7 +122,7 @@ yarn-error.log* ### `README` {#readme} -The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-init/templates/classic/README.md). +The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/main/packages/create-docusaurus/templates/classic/README.md). ## Site configurations {#site-configurations} diff --git a/website/docs/typescript-support.md b/website/docs/typescript-support.md index 407ac48aa13a..6dbcdd0bba5a 100644 --- a/website/docs/typescript-support.md +++ b/website/docs/typescript-support.md @@ -10,7 +10,7 @@ Docusaurus is written in TypeScript, and provides first-class TypeScript support Docusaurus supports writing and using TypeScript theme components. If the init template provides a Typescript variant, you can directly initialize a site with full TypeScript support by using the `--typescript` flag. ```bash -npx @docusaurus/init@latest init my-website classic --typescript +npm init docusaurus@latest my-website classic --typescript ``` Below are some guides on how to migrate an existing project to TypeScript. diff --git a/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-crowdin.mdx b/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-crowdin.mdx index 98cccdf274a9..ef038d068cf3 100644 --- a/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-crowdin.mdx +++ b/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-crowdin.mdx @@ -51,7 +51,7 @@ The end result can be seen at [docusaurus-crowdin-example.netlify.app](https://d Initialize a new Docusaurus site: ```bash -npx @docusaurus/init@latest init website classic +npm init docusaurus@latest website classic ``` Add the site configuration for the French language: diff --git a/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-git.md b/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-git.md index 95b95d538aff..5a595909f5fc 100644 --- a/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-git.md +++ b/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-git.md @@ -39,7 +39,7 @@ This is a walk-through of using Git to translate a newly initialized English Doc Initialize a new Docusaurus site: ```bash -npx @docusaurus/init@latest init website classic +npm init docusaurus@latest website classic ``` Add the site configuration for the French language: diff --git a/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-tutorial.md b/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-tutorial.md index 61149335e8b6..aae7d0580696 100644 --- a/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-tutorial.md +++ b/website/versioned_docs/version-2.0.0-beta.5/i18n/i18n-tutorial.md @@ -8,7 +8,7 @@ This tutorial will walk you through the basis of the **Docusaurus i18n system**. We will add **French** translations to a **newly initialized English Docusaurus website**. -Initialize a new site with `npx @docusaurus/init@latest init website classic` (like [this one](https://github.com/facebook/docusaurus/tree/main/examples/classic)). +Initialize a new site with `npm init docusaurus@latest website classic` (like [this one](https://github.com/facebook/docusaurus/tree/main/examples/classic)). ## Configure your site {#configure-your-site} diff --git a/website/versioned_docs/version-2.0.0-beta.5/installation.md b/website/versioned_docs/version-2.0.0-beta.5/installation.md index c632bc83e62d..9deaa6dabbfd 100644 --- a/website/versioned_docs/version-2.0.0-beta.5/installation.md +++ b/website/versioned_docs/version-2.0.0-beta.5/installation.md @@ -23,13 +23,13 @@ Use **[docusaurus.new](https://docusaurus.new)** to test Docusaurus immediately The easiest way to install Docusaurus is to use the command line tool that helps you scaffold a skeleton Docusaurus website. You can run this command anywhere in a new empty repository or within an existing repository, it will create a new directory containing the scaffolded files. ```bash -npx @docusaurus/init@latest init [name] [template] +npm init docusaurus@latest [name] [template] ``` Example: ```bash -npx @docusaurus/init@latest init my-website classic +npm init docusaurus@latest my-website classic ``` If you do not specify `name` or `template`, it will prompt you for them. We recommend the `classic` template so that you can get started quickly and it contains features found in Docusaurus 1. The `classic` template contains `@docusaurus/preset-classic` which includes standard documentation, a blog, custom pages, and a CSS framework (with dark mode support). You can get up and running extremely quickly with the classic template and customize things later on when you have gained more familiarity with Docusaurus. @@ -37,25 +37,25 @@ If you do not specify `name` or `template`, it will prompt you for them. We reco **[FB-Only]:** If you are setting up a new Docusaurus website for a Facebook open source project, use the `facebook` template instead, which comes with some useful Facebook-specific defaults: ```bash -npx @docusaurus/init@latest init my-website facebook +npm init docusaurus@latest my-website facebook ``` **[Experimental]:** If you want setting up a new website using [bootstrap](https://getbootstrap.com/), use the `bootstrap` template, like the following: ```bash -npx @docusaurus/init@latest init my-website bootstrap +npm init docusaurus@latest my-website bootstrap ``` If you want to skip installing dependencies, use the `--skip-install` option, like the following: ```bash -npx @docusaurus/init@latest init my-website classic --skip-install +npm init docusaurus@latest my-website classic --skip-install ``` You can also use the template's TypeScript variant by passing the `--typescript` flag. ```bash -npx @docusaurus/init@latest init my-website classic --typescript +npm init docusaurus@latest my-website classic --typescript ``` ## Project structure {#project-structure} diff --git a/website/versioned_docs/version-2.0.0-beta.5/introduction.md b/website/versioned_docs/version-2.0.0-beta.5/introduction.md index 0ecbefd7d198..97601dff31be 100644 --- a/website/versioned_docs/version-2.0.0-beta.5/introduction.md +++ b/website/versioned_docs/version-2.0.0-beta.5/introduction.md @@ -26,7 +26,7 @@ Create a new Docusaurus site and follow the **very short** embedded tutorial. Install [Node.js](https://nodejs.org/en/download/) and create a new Docusaurus site: ```bash -npx @docusaurus/init@latest init my-website classic +npm init docusaurus@latest my-website classic ``` Start the site: diff --git a/website/versioned_docs/version-2.0.0-beta.5/migration/migration-manual.md b/website/versioned_docs/version-2.0.0-beta.5/migration/migration-manual.md index e915c815e64e..a20d3622fbb3 100644 --- a/website/versioned_docs/version-2.0.0-beta.5/migration/migration-manual.md +++ b/website/versioned_docs/version-2.0.0-beta.5/migration/migration-manual.md @@ -122,7 +122,7 @@ yarn-error.log* ### `README` {#readme} -The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-init/templates/classic/README.md). +The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/main/packages/create-docusaurus/templates/classic/README.md). ## Site configurations {#site-configurations} diff --git a/website/versioned_docs/version-2.0.0-beta.5/typescript-support.md b/website/versioned_docs/version-2.0.0-beta.5/typescript-support.md index ec803ffa195c..9853082a4829 100644 --- a/website/versioned_docs/version-2.0.0-beta.5/typescript-support.md +++ b/website/versioned_docs/version-2.0.0-beta.5/typescript-support.md @@ -10,7 +10,7 @@ Docusaurus is written in TypeScript, and provide first-class TypeScript support. Docusaurus supports writing and using TypeScript theme components. If the init template provides a Typescript variant, you can directly initialize a site with full TypeScript support by using the `--typescript` flag. ```bash -npx @docusaurus/init@latest init my-website classic --typescript +npm init docusaurus@latest my-website classic --typescript ``` Below are some guides on how to migrate an existing project to TypeScript. diff --git a/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-crowdin.mdx b/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-crowdin.mdx index 98cccdf274a9..ef038d068cf3 100644 --- a/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-crowdin.mdx +++ b/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-crowdin.mdx @@ -51,7 +51,7 @@ The end result can be seen at [docusaurus-crowdin-example.netlify.app](https://d Initialize a new Docusaurus site: ```bash -npx @docusaurus/init@latest init website classic +npm init docusaurus@latest website classic ``` Add the site configuration for the French language: diff --git a/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-git.md b/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-git.md index 95b95d538aff..5a595909f5fc 100644 --- a/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-git.md +++ b/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-git.md @@ -39,7 +39,7 @@ This is a walk-through of using Git to translate a newly initialized English Doc Initialize a new Docusaurus site: ```bash -npx @docusaurus/init@latest init website classic +npm init docusaurus@latest website classic ``` Add the site configuration for the French language: diff --git a/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-tutorial.md b/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-tutorial.md index 61149335e8b6..aae7d0580696 100644 --- a/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-tutorial.md +++ b/website/versioned_docs/version-2.0.0-beta.6/i18n/i18n-tutorial.md @@ -8,7 +8,7 @@ This tutorial will walk you through the basis of the **Docusaurus i18n system**. We will add **French** translations to a **newly initialized English Docusaurus website**. -Initialize a new site with `npx @docusaurus/init@latest init website classic` (like [this one](https://github.com/facebook/docusaurus/tree/main/examples/classic)). +Initialize a new site with `npm init docusaurus@latest website classic` (like [this one](https://github.com/facebook/docusaurus/tree/main/examples/classic)). ## Configure your site {#configure-your-site} diff --git a/website/versioned_docs/version-2.0.0-beta.6/installation.md b/website/versioned_docs/version-2.0.0-beta.6/installation.md index c632bc83e62d..9deaa6dabbfd 100644 --- a/website/versioned_docs/version-2.0.0-beta.6/installation.md +++ b/website/versioned_docs/version-2.0.0-beta.6/installation.md @@ -23,13 +23,13 @@ Use **[docusaurus.new](https://docusaurus.new)** to test Docusaurus immediately The easiest way to install Docusaurus is to use the command line tool that helps you scaffold a skeleton Docusaurus website. You can run this command anywhere in a new empty repository or within an existing repository, it will create a new directory containing the scaffolded files. ```bash -npx @docusaurus/init@latest init [name] [template] +npm init docusaurus@latest [name] [template] ``` Example: ```bash -npx @docusaurus/init@latest init my-website classic +npm init docusaurus@latest my-website classic ``` If you do not specify `name` or `template`, it will prompt you for them. We recommend the `classic` template so that you can get started quickly and it contains features found in Docusaurus 1. The `classic` template contains `@docusaurus/preset-classic` which includes standard documentation, a blog, custom pages, and a CSS framework (with dark mode support). You can get up and running extremely quickly with the classic template and customize things later on when you have gained more familiarity with Docusaurus. @@ -37,25 +37,25 @@ If you do not specify `name` or `template`, it will prompt you for them. We reco **[FB-Only]:** If you are setting up a new Docusaurus website for a Facebook open source project, use the `facebook` template instead, which comes with some useful Facebook-specific defaults: ```bash -npx @docusaurus/init@latest init my-website facebook +npm init docusaurus@latest my-website facebook ``` **[Experimental]:** If you want setting up a new website using [bootstrap](https://getbootstrap.com/), use the `bootstrap` template, like the following: ```bash -npx @docusaurus/init@latest init my-website bootstrap +npm init docusaurus@latest my-website bootstrap ``` If you want to skip installing dependencies, use the `--skip-install` option, like the following: ```bash -npx @docusaurus/init@latest init my-website classic --skip-install +npm init docusaurus@latest my-website classic --skip-install ``` You can also use the template's TypeScript variant by passing the `--typescript` flag. ```bash -npx @docusaurus/init@latest init my-website classic --typescript +npm init docusaurus@latest my-website classic --typescript ``` ## Project structure {#project-structure} diff --git a/website/versioned_docs/version-2.0.0-beta.6/introduction.md b/website/versioned_docs/version-2.0.0-beta.6/introduction.md index 0ecbefd7d198..97601dff31be 100644 --- a/website/versioned_docs/version-2.0.0-beta.6/introduction.md +++ b/website/versioned_docs/version-2.0.0-beta.6/introduction.md @@ -26,7 +26,7 @@ Create a new Docusaurus site and follow the **very short** embedded tutorial. Install [Node.js](https://nodejs.org/en/download/) and create a new Docusaurus site: ```bash -npx @docusaurus/init@latest init my-website classic +npm init docusaurus@latest my-website classic ``` Start the site: diff --git a/website/versioned_docs/version-2.0.0-beta.6/migration/migration-manual.md b/website/versioned_docs/version-2.0.0-beta.6/migration/migration-manual.md index e915c815e64e..a20d3622fbb3 100644 --- a/website/versioned_docs/version-2.0.0-beta.6/migration/migration-manual.md +++ b/website/versioned_docs/version-2.0.0-beta.6/migration/migration-manual.md @@ -122,7 +122,7 @@ yarn-error.log* ### `README` {#readme} -The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-init/templates/classic/README.md). +The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/main/packages/create-docusaurus/templates/classic/README.md). ## Site configurations {#site-configurations} diff --git a/website/versioned_docs/version-2.0.0-beta.6/typescript-support.md b/website/versioned_docs/version-2.0.0-beta.6/typescript-support.md index 7f53560679d5..8b1cff8fefcc 100644 --- a/website/versioned_docs/version-2.0.0-beta.6/typescript-support.md +++ b/website/versioned_docs/version-2.0.0-beta.6/typescript-support.md @@ -10,7 +10,7 @@ Docusaurus is written in TypeScript, and provide first-class TypeScript support. Docusaurus supports writing and using TypeScript theme components. If the init template provides a Typescript variant, you can directly initialize a site with full TypeScript support by using the `--typescript` flag. ```bash -npx @docusaurus/init@latest init my-website classic --typescript +npm init docusaurus@latest my-website classic --typescript ``` Below are some guides on how to migrate an existing project to TypeScript.