create-docusaurus 2.0.0-beta.17 → 2.0.0-beta.18
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 +13 -14
- package/lib/index.js +6 -6
- package/package.json +5 -5
- package/templates/classic/package.json +6 -6
- package/templates/classic-typescript/package.json +9 -9
- package/templates/facebook/package.json +13 -13
- package/templates/shared/docs/tutorial-basics/create-a-document.md +3 -3
package/bin/index.js
CHANGED
|
@@ -13,7 +13,6 @@ import semver from 'semver';
|
|
|
13
13
|
import path from 'path';
|
|
14
14
|
import {program} from 'commander';
|
|
15
15
|
import {createRequire} from 'module';
|
|
16
|
-
import init from '../lib/index.js';
|
|
17
16
|
|
|
18
17
|
const packageJson = createRequire(import.meta.url)('../package.json');
|
|
19
18
|
const requiredVersion = packageJson.engines.node;
|
|
@@ -24,14 +23,6 @@ if (!semver.satisfies(process.version, requiredVersion)) {
|
|
|
24
23
|
process.exit(1);
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
function wrapCommand(fn) {
|
|
28
|
-
return (...args) =>
|
|
29
|
-
fn(...args).catch((err) => {
|
|
30
|
-
logger.error(err.stack);
|
|
31
|
-
process.exitCode = 1;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
26
|
program.version(packageJson.version);
|
|
36
27
|
|
|
37
28
|
program
|
|
@@ -61,11 +52,14 @@ program
|
|
|
61
52
|
rootDir = '.',
|
|
62
53
|
{packageManager, skipInstall, typescript, gitStrategy} = {},
|
|
63
54
|
) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
// See https://github.com/facebook/docusaurus/pull/6860
|
|
56
|
+
import('../lib/index.js').then(({default: init}) => {
|
|
57
|
+
init(path.resolve(rootDir), siteName, template, {
|
|
58
|
+
packageManager,
|
|
59
|
+
skipInstall,
|
|
60
|
+
typescript,
|
|
61
|
+
gitStrategy,
|
|
62
|
+
});
|
|
69
63
|
});
|
|
70
64
|
},
|
|
71
65
|
);
|
|
@@ -75,3 +69,8 @@ program.parse(process.argv);
|
|
|
75
69
|
if (!process.argv.slice(1).length) {
|
|
76
70
|
program.outputHelp();
|
|
77
71
|
}
|
|
72
|
+
|
|
73
|
+
process.on('unhandledRejection', (err) => {
|
|
74
|
+
logger.error(err);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
});
|
package/lib/index.js
CHANGED
|
@@ -25,7 +25,7 @@ const SupportedPackageManagers = {
|
|
|
25
25
|
const PackageManagersList = Object.keys(SupportedPackageManagers);
|
|
26
26
|
async function findPackageManagerFromLockFile() {
|
|
27
27
|
for (const packageManager of PackageManagersList) {
|
|
28
|
-
const lockFilePath = path.resolve(
|
|
28
|
+
const lockFilePath = path.resolve(SupportedPackageManagers[packageManager]);
|
|
29
29
|
if (await fs.pathExists(lockFilePath)) {
|
|
30
30
|
return packageManager;
|
|
31
31
|
}
|
|
@@ -97,7 +97,7 @@ function getTypeScriptBaseTemplate(template) {
|
|
|
97
97
|
return undefined;
|
|
98
98
|
}
|
|
99
99
|
async function copyTemplate(templatesDir, template, dest) {
|
|
100
|
-
await fs.copy(path.
|
|
100
|
+
await fs.copy(path.join(templatesDir, 'shared'), dest);
|
|
101
101
|
// TypeScript variants will copy duplicate resources like CSS & config from
|
|
102
102
|
// base template
|
|
103
103
|
const tsBaseTemplate = getTypeScriptBaseTemplate(template);
|
|
@@ -137,7 +137,7 @@ async function getGitCommand(gitStrategy) {
|
|
|
137
137
|
export default async function init(rootDir, siteName, reqTemplate, cliOptions = {}) {
|
|
138
138
|
const templatesDir = fileURLToPath(new URL('../templates', import.meta.url));
|
|
139
139
|
const templates = await readTemplates(templatesDir);
|
|
140
|
-
const hasTS = (templateName) => fs.pathExists(path.
|
|
140
|
+
const hasTS = (templateName) => fs.pathExists(path.join(templatesDir, `${templateName}${TypeScriptTemplateSuffix}`));
|
|
141
141
|
let name = siteName;
|
|
142
142
|
// Prompt if siteName is not passed from CLI.
|
|
143
143
|
if (!name) {
|
|
@@ -216,7 +216,7 @@ export default async function init(rootDir, siteName, reqTemplate, cliOptions =
|
|
|
216
216
|
name: 'templateDir',
|
|
217
217
|
validate: async (dir) => {
|
|
218
218
|
if (dir) {
|
|
219
|
-
const fullDir = path.resolve(
|
|
219
|
+
const fullDir = path.resolve(dir);
|
|
220
220
|
if (await fs.pathExists(fullDir)) {
|
|
221
221
|
return true;
|
|
222
222
|
}
|
|
@@ -265,8 +265,8 @@ export default async function init(rootDir, siteName, reqTemplate, cliOptions =
|
|
|
265
265
|
throw err;
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
else if (await fs.pathExists(path.resolve(
|
|
269
|
-
const templateDir = path.resolve(
|
|
268
|
+
else if (await fs.pathExists(path.resolve(template))) {
|
|
269
|
+
const templateDir = path.resolve(template);
|
|
270
270
|
try {
|
|
271
271
|
await fs.copy(templateDir, dest);
|
|
272
272
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-docusaurus",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.18",
|
|
4
4
|
"description": "Create Docusaurus apps easily.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"create-docusaurus": "create-docusaurus",
|
|
16
|
-
"build": "tsc",
|
|
17
|
-
"watch": "tsc --watch"
|
|
16
|
+
"build": "tsc -p tsconfig.build.json",
|
|
17
|
+
"watch": "tsc -p tsconfig.build.json --watch"
|
|
18
18
|
},
|
|
19
19
|
"bin": "bin/index.js",
|
|
20
20
|
"publishConfig": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@docusaurus/logger": "2.0.0-beta.
|
|
25
|
+
"@docusaurus/logger": "2.0.0-beta.18",
|
|
26
26
|
"commander": "^5.1.0",
|
|
27
27
|
"fs-extra": "^10.0.1",
|
|
28
28
|
"lodash": "^4.17.21",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=14"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "1a945d06993d53376e61bed2c942799fe07dc336"
|
|
42
42
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-2-classic-template",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.18",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"docusaurus": "docusaurus",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"write-heading-ids": "docusaurus write-heading-ids"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@docusaurus/core": "2.0.0-beta.
|
|
18
|
-
"@docusaurus/preset-classic": "2.0.0-beta.
|
|
17
|
+
"@docusaurus/core": "2.0.0-beta.18",
|
|
18
|
+
"@docusaurus/preset-classic": "2.0.0-beta.18",
|
|
19
19
|
"@mdx-js/react": "^1.6.22",
|
|
20
20
|
"clsx": "^1.1.1",
|
|
21
|
-
"prism-react-renderer": "^1.
|
|
22
|
-
"react": "^17.0.
|
|
23
|
-
"react-dom": "^17.0.
|
|
21
|
+
"prism-react-renderer": "^1.3.1",
|
|
22
|
+
"react": "^17.0.2",
|
|
23
|
+
"react-dom": "^17.0.2"
|
|
24
24
|
},
|
|
25
25
|
"browserslist": {
|
|
26
26
|
"production": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-2-classic-typescript-template",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.18",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"docusaurus": "docusaurus",
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
"typecheck": "tsc"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@docusaurus/core": "2.0.0-beta.
|
|
19
|
-
"@docusaurus/preset-classic": "2.0.0-beta.
|
|
18
|
+
"@docusaurus/core": "2.0.0-beta.18",
|
|
19
|
+
"@docusaurus/preset-classic": "2.0.0-beta.18",
|
|
20
20
|
"@mdx-js/react": "^1.6.22",
|
|
21
21
|
"clsx": "^1.1.1",
|
|
22
|
-
"prism-react-renderer": "^1.
|
|
23
|
-
"react": "^17.0.
|
|
24
|
-
"react-dom": "^17.0.
|
|
22
|
+
"prism-react-renderer": "^1.3.1",
|
|
23
|
+
"react": "^17.0.2",
|
|
24
|
+
"react-dom": "^17.0.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@docusaurus/module-type-aliases": "2.0.0-beta.
|
|
28
|
-
"@tsconfig/docusaurus": "^1.0.
|
|
29
|
-
"typescript": "^4.6.
|
|
27
|
+
"@docusaurus/module-type-aliases": "2.0.0-beta.18",
|
|
28
|
+
"@tsconfig/docusaurus": "^1.0.5",
|
|
29
|
+
"typescript": "^4.6.3"
|
|
30
30
|
},
|
|
31
31
|
"browserslist": {
|
|
32
32
|
"production": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-2-facebook-template",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.18",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"docusaurus": "docusaurus",
|
|
@@ -18,25 +18,25 @@
|
|
|
18
18
|
"format:diff": "prettier --config .prettierrc --list-different \"**/*.{js,jsx,ts,tsx,md,mdx}\""
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "2.0.0-beta.
|
|
22
|
-
"@docusaurus/preset-classic": "2.0.0-beta.
|
|
21
|
+
"@docusaurus/core": "2.0.0-beta.18",
|
|
22
|
+
"@docusaurus/preset-classic": "2.0.0-beta.18",
|
|
23
23
|
"@mdx-js/react": "^1.6.22",
|
|
24
24
|
"clsx": "^1.1.1",
|
|
25
|
-
"react": "^17.0.
|
|
26
|
-
"react-dom": "^17.0.
|
|
25
|
+
"react": "^17.0.2",
|
|
26
|
+
"react-dom": "^17.0.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@babel/eslint-parser": "^7.
|
|
30
|
-
"eslint": "^8.
|
|
31
|
-
"eslint-config-airbnb": "^19.0.
|
|
32
|
-
"eslint-config-prettier": "^8.
|
|
29
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
30
|
+
"eslint": "^8.11.0",
|
|
31
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
32
|
+
"eslint-config-prettier": "^8.5.0",
|
|
33
33
|
"eslint-plugin-header": "^3.1.1",
|
|
34
|
-
"eslint-plugin-import": "^2.25.
|
|
34
|
+
"eslint-plugin-import": "^2.25.4",
|
|
35
35
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
36
|
-
"eslint-plugin-react": "^7.29.
|
|
36
|
+
"eslint-plugin-react": "^7.29.4",
|
|
37
37
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
38
|
-
"prettier": "^2.
|
|
39
|
-
"stylelint": "^14.
|
|
38
|
+
"prettier": "^2.6.0",
|
|
39
|
+
"stylelint": "^14.6.0"
|
|
40
40
|
},
|
|
41
41
|
"browserslist": {
|
|
42
42
|
"production": [
|
|
@@ -41,14 +41,14 @@ This is my **first Docusaurus document**!
|
|
|
41
41
|
|
|
42
42
|
It is also possible to create your sidebar explicitly in `sidebars.js`:
|
|
43
43
|
|
|
44
|
-
```
|
|
44
|
+
```js title="sidebars.js"
|
|
45
45
|
module.exports = {
|
|
46
46
|
tutorialSidebar: [
|
|
47
47
|
{
|
|
48
48
|
type: 'category',
|
|
49
49
|
label: 'Tutorial',
|
|
50
|
-
-
|
|
51
|
-
|
|
50
|
+
// highlight-next-line
|
|
51
|
+
items: ['hello'],
|
|
52
52
|
},
|
|
53
53
|
],
|
|
54
54
|
};
|