@modern-js/dependence-generator 3.0.5 → 3.0.7

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.
Files changed (4) hide show
  1. package/README.md +14 -18
  2. package/dist/index.js +3345 -2269
  3. package/package.json +10 -10
  4. package/src/index.ts +27 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/dependence-generator",
3
- "description": "The meta-framework suite designed from scratch for frontend-focused modern web development.",
3
+ "description": "A Progressive React Framework for modern web development.",
4
4
  "homepage": "https://modernjs.dev",
5
5
  "bugs": "https://github.com/modern-js-dev/modern.js/issues",
6
6
  "repository": "modern-js-dev/modern.js",
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "3.0.5",
14
+ "version": "3.0.7",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "main": "./dist/index.js",
17
17
  "files": [
@@ -20,18 +20,18 @@
20
20
  ],
21
21
  "devDependencies": {
22
22
  "@babel/runtime": "^7.18.0",
23
- "@modern-js/codesmith": "2.0.3",
24
- "@modern-js/codesmith-api-app": "2.0.3",
25
- "@modern-js/codesmith-api-json": "2.0.3",
23
+ "@modern-js/codesmith": "2.0.4",
24
+ "@modern-js/codesmith-api-app": "2.0.4",
25
+ "@modern-js/codesmith-api-json": "2.0.4",
26
26
  "@types/jest": "^27",
27
27
  "@types/node": "^14",
28
28
  "jest": "^27",
29
29
  "typescript": "^4",
30
- "@modern-js/plugin-i18n": "2.3.0",
31
- "@modern-js/generator-common": "3.0.5",
32
- "@modern-js/generator-utils": "3.0.5",
33
- "@scripts/jest-config": "2.3.0",
34
- "@scripts/build": "2.3.0"
30
+ "@modern-js/generator-common": "3.0.7",
31
+ "@modern-js/generator-utils": "3.0.7",
32
+ "@modern-js/plugin-i18n": "2.5.0",
33
+ "@scripts/build": "2.5.0",
34
+ "@scripts/jest-config": "2.5.0"
35
35
  },
36
36
  "sideEffects": false,
37
37
  "publishConfig": {
package/src/index.ts CHANGED
@@ -3,7 +3,7 @@ import { GeneratorContext, GeneratorCore } from '@modern-js/codesmith';
3
3
  import { AppAPI } from '@modern-js/codesmith-api-app';
4
4
  import { JsonAPI } from '@modern-js/codesmith-api-json';
5
5
  import { i18n as commonI18n } from '@modern-js/generator-common';
6
- import { fs, getModernConfigFile } from '@modern-js/generator-utils';
6
+ import { fs, chalk, getModernConfigFile } from '@modern-js/generator-utils';
7
7
  import { i18n, localeKeys } from './locale';
8
8
 
9
9
  export const handleTemplateFile = async (
@@ -94,18 +94,33 @@ export default async (context: GeneratorContext, generator: GeneratorCore) => {
94
94
  } else {
95
95
  const appDir = context.materials.default.basePath;
96
96
  const configFile = await getModernConfigFile(appDir);
97
- appApi.showSuccessInfo(
98
- i18n.t(
99
- configFile.endsWith('ts')
100
- ? localeKeys.successTs
101
- : localeKeys.successJS,
102
- {
103
- configFile,
104
- pluginName: context.config.pluginName,
105
- pluginDependence: context.config.pluginDependence,
106
- },
107
- ),
97
+ const isTS = configFile.endsWith('ts');
98
+ const { pluginName, pluginDependence } = context.config;
99
+ console.info(
100
+ chalk.green(`\n[INFO]`),
101
+ `${i18n.t(localeKeys.success)}`,
102
+ chalk.yellow.bold(`${configFile}`),
103
+ ':',
104
+ '\n',
108
105
  );
106
+ console.info(
107
+ chalk.yellow.bold(`import ${pluginName} from '${pluginDependence}';`),
108
+ );
109
+ if (isTS) {
110
+ console.info(`
111
+ export default defineConfig({
112
+ ...,
113
+ plugins: [..., ${chalk.yellow.bold(`${pluginName}()`)}],
114
+ });
115
+ `);
116
+ } else {
117
+ console.info(`
118
+ module.exports = {
119
+ ...,
120
+ plugins: [..., ${chalk.yellow.bold(`${pluginName}()`)}],
121
+ };
122
+ `);
123
+ }
109
124
  }
110
125
  }
111
126