create-docusaurus 2.0.0-beta.7 → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +43 -41
- package/lib/index.d.ts +16 -5
- package/lib/index.js +348 -156
- package/package.json +18 -18
- package/templates/classic/docusaurus.config.js +17 -3
- package/templates/classic/package.json +14 -11
- package/templates/classic/src/components/{HomepageFeatures.js → HomepageFeatures/index.js} +5 -5
- package/templates/classic/src/components/{HomepageFeatures.module.css → HomepageFeatures/styles.module.css} +0 -0
- package/templates/classic/src/css/custom.css +18 -16
- package/templates/classic/src/pages/index.js +3 -2
- package/templates/classic/src/pages/index.module.css +1 -1
- package/templates/classic-typescript/package.json +14 -14
- package/templates/classic-typescript/src/components/{HomepageFeatures.tsx → HomepageFeatures/index.tsx} +7 -13
- package/templates/classic-typescript/src/pages/index.tsx +3 -2
- package/templates/facebook/.eslintrc.js +10 -4
- package/templates/facebook/.prettierrc +1 -1
- package/templates/facebook/.stylelintrc.js +1 -1
- package/templates/facebook/README.md +9 -1
- package/templates/facebook/babel.config.js +1 -1
- package/templates/facebook/docusaurus.config.js +22 -14
- package/templates/facebook/package.json +24 -24
- package/templates/facebook/sidebars.js +1 -1
- package/templates/facebook/src/css/custom.css +17 -13
- package/templates/facebook/src/pages/index.js +1 -1
- package/templates/facebook/src/pages/styles.module.css +2 -2
- package/templates/facebook/static/img/meta_opensource_logo.svg +1 -0
- package/templates/facebook/static/img/meta_opensource_logo_negative.svg +1 -0
- package/templates/shared/README.md +9 -1
- package/templates/shared/docs/intro.md +19 -7
- package/templates/shared/docs/tutorial-basics/_category_.json +5 -1
- package/templates/shared/docs/tutorial-basics/create-a-blog-post.md +1 -1
- package/templates/shared/docs/tutorial-basics/create-a-document.md +6 -6
- package/templates/shared/docs/tutorial-basics/create-a-page.md +5 -5
- package/templates/shared/docs/tutorial-basics/deploy-your-site.md +1 -1
- package/templates/shared/docs/tutorial-basics/markdown-features.mdx +3 -1
- package/templates/shared/docs/tutorial-extras/_category_.json +4 -1
- package/templates/shared/docs/tutorial-extras/img/docsVersionDropdown.png +0 -0
- package/templates/shared/docs/tutorial-extras/img/localeDropdown.png +0 -0
- package/templates/shared/docs/tutorial-extras/manage-docs-versions.md +1 -1
- package/templates/shared/docs/tutorial-extras/translate-your-site.md +2 -2
- package/templates/shared/static/img/undraw_docusaurus_mountain.svg +1 -0
- package/templates/shared/static/img/undraw_docusaurus_react.svg +1 -0
- package/templates/shared/static/img/undraw_docusaurus_tree.svg +40 -1
- package/lib/.tsbuildinfo +0 -1
- package/src/index.ts +0 -289
- package/templates/facebook/static/img/oss_logo.png +0 -0
- package/templates/shared/static/img/tutorial/docsVersionDropdown.png +0 -0
- package/templates/shared/static/img/tutorial/localeDropdown.png +0 -0
- package/tsconfig.json +0 -11
package/bin/index.js
CHANGED
|
@@ -6,59 +6,61 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
// @ts-check
|
|
10
|
+
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import {createRequire} from 'module';
|
|
13
|
+
import logger from '@docusaurus/logger';
|
|
14
|
+
import semver from 'semver';
|
|
15
|
+
import {program} from 'commander';
|
|
16
|
+
|
|
17
|
+
const packageJson = /** @type {import("../package.json")} */ (
|
|
18
|
+
createRequire(import.meta.url)('../package.json')
|
|
19
|
+
);
|
|
20
|
+
const requiredVersion = packageJson.engines.node;
|
|
15
21
|
|
|
16
22
|
if (!semver.satisfies(process.version, requiredVersion)) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
chalk.yellow(
|
|
20
|
-
`\nYou are using Node.js ${process.version}, Requirement: Node.js ${requiredVersion}.\n`,
|
|
21
|
-
),
|
|
22
|
-
);
|
|
23
|
+
logger.error('Minimum Node.js version not met :(');
|
|
24
|
+
logger.info`You are using Node.js number=${process.version}, Requirement: Node.js number=${requiredVersion}.`;
|
|
23
25
|
process.exit(1);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
return (...args) =>
|
|
28
|
-
fn(...args).catch((err) => {
|
|
29
|
-
console.error(chalk.red(err.stack));
|
|
30
|
-
process.exitCode = 1;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
program
|
|
35
|
-
.version(require('../package.json').version)
|
|
36
|
-
.usage('<command> [options]');
|
|
28
|
+
program.version(packageJson.version);
|
|
37
29
|
|
|
38
30
|
program
|
|
39
|
-
.
|
|
40
|
-
.option(
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
.arguments('[siteName] [template] [rootDir]')
|
|
32
|
+
.option(
|
|
33
|
+
'-p, --package-manager <manager>',
|
|
34
|
+
'The package manager used to install dependencies. One of yarn, npm, and pnpm.',
|
|
35
|
+
)
|
|
36
|
+
.option(
|
|
37
|
+
'-s, --skip-install',
|
|
38
|
+
'Do not run package manager immediately after scaffolding',
|
|
39
|
+
)
|
|
40
|
+
.option('-t, --typescript', 'Use the TypeScript template variant')
|
|
41
|
+
.option(
|
|
42
|
+
'-g, --git-strategy <strategy>',
|
|
43
|
+
`Only used if the template is a git repository.
|
|
44
|
+
\`deep\`: preserve full history
|
|
45
|
+
\`shallow\`: clone with --depth=1
|
|
46
|
+
\`copy\`: do a shallow clone, but do not create a git repo
|
|
47
|
+
\`custom\`: enter your custom git clone command. We will prompt you for it.`,
|
|
48
|
+
)
|
|
43
49
|
.description('Initialize website.')
|
|
44
|
-
.action(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
typescript,
|
|
50
|
-
});
|
|
51
|
-
},
|
|
50
|
+
.action((siteName, template, rootDir, options) =>
|
|
51
|
+
// See https://github.com/facebook/docusaurus/pull/6860
|
|
52
|
+
import('../lib/index.js').then(({default: init}) =>
|
|
53
|
+
init(path.resolve(rootDir ?? '.'), siteName, template, options),
|
|
54
|
+
),
|
|
52
55
|
);
|
|
53
56
|
|
|
54
|
-
program.arguments('<command>').action((cmd) => {
|
|
55
|
-
program.outputHelp();
|
|
56
|
-
console.log(` ${chalk.red(`\n Unknown command ${chalk.yellow(cmd)}.`)}`);
|
|
57
|
-
console.log();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
57
|
program.parse(process.argv);
|
|
61
58
|
|
|
62
59
|
if (!process.argv.slice(1).length) {
|
|
63
60
|
program.outputHelp();
|
|
64
61
|
}
|
|
62
|
+
|
|
63
|
+
process.on('unhandledRejection', (err) => {
|
|
64
|
+
logger.error(err);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
});
|
package/lib/index.d.ts
CHANGED
|
@@ -4,8 +4,19 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
skipInstall
|
|
10
|
-
typescript
|
|
11
|
-
|
|
7
|
+
declare type CLIOptions = {
|
|
8
|
+
packageManager?: PackageManager;
|
|
9
|
+
skipInstall?: boolean;
|
|
10
|
+
typescript?: boolean;
|
|
11
|
+
gitStrategy?: GitStrategy;
|
|
12
|
+
};
|
|
13
|
+
declare const lockfileNames: {
|
|
14
|
+
npm: string;
|
|
15
|
+
yarn: string;
|
|
16
|
+
pnpm: string;
|
|
17
|
+
};
|
|
18
|
+
declare type PackageManager = keyof typeof lockfileNames;
|
|
19
|
+
declare const gitStrategies: readonly ["deep", "shallow", "copy", "custom"];
|
|
20
|
+
declare type GitStrategy = typeof gitStrategies[number];
|
|
21
|
+
export default function init(rootDir: string, reqName?: string, reqTemplate?: string, cliOptions?: CLIOptions): Promise<void>;
|
|
22
|
+
export {};
|