@modern-js/packages-generator 3.7.0 → 3.7.2
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/package.json +9 -9
- package/src/index.ts +0 -104
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.7.
|
|
18
|
+
"version": "3.7.2",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"main": "./dist/index.js",
|
|
21
21
|
"files": [
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"/dist/index.js"
|
|
24
24
|
],
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@modern-js/codesmith": "2.6.
|
|
27
|
-
"@modern-js/codesmith-api-app": "2.6.
|
|
28
|
-
"@modern-js/codesmith-api-json": "2.6.
|
|
29
|
-
"@modern-js/codesmith-utils": "2.6.
|
|
26
|
+
"@modern-js/codesmith": "2.6.5",
|
|
27
|
+
"@modern-js/codesmith-api-app": "2.6.5",
|
|
28
|
+
"@modern-js/codesmith-api-json": "2.6.5",
|
|
29
|
+
"@modern-js/codesmith-utils": "2.6.5",
|
|
30
30
|
"@types/jest": "^29",
|
|
31
31
|
"@types/node": "^14",
|
|
32
32
|
"jest": "^29",
|
|
33
33
|
"typescript": "^5",
|
|
34
|
-
"@modern-js/generator-common": "3.7.
|
|
35
|
-
"@modern-js/generator-utils": "3.7.
|
|
36
|
-
"@scripts/build": "2.60.
|
|
37
|
-
"@scripts/jest-config": "2.60.
|
|
34
|
+
"@modern-js/generator-common": "3.7.2",
|
|
35
|
+
"@modern-js/generator-utils": "3.7.2",
|
|
36
|
+
"@scripts/build": "2.60.6",
|
|
37
|
+
"@scripts/jest-config": "2.60.6"
|
|
38
38
|
},
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"publishConfig": {
|
package/src/index.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import type { GeneratorContext, GeneratorCore } from '@modern-js/codesmith';
|
|
3
|
-
import { AppAPI } from '@modern-js/codesmith-api-app';
|
|
4
|
-
import { JsonAPI } from '@modern-js/codesmith-api-json';
|
|
5
|
-
import { PackageManager } from '@modern-js/generator-common';
|
|
6
|
-
import { fs } from '@modern-js/generator-utils';
|
|
7
|
-
|
|
8
|
-
const handleTemplateFile = async (
|
|
9
|
-
context: GeneratorContext,
|
|
10
|
-
generator: GeneratorCore,
|
|
11
|
-
) => {
|
|
12
|
-
const { packageManager, packagesInfo } = context.config;
|
|
13
|
-
const jsonAPI = new JsonAPI(generator);
|
|
14
|
-
if (packageManager === PackageManager.Pnpm) {
|
|
15
|
-
const update: Record<string, string> = {};
|
|
16
|
-
Object.entries(packagesInfo || {}).forEach(([name, version]) => {
|
|
17
|
-
update[`pnpm.overrides.${name}`] = version as string;
|
|
18
|
-
});
|
|
19
|
-
await jsonAPI.update(
|
|
20
|
-
context.materials.default.get('package.json'),
|
|
21
|
-
{
|
|
22
|
-
query: {},
|
|
23
|
-
update: {
|
|
24
|
-
$set: update,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
true,
|
|
28
|
-
);
|
|
29
|
-
} else if (packageManager === PackageManager.Yarn) {
|
|
30
|
-
const pkgInfo = fs.readJSONSync(
|
|
31
|
-
path.join(context.materials.default.basePath, 'package.json'),
|
|
32
|
-
'utf-8',
|
|
33
|
-
);
|
|
34
|
-
const { dependencies = {}, devDependencies = {} } = pkgInfo;
|
|
35
|
-
|
|
36
|
-
const update: Record<string, string> = {};
|
|
37
|
-
Object.entries(packagesInfo || {}).forEach(([name, version]) => {
|
|
38
|
-
update[`resolutions.${name}`] = version as string;
|
|
39
|
-
if (dependencies[name]) {
|
|
40
|
-
update[`dependencies.${name}`] = version as string;
|
|
41
|
-
}
|
|
42
|
-
if (devDependencies[name]) {
|
|
43
|
-
update[`devDependencies.${name}`] = version as string;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
await jsonAPI.update(
|
|
47
|
-
context.materials.default.get('package.json'),
|
|
48
|
-
{
|
|
49
|
-
query: {},
|
|
50
|
-
update: {
|
|
51
|
-
$set: update,
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
true,
|
|
55
|
-
);
|
|
56
|
-
} else {
|
|
57
|
-
const pkgInfo = fs.readJSONSync(
|
|
58
|
-
path.join(context.materials.default.basePath, 'package.json'),
|
|
59
|
-
'utf-8',
|
|
60
|
-
);
|
|
61
|
-
const { dependencies = {}, devDependencies = {} } = pkgInfo;
|
|
62
|
-
|
|
63
|
-
const update: Record<string, string> = {};
|
|
64
|
-
Object.entries(packagesInfo || {}).forEach(([name, version]) => {
|
|
65
|
-
update[`overrides.${name}`] = version as string;
|
|
66
|
-
if (dependencies[name]) {
|
|
67
|
-
update[`dependencies.${name}`] = version as string;
|
|
68
|
-
}
|
|
69
|
-
if (devDependencies[name]) {
|
|
70
|
-
update[`devDependencies.${name}`] = version as string;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
await jsonAPI.update(
|
|
74
|
-
context.materials.default.get('package.json'),
|
|
75
|
-
{
|
|
76
|
-
query: {},
|
|
77
|
-
update: {
|
|
78
|
-
$set: update,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
true,
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export default async (context: GeneratorContext, generator: GeneratorCore) => {
|
|
87
|
-
const appApi = new AppAPI(context, generator);
|
|
88
|
-
const { locale } = context.config;
|
|
89
|
-
appApi.i18n.changeLanguage({ locale });
|
|
90
|
-
|
|
91
|
-
if (!(await appApi.checkEnvironment())) {
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
generator.logger.debug(`🚀 [Start Run Packages Generator]`);
|
|
96
|
-
generator.logger.debug(
|
|
97
|
-
'💡 [Current Config]:',
|
|
98
|
-
JSON.stringify(context.config),
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
await handleTemplateFile(context, generator);
|
|
102
|
-
|
|
103
|
-
generator.logger.debug(`🌟 [End Run Packages Generator]`);
|
|
104
|
-
};
|