Skip to content

Commit

Permalink
@docusaurus/init renamed to create-docusaurus
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Oct 1, 2021
1 parent 248b9fd commit 1c68910
Show file tree
Hide file tree
Showing 103 changed files with 85 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ packages/docusaurus-*/lib/*
packages/docusaurus-*/lib-next/
packages/docusaurus-plugin-ideal-image/copyUntypedFiles.js

packages/docusaurus-init/templates/facebook/.eslintrc.js
packages/create-docusaurus/templates/facebook/.eslintrc.js
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,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,
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/v2-build-size-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/v2-build-time-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
- main
paths-ignore:
- 'website/docs/**'
- 'website-1.x/**'
- 'packages/docusaurus-1.x/**'
- 'packages/docusaurus-init-1.x/**'

jobs:
build:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/v2-lighthouse-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/v2-tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/v2-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/v2-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ coverage
packages/docusaurus/lib/
packages/docusaurus-*/lib/*
packages/docusaurus-*/lib-next/
packages/docusaurus-init/templates/*/docusaurus.config.js
packages/create-docusaurus/templates/*/docusaurus.config.js
__fixtures__

website/i18n
Expand Down
2 changes: 1 addition & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
packages/docusaurus-init/templates/
packages/create-docusaurus/templates/
examples
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion admin/local-third-party-project-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 3 additions & 5 deletions admin/publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,22 @@ 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"
}
</pre>
</details>

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"
```

Expand Down
4 changes: 2 additions & 2 deletions admin/scripts/test-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions generateExamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"packages/*",
"website",
"test-website-in-workspace",
"packages/docusaurus-init/templates/*",
"packages/create-docusaurus/templates/*",
"admin/new.docusaurus.io"
],
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
```
Expand All @@ -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
```
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ program
.usage('<command> [options]');

program
.command(' [siteName] [template] [rootDir]')
.command('init [siteName] [template] [rootDir]', {isDefault: true})
.option('--use-npm')
.option('--skip-install')
.option('--typescript')
Expand All @@ -59,6 +59,6 @@ program.arguments('<command>').action((cmd) => {

program.parse(process.argv);

if (!process.argv.slice(2).length) {
if (!process.argv.slice(1).length) {
program.outputHelp();
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"name": "@docusaurus/init",
"version": "2.0.0-beta.6",
"name": "create-docusaurus",
"version": "0.0.2",
"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"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export default function Home() {
return (
<Layout
title={`Hello from ${siteConfig.title}`}
description="Description will go into a meta tag in <head />">
description="Description will go into a meta tag in <head />"
>
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
Expand All @@ -80,7 +81,8 @@ export default function Home() {
'button button--outline button--secondary button--lg',
styles.getStarted,
)}
to={useBaseUrl('docs/')}>
to={useBaseUrl('docs/')}
>
Get Started
</Link>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion website/docs/i18n/i18n-crowdin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion website/docs/i18n/i18n-git.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion website/docs/i18n/i18n-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
16 changes: 8 additions & 8 deletions website/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,34 @@ 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]
```bash npm2yarn
npm init docusaurus@latest [name] [template]
```

Example:

```bash
npx @docusaurus/init@latest init my-website classic
```bash npm2yarn
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}
Expand Down

0 comments on commit 1c68910

Please sign in to comment.