@modern-js/ssg-generator 3.7.0 → 3.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +10 -10
  2. package/src/index.ts +0 -102
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.7.0",
18
+ "version": "3.7.1",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "main": "./dist/index.js",
21
21
  "files": [
@@ -23,19 +23,19 @@
23
23
  "/dist/index.js"
24
24
  ],
25
25
  "devDependencies": {
26
- "@modern-js/codesmith": "2.6.4",
27
- "@modern-js/codesmith-utils": "2.6.4",
28
- "@modern-js/codesmith-api-app": "2.6.4",
26
+ "@modern-js/codesmith": "2.6.5",
27
+ "@modern-js/codesmith-utils": "2.6.5",
28
+ "@modern-js/codesmith-api-app": "2.6.5",
29
29
  "@types/jest": "^29",
30
30
  "@types/node": "^14",
31
31
  "jest": "^29",
32
32
  "typescript": "^5",
33
- "@modern-js/dependence-generator": "3.7.0",
34
- "@modern-js/generator-utils": "3.7.0",
35
- "@modern-js/generator-common": "3.7.0",
36
- "@modern-js/plugin-i18n": "2.60.4",
37
- "@scripts/build": "2.60.4",
38
- "@scripts/jest-config": "2.60.4"
33
+ "@modern-js/dependence-generator": "3.7.1",
34
+ "@modern-js/generator-utils": "3.7.1",
35
+ "@modern-js/plugin-i18n": "2.60.5",
36
+ "@scripts/build": "2.60.5",
37
+ "@scripts/jest-config": "2.60.5",
38
+ "@modern-js/generator-common": "3.7.1"
39
39
  },
40
40
  "sideEffects": false,
41
41
  "publishConfig": {
package/src/index.ts DELETED
@@ -1,102 +0,0 @@
1
- import type { GeneratorContext, GeneratorCore } from '@modern-js/codesmith';
2
- import { AppAPI } from '@modern-js/codesmith-api-app';
3
- import {
4
- DependenceGenerator,
5
- i18n as commonI18n,
6
- } from '@modern-js/generator-common';
7
- import {
8
- chalk,
9
- getGeneratorPath,
10
- getModernConfigFile,
11
- } from '@modern-js/generator-utils';
12
- import { i18n, localeKeys } from './locale';
13
-
14
- const handleTemplateFile = async (
15
- context: GeneratorContext,
16
- _generator: GeneratorCore,
17
- appApi: AppAPI,
18
- ) => {
19
- await appApi.runSubGenerator(
20
- getGeneratorPath(DependenceGenerator, context.config.distTag, [__dirname]),
21
- undefined,
22
- {
23
- ...context.config,
24
- isSubGenerator: true,
25
- },
26
- );
27
- };
28
-
29
- export default async (context: GeneratorContext, generator: GeneratorCore) => {
30
- const appApi = new AppAPI(context, generator);
31
-
32
- const { locale } = context.config;
33
- commonI18n.changeLanguage({ locale });
34
- appApi.i18n.changeLanguage({ locale });
35
-
36
- if (!(await appApi.checkEnvironment())) {
37
- process.exit(1);
38
- }
39
-
40
- generator.logger.debug(`🚀 [Start Run SSG Generator]`);
41
- generator.logger.debug(
42
- '💡 [Current Config]:',
43
- JSON.stringify(context.config),
44
- );
45
-
46
- await handleTemplateFile(context, generator, appApi);
47
-
48
- if (!context.config.isSubGenerator) {
49
- await appApi.runInstall(undefined, { ignoreScripts: true });
50
- if (!context.config.pluginName) {
51
- appApi.showSuccessInfo();
52
- } else {
53
- const appDir = context.materials.default.basePath;
54
- const configFile = await getModernConfigFile(appDir);
55
- const isTS = configFile.endsWith('ts');
56
- const { pluginName, pluginDependence, shouldUsePluginNameExport } =
57
- context.config;
58
- console.info(
59
- chalk.green(`\n[INFO]`),
60
- `${i18n.t(localeKeys.success)}`,
61
- chalk.yellow.bold(`${configFile}`),
62
- ':',
63
- '\n',
64
- );
65
- if (shouldUsePluginNameExport) {
66
- console.info(
67
- chalk.yellow.bold(
68
- `import { ${pluginName} } from '${pluginDependence}';`,
69
- ),
70
- );
71
- } else {
72
- console.info(
73
- chalk.yellow.bold(`import ${pluginName} from '${pluginDependence}';`),
74
- );
75
- }
76
- if (isTS) {
77
- console.info(`
78
- export default defineConfig({
79
- ...,
80
- output: {
81
- ...,
82
- ${chalk.yellow.bold(`ssg: true`)},
83
- },
84
- plugins: [..., ${chalk.yellow.bold(`${pluginName}()`)}],
85
- });
86
- `);
87
- } else {
88
- console.info(`
89
- module.exports = {
90
- ...,
91
- output: {
92
- ...,
93
- ${chalk.yellow.bold(`ssg: true`)},
94
- },
95
- plugins: [..., ${chalk.yellow.bold(`${pluginName}()`)}],
96
- };
97
- `);
98
- }
99
- }
100
- }
101
- generator.logger.debug(`🌟 [End Run SSG Generator]`);
102
- };