@modern-js/plugin-docsite 1.2.1 → 1.2.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # @modern-js/plugin-docsite
2
2
 
3
+ ## 1.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 3e6d9f6d: convert to new plugin
8
+ - 681a1ff9: feat: remove unnecessary peerDependencies
9
+ - Updated dependencies [c2046f37]
10
+ - Updated dependencies [66cbef42]
11
+ - @modern-js/utils@1.3.6
12
+ - @modern-js/webpack@1.5.0
13
+
14
+ ## 1.2.3
15
+
16
+ ### Patch Changes
17
+
18
+ - 969f172f: fix port problem
19
+ - Updated dependencies [969f172f]
20
+ - Updated dependencies [0ad75faa]
21
+ - Updated dependencies [4c792f68]
22
+ - Updated dependencies [4b5d4bf4]
23
+ - Updated dependencies [0ad75faa]
24
+ - Updated dependencies [62f5b8c8]
25
+ - Updated dependencies [55e18278]
26
+ - Updated dependencies [4499a674]
27
+ - Updated dependencies [0ad75faa]
28
+ - Updated dependencies [403f5169]
29
+ - Updated dependencies [a7f42f48]
30
+ - @modern-js/core@1.4.4
31
+ - @modern-js/webpack@1.4.1
32
+ - @modern-js/utils@1.3.3
33
+
34
+ ## 1.2.2
35
+
36
+ ### Patch Changes
37
+
38
+ - 24f616ca: feat: support custom meta info
39
+ - Updated dependencies [d9cc5ea9]
40
+ - Updated dependencies [ddf0c3a6]
41
+ - Updated dependencies [bd819a8d]
42
+ - Updated dependencies [ec4dbffb]
43
+ - Updated dependencies [d099e5c5]
44
+ - Updated dependencies [bada2879]
45
+ - Updated dependencies [24f616ca]
46
+ - Updated dependencies [bd819a8d]
47
+ - @modern-js/core@1.4.0
48
+ - @modern-js/webpack@1.3.0
49
+ - @modern-js/utils@1.3.0
50
+
3
51
  ## 1.2.1
4
52
 
5
53
  ### Patch Changes
@@ -6,10 +6,12 @@ const taskMain = async ({
6
6
  appContext
7
7
  }) => {
8
8
  const {
9
- appDirectory
9
+ appDirectory,
10
+ internalDirectory
10
11
  } = appContext;
11
12
  await features.buildDocs({
12
- appDirectory
13
+ appDirectory,
14
+ internalDirectory
13
15
  });
14
16
  };
15
17
 
@@ -8,6 +8,7 @@ const glob = Import.lazy('glob', require);
8
8
  const DEFAULT_PORT = 5000;
9
9
  export async function buildDocs({
10
10
  appDirectory,
11
+ internalDirectory,
11
12
  isDev = false,
12
13
  port = DEFAULT_PORT
13
14
  }) {
@@ -34,7 +35,7 @@ export async function buildDocs({
34
35
  return;
35
36
  }
36
37
 
37
- const tmpDir = path.join(appDirectory, './node_modules/.modern-js/docs');
38
+ const tmpDir = path.join(internalDirectory, './docs');
38
39
  fs.ensureDirSync(tmpDir);
39
40
  const finalWebpackConfig = wp.generatorWebpackConfig(appDirectory, tmpDir, isDev);
40
41
 
@@ -1,49 +1,55 @@
1
1
  import { Import } from '@modern-js/utils';
2
- const core = Import.lazy('@modern-js/core', require);
3
2
  const features = Import.lazy('./features', require);
4
- export default core.createPlugin(() => ({
5
- commands({
6
- program
7
- }) {
8
- const {
9
- appDirectory
10
- } = core.useAppContext();
11
- const devCommand = program.commandsMap.get('dev');
3
+ export default (() => ({
4
+ name: '@modern-js/plugin-docsite',
5
+ setup: api => ({
6
+ commands({
7
+ program
8
+ }) {
9
+ const {
10
+ appDirectory,
11
+ internalDirectory
12
+ } = api.useAppContext();
13
+ const devCommand = program.commandsMap.get('dev');
12
14
 
13
- if (devCommand) {
14
- devCommand.command('docs').action(async () => {
15
- await features.buildDocs({
16
- appDirectory,
17
- isDev: true
15
+ if (devCommand) {
16
+ devCommand.command('docs').action(async () => {
17
+ await features.buildDocs({
18
+ appDirectory,
19
+ internalDirectory,
20
+ isDev: true
21
+ });
18
22
  });
19
- });
20
- }
21
- },
23
+ }
24
+ },
22
25
 
23
- // module-tools menu mode
24
- moduleToolsMenu() {
25
- const {
26
- appDirectory
27
- } = core.useAppContext();
28
- return {
29
- name: 'Docsite 调试',
30
- value: 'docsite',
31
- runTask: async () => features.buildDocs({
26
+ // module-tools menu mode
27
+ moduleToolsMenu() {
28
+ const {
32
29
  appDirectory,
33
- isDev: true
34
- })
35
- };
36
- },
30
+ internalDirectory,
31
+ port
32
+ } = api.useAppContext();
33
+ return {
34
+ name: 'Docsite 调试',
35
+ value: 'docsite',
36
+ runTask: async () => features.buildDocs({
37
+ appDirectory,
38
+ internalDirectory,
39
+ isDev: true,
40
+ port
41
+ })
42
+ };
43
+ },
37
44
 
38
- platformBuild() {
39
- return {
40
- name: 'docsite',
41
- title: 'Run Docsite log',
42
- taskPath: require.resolve("./build-task"),
43
- params: []
44
- };
45
- }
45
+ platformBuild() {
46
+ return {
47
+ name: 'docsite',
48
+ title: 'Run Docsite log',
49
+ taskPath: require.resolve("./build-task"),
50
+ params: []
51
+ };
52
+ }
46
53
 
47
- }), {
48
- name: '@modern-js/plugin-docsite'
49
- });
54
+ })
55
+ }));
@@ -10,10 +10,12 @@ const taskMain = async ({
10
10
  appContext
11
11
  }) => {
12
12
  const {
13
- appDirectory
13
+ appDirectory,
14
+ internalDirectory
14
15
  } = appContext;
15
16
  await features.buildDocs({
16
- appDirectory
17
+ appDirectory,
18
+ internalDirectory
17
19
  });
18
20
  };
19
21
 
@@ -25,6 +25,7 @@ const DEFAULT_PORT = 5000;
25
25
 
26
26
  async function buildDocs({
27
27
  appDirectory,
28
+ internalDirectory,
28
29
  isDev = false,
29
30
  port = DEFAULT_PORT
30
31
  }) {
@@ -52,7 +53,7 @@ async function buildDocs({
52
53
  return;
53
54
  }
54
55
 
55
- const tmpDir = _path.default.join(appDirectory, './node_modules/.modern-js/docs');
56
+ const tmpDir = _path.default.join(internalDirectory, './docs');
56
57
 
57
58
  _utils.fs.ensureDirSync(tmpDir);
58
59
 
@@ -7,55 +7,60 @@ exports.default = void 0;
7
7
 
8
8
  var _utils = require("@modern-js/utils");
9
9
 
10
- const core = _utils.Import.lazy('@modern-js/core', require);
11
-
12
10
  const features = _utils.Import.lazy('./features', require);
13
11
 
14
- var _default = core.createPlugin(() => ({
15
- commands({
16
- program
17
- }) {
18
- const {
19
- appDirectory
20
- } = core.useAppContext();
21
- const devCommand = program.commandsMap.get('dev');
22
-
23
- if (devCommand) {
24
- devCommand.command('docs').action(async () => {
25
- await features.buildDocs({
26
- appDirectory,
27
- isDev: true
12
+ var _default = () => ({
13
+ name: '@modern-js/plugin-docsite',
14
+ setup: api => ({
15
+ commands({
16
+ program
17
+ }) {
18
+ const {
19
+ appDirectory,
20
+ internalDirectory
21
+ } = api.useAppContext();
22
+ const devCommand = program.commandsMap.get('dev');
23
+
24
+ if (devCommand) {
25
+ devCommand.command('docs').action(async () => {
26
+ await features.buildDocs({
27
+ appDirectory,
28
+ internalDirectory,
29
+ isDev: true
30
+ });
28
31
  });
29
- });
30
- }
31
- },
32
-
33
- // module-tools menu mode
34
- moduleToolsMenu() {
35
- const {
36
- appDirectory
37
- } = core.useAppContext();
38
- return {
39
- name: 'Docsite 调试',
40
- value: 'docsite',
41
- runTask: async () => features.buildDocs({
32
+ }
33
+ },
34
+
35
+ // module-tools menu mode
36
+ moduleToolsMenu() {
37
+ const {
42
38
  appDirectory,
43
- isDev: true
44
- })
45
- };
46
- },
47
-
48
- platformBuild() {
49
- return {
50
- name: 'docsite',
51
- title: 'Run Docsite log',
52
- taskPath: require.resolve("./build-task"),
53
- params: []
54
- };
55
- }
56
-
57
- }), {
58
- name: '@modern-js/plugin-docsite'
39
+ internalDirectory,
40
+ port
41
+ } = api.useAppContext();
42
+ return {
43
+ name: 'Docsite 调试',
44
+ value: 'docsite',
45
+ runTask: async () => features.buildDocs({
46
+ appDirectory,
47
+ internalDirectory,
48
+ isDev: true,
49
+ port
50
+ })
51
+ };
52
+ },
53
+
54
+ platformBuild() {
55
+ return {
56
+ name: 'docsite',
57
+ title: 'Run Docsite log',
58
+ taskPath: require.resolve("./build-task"),
59
+ params: []
60
+ };
61
+ }
62
+
63
+ })
59
64
  });
60
65
 
61
66
  exports.default = _default;
@@ -1,12 +1,14 @@
1
1
  import type { Configuration } from 'webpack';
2
2
  interface IBuildDocsParams {
3
3
  appDirectory: string;
4
+ internalDirectory: string;
4
5
  webpackConfig?: Configuration;
5
6
  isDev?: boolean;
6
7
  port?: number;
7
8
  }
8
9
  export declare function buildDocs({
9
10
  appDirectory,
11
+ internalDirectory,
10
12
  isDev,
11
13
  port
12
14
  }: IBuildDocsParams): Promise<void>;
@@ -1,18 +1,5 @@
1
- declare const _default: import("@modern-js/core").AsyncPlugin<Partial<import("@modern-js/core").Progresses2Threads<{
2
- config: import("@modern-js/core").ParallelWorkflow<void, unknown>;
3
- resolvedConfig: import("@modern-js/core").AsyncWaterfall<{
4
- resolved: import("@modern-js/core").NormalizedConfig;
5
- }>;
6
- validateSchema: import("@modern-js/core").ParallelWorkflow<void, unknown>;
7
- prepare: import("@modern-js/core").AsyncWorkflow<void, void>;
8
- commands: import("@modern-js/core").AsyncWorkflow<{
9
- program: import("commander").Command;
10
- }, void>;
11
- watchFiles: import("@modern-js/core").ParallelWorkflow<void, unknown>;
12
- fileChange: import("@modern-js/core").AsyncWorkflow<{
13
- filename: string;
14
- }, void>;
15
- beforeExit: import("@modern-js/core").AsyncWorkflow<void, void>;
16
- } & import("@modern-js/core").ClearDraftProgress<import("@modern-js/core").Hooks>>>>;
1
+ import type { CliPlugin } from '@modern-js/core';
2
+
3
+ declare const _default: () => CliPlugin;
17
4
 
18
5
  export default _default;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.2.1",
14
+ "version": "1.2.4",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -37,8 +37,8 @@
37
37
  "@babel/runtime": "^7",
38
38
  "@mdx-js/mdx": "^1.6.22",
39
39
  "@mdx-js/react": "^1.6.22",
40
- "@modern-js/utils": "^1.2.2",
41
- "@modern-js/webpack": "^1.2.1",
40
+ "@modern-js/utils": "^1.3.6",
41
+ "@modern-js/webpack": "^1.5.0",
42
42
  "antd": "^4.16.13",
43
43
  "chokidar": "^3.5.2",
44
44
  "core-js": "^3.17.2",
@@ -62,7 +62,7 @@
62
62
  "webpack-dev-server": "^4.1.1"
63
63
  },
64
64
  "devDependencies": {
65
- "@modern-js/module-tools-hooks": "^1.2.1",
65
+ "@modern-js/module-tools-hooks": "^1.2.3",
66
66
  "@types/core-js": "^2.5.5",
67
67
  "@types/github-slugger": "^1.3.0",
68
68
  "@types/glob": "^7.1.4",
@@ -73,14 +73,11 @@
73
73
  "@types/react-dom": "^17",
74
74
  "@types/webpack-dev-server": "^4.1.0",
75
75
  "typescript": "^4",
76
- "@modern-js/core": "^1.3.2",
76
+ "@modern-js/core": "^1.6.0",
77
77
  "@scripts/build": "0.0.0",
78
78
  "jest": "^27",
79
79
  "@scripts/jest-config": "0.0.0"
80
80
  },
81
- "peerDependencies": {
82
- "@modern-js/core": "^1.3.2"
83
- },
84
81
  "sideEffects": false,
85
82
  "modernConfig": {
86
83
  "output": {
@@ -95,8 +92,7 @@
95
92
  },
96
93
  "publishConfig": {
97
94
  "registry": "https://registry.npmjs.org/",
98
- "access": "public",
99
- "types": "./dist/types/index.d.ts"
95
+ "access": "public"
100
96
  },
101
97
  "scripts": {
102
98
  "new": "modern new",
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "@modern-js/tsconfig/base",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "jsx": "preserve",
6
+ "baseUrl": "./",
7
+ "outDir": "./out",
8
+ "emitDeclarationOnly": true,
9
+ "isolatedModules": true,
10
+ "paths": {},
11
+ "types": ["node", "jest"]
12
+ }
13
+ }