@modern-js/new-action 1.3.3 → 1.3.6
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/.eslintrc.js +8 -0
- package/CHANGELOG.md +31 -0
- package/dist/js/modern/module.js +4 -8
- package/dist/js/modern/monorepo.js +2 -3
- package/dist/js/modern/mwa.js +2 -5
- package/dist/js/modern/utils/index.js +10 -5
- package/dist/js/node/module.js +3 -7
- package/dist/js/node/monorepo.js +2 -4
- package/dist/js/node/mwa.js +2 -5
- package/dist/js/node/utils/index.js +10 -5
- package/jest.config.js +0 -1
- package/package.json +5 -6
- package/tests/index.test.ts +0 -7
- package/tests/tsconfig.json +0 -13
package/.eslintrc.js
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @modern-js/new-action
|
|
2
2
|
|
|
3
|
+
## 1.3.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6cffe99d: chore:
|
|
8
|
+
remove react eslint rules for `modern-js` rule set.
|
|
9
|
+
add .eslintrc for each package to speed up linting
|
|
10
|
+
- 04ae5262: chore: bump @modern-js/utils to v1.4.1 in dependencies
|
|
11
|
+
- 60f7d8bf: feat: add tests dir to npmignore
|
|
12
|
+
- Updated dependencies [b8599d09]
|
|
13
|
+
- Updated dependencies [6cffe99d]
|
|
14
|
+
- Updated dependencies [04ae5262]
|
|
15
|
+
- Updated dependencies [60f7d8bf]
|
|
16
|
+
- Updated dependencies [3bf4f8b0]
|
|
17
|
+
- @modern-js/utils@1.5.0
|
|
18
|
+
- @modern-js/generator-common@1.4.9
|
|
19
|
+
- @modern-js/generator-utils@1.2.2
|
|
20
|
+
|
|
21
|
+
## 1.3.5
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 17d0cc46: feat: prebundle lodash to @modern-js/utils/lodash
|
|
26
|
+
- Updated dependencies [77ff9754]
|
|
27
|
+
- Updated dependencies [d2d1d6b2]
|
|
28
|
+
- Updated dependencies [07a4887e]
|
|
29
|
+
- Updated dependencies [ea2ae711]
|
|
30
|
+
- Updated dependencies [17d0cc46]
|
|
31
|
+
- Updated dependencies [d2d1d6b2]
|
|
32
|
+
- @modern-js/utils@1.4.0
|
|
33
|
+
|
|
3
34
|
## 1.3.3
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/dist/js/modern/module.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { merge } from '@modern-js/utils/lodash';
|
|
2
2
|
import { CodeSmith, GeneratorCore, MaterialsManager } from '@modern-js/codesmith';
|
|
3
3
|
import { AppAPI, forEach } from '@modern-js/codesmith-api-app';
|
|
4
|
-
import { i18n, ModuleNewActionSchema, ModuleActionFunctions, ModuleActionFunctionsDependencies, ModuleActionFunctionsDevDependencies, ModuleActionFunctionsPeerDependencies,
|
|
4
|
+
import { i18n, ModuleNewActionSchema, ModuleActionFunctions, ModuleActionFunctionsDependencies, ModuleActionFunctionsDevDependencies, ModuleActionFunctionsPeerDependencies, ModuleNewActionGenerators } from '@modern-js/generator-common';
|
|
5
5
|
import { getPackageVersion, getPackageManager } from '@modern-js/generator-utils';
|
|
6
6
|
import { alreadyRepo, hasEnabledFunction } from "./utils";
|
|
7
|
-
// eslint-disable-next-line max-statements
|
|
8
7
|
export const ModuleNewAction = async options => {
|
|
9
8
|
const {
|
|
10
9
|
locale = 'zh',
|
|
@@ -82,8 +81,7 @@ export const ModuleNewAction = async options => {
|
|
|
82
81
|
const devDependency = ModuleActionFunctionsDevDependencies[action];
|
|
83
82
|
const dependency = ModuleActionFunctionsDependencies[action];
|
|
84
83
|
const peerDependency = ModuleActionFunctionsPeerDependencies[action];
|
|
85
|
-
|
|
86
|
-
const finalConfig = _merge(UserConfig, ans, {
|
|
84
|
+
const finalConfig = merge(UserConfig, ans, {
|
|
87
85
|
locale: UserConfig.locale || locale,
|
|
88
86
|
packageManager: UserConfig.packageManager || (await getPackageManager(cwd))
|
|
89
87
|
}, {
|
|
@@ -95,10 +93,8 @@ export const ModuleNewAction = async options => {
|
|
|
95
93
|
} : {},
|
|
96
94
|
peerDependencies: peerDependency ? {
|
|
97
95
|
[peerDependency]: `^${await getPackageVersion(peerDependency)}`
|
|
98
|
-
} : {}
|
|
99
|
-
appendTypeContent: ModuleActionFunctionsAppendTypeContent[action]
|
|
96
|
+
} : {}
|
|
100
97
|
});
|
|
101
|
-
|
|
102
98
|
const task = [{
|
|
103
99
|
name: generator,
|
|
104
100
|
config: finalConfig
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { merge } from '@modern-js/utils/lodash';
|
|
2
2
|
import { CodeSmith } from '@modern-js/codesmith';
|
|
3
3
|
import { i18n } from '@modern-js/generator-common';
|
|
4
4
|
import { getPackageManager } from '@modern-js/generator-utils';
|
|
@@ -34,14 +34,13 @@ export const MonorepoNewAction = async options => {
|
|
|
34
34
|
smith.logger.warn('not valid modern.js repo');
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const finalConfig =
|
|
37
|
+
const finalConfig = merge(UserConfig, {
|
|
38
38
|
locale: UserConfig.locale || locale,
|
|
39
39
|
packageManager: UserConfig.packageManager || (await getPackageManager(cwd)),
|
|
40
40
|
isMonorepo: true,
|
|
41
41
|
distTag,
|
|
42
42
|
plugins
|
|
43
43
|
});
|
|
44
|
-
|
|
45
44
|
let generator = REPO_GENERAROE;
|
|
46
45
|
|
|
47
46
|
if (process.env.CODESMITH_ENV === 'development') {
|
package/dist/js/modern/mwa.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { merge } from '@modern-js/utils/lodash';
|
|
2
2
|
import { CodeSmith, GeneratorCore, MaterialsManager } from '@modern-js/codesmith';
|
|
3
3
|
import { AppAPI, forEach } from '@modern-js/codesmith-api-app';
|
|
4
4
|
import { MWANewActionSchema, MWAActionFunctions, MWAActionFunctionsDependencies, MWAActionFunctionsAppendTypeContent, MWAActionFunctionsDevDependencies, MWANewActionGenerators, i18n } from '@modern-js/generator-common';
|
|
5
5
|
import { getPackageManager, getPackageVersion } from '@modern-js/generator-utils';
|
|
6
6
|
import { alreadyRepo, hasEnabledFunction } from "./utils";
|
|
7
|
-
// eslint-disable-next-line max-statements
|
|
8
7
|
export const MWANewAction = async options => {
|
|
9
8
|
const {
|
|
10
9
|
locale = 'zh',
|
|
@@ -69,8 +68,7 @@ export const MWANewAction = async options => {
|
|
|
69
68
|
|
|
70
69
|
const devDependency = MWAActionFunctionsDevDependencies[action];
|
|
71
70
|
const dependency = MWAActionFunctionsDependencies[action];
|
|
72
|
-
|
|
73
|
-
const finalConfig = _merge(UserConfig, ans, {
|
|
71
|
+
const finalConfig = merge(UserConfig, ans, {
|
|
74
72
|
locale: UserConfig.locale || locale,
|
|
75
73
|
packageManager: UserConfig.packageManager || (await getPackageManager(cwd))
|
|
76
74
|
}, {
|
|
@@ -82,7 +80,6 @@ export const MWANewAction = async options => {
|
|
|
82
80
|
} : {},
|
|
83
81
|
appendTypeContent: MWAActionFunctionsAppendTypeContent[action]
|
|
84
82
|
});
|
|
85
|
-
|
|
86
83
|
const task = [{
|
|
87
84
|
name: generator,
|
|
88
85
|
config: finalConfig
|
|
@@ -22,8 +22,7 @@ export const readJson = jsonPath => {
|
|
|
22
22
|
} catch (error) {
|
|
23
23
|
throw Error(`${jsonPath} is not a valid json, please check and try again.`);
|
|
24
24
|
}
|
|
25
|
-
};
|
|
26
|
-
|
|
25
|
+
};
|
|
27
26
|
export function hasEnabledFunction(action, dependencies, devDependencies, peerDependencies, cwd) {
|
|
28
27
|
const packageJsonPath = path.normalize(`${cwd}/package.json`);
|
|
29
28
|
const packageJson = readJson(packageJsonPath);
|
|
@@ -33,15 +32,21 @@ export function hasEnabledFunction(action, dependencies, devDependencies, peerDe
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
if (dependencies[action]) {
|
|
36
|
-
|
|
35
|
+
var _packageJson$dependen;
|
|
36
|
+
|
|
37
|
+
return (_packageJson$dependen = packageJson.dependencies) === null || _packageJson$dependen === void 0 ? void 0 : _packageJson$dependen[dependencies[action]];
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
if (peerDependencies[action]) {
|
|
40
|
-
|
|
41
|
+
var _packageJson$peerDepe;
|
|
42
|
+
|
|
43
|
+
return (_packageJson$peerDepe = packageJson.peerDependencies) === null || _packageJson$peerDepe === void 0 ? void 0 : _packageJson$peerDepe[peerDependencies[action]];
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
if (!peerDependencies[action] && devDependencies[action]) {
|
|
44
|
-
|
|
47
|
+
var _packageJson$devDepen;
|
|
48
|
+
|
|
49
|
+
return (_packageJson$devDepen = packageJson.devDependencies) === null || _packageJson$devDepen === void 0 ? void 0 : _packageJson$devDepen[devDependencies[action]];
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
return false;
|
package/dist/js/node/module.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ModuleNewAction = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _lodash = require("@modern-js/utils/lodash");
|
|
9
9
|
|
|
10
10
|
var _codesmith = require("@modern-js/codesmith");
|
|
11
11
|
|
|
@@ -17,9 +17,6 @@ var _generatorUtils = require("@modern-js/generator-utils");
|
|
|
17
17
|
|
|
18
18
|
var _utils = require("./utils");
|
|
19
19
|
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
|
-
// eslint-disable-next-line max-statements
|
|
23
20
|
const ModuleNewAction = async options => {
|
|
24
21
|
const {
|
|
25
22
|
locale = 'zh',
|
|
@@ -98,7 +95,7 @@ const ModuleNewAction = async options => {
|
|
|
98
95
|
const devDependency = _generatorCommon.ModuleActionFunctionsDevDependencies[action];
|
|
99
96
|
const dependency = _generatorCommon.ModuleActionFunctionsDependencies[action];
|
|
100
97
|
const peerDependency = _generatorCommon.ModuleActionFunctionsPeerDependencies[action];
|
|
101
|
-
const finalConfig = (0,
|
|
98
|
+
const finalConfig = (0, _lodash.merge)(UserConfig, ans, {
|
|
102
99
|
locale: UserConfig.locale || locale,
|
|
103
100
|
packageManager: UserConfig.packageManager || (await (0, _generatorUtils.getPackageManager)(cwd))
|
|
104
101
|
}, {
|
|
@@ -110,8 +107,7 @@ const ModuleNewAction = async options => {
|
|
|
110
107
|
} : {},
|
|
111
108
|
peerDependencies: peerDependency ? {
|
|
112
109
|
[peerDependency]: `^${await (0, _generatorUtils.getPackageVersion)(peerDependency)}`
|
|
113
|
-
} : {}
|
|
114
|
-
appendTypeContent: _generatorCommon.ModuleActionFunctionsAppendTypeContent[action]
|
|
110
|
+
} : {}
|
|
115
111
|
});
|
|
116
112
|
const task = [{
|
|
117
113
|
name: generator,
|
package/dist/js/node/monorepo.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.MonorepoNewAction = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _lodash = require("@modern-js/utils/lodash");
|
|
9
9
|
|
|
10
10
|
var _codesmith = require("@modern-js/codesmith");
|
|
11
11
|
|
|
@@ -15,8 +15,6 @@ var _generatorUtils = require("@modern-js/generator-utils");
|
|
|
15
15
|
|
|
16
16
|
var _utils = require("./utils");
|
|
17
17
|
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
18
|
const REPO_GENERAROE = '@modern-js/repo-generator';
|
|
21
19
|
|
|
22
20
|
const MonorepoNewAction = async options => {
|
|
@@ -50,7 +48,7 @@ const MonorepoNewAction = async options => {
|
|
|
50
48
|
smith.logger.warn('not valid modern.js repo');
|
|
51
49
|
}
|
|
52
50
|
|
|
53
|
-
const finalConfig = (0,
|
|
51
|
+
const finalConfig = (0, _lodash.merge)(UserConfig, {
|
|
54
52
|
locale: UserConfig.locale || locale,
|
|
55
53
|
packageManager: UserConfig.packageManager || (await (0, _generatorUtils.getPackageManager)(cwd)),
|
|
56
54
|
isMonorepo: true,
|
package/dist/js/node/mwa.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.MWANewAction = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _lodash = require("@modern-js/utils/lodash");
|
|
9
9
|
|
|
10
10
|
var _codesmith = require("@modern-js/codesmith");
|
|
11
11
|
|
|
@@ -17,9 +17,6 @@ var _generatorUtils = require("@modern-js/generator-utils");
|
|
|
17
17
|
|
|
18
18
|
var _utils = require("./utils");
|
|
19
19
|
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
|
-
// eslint-disable-next-line max-statements
|
|
23
20
|
const MWANewAction = async options => {
|
|
24
21
|
const {
|
|
25
22
|
locale = 'zh',
|
|
@@ -85,7 +82,7 @@ const MWANewAction = async options => {
|
|
|
85
82
|
|
|
86
83
|
const devDependency = _generatorCommon.MWAActionFunctionsDevDependencies[action];
|
|
87
84
|
const dependency = _generatorCommon.MWAActionFunctionsDependencies[action];
|
|
88
|
-
const finalConfig = (0,
|
|
85
|
+
const finalConfig = (0, _lodash.merge)(UserConfig, ans, {
|
|
89
86
|
locale: UserConfig.locale || locale,
|
|
90
87
|
packageManager: UserConfig.packageManager || (await (0, _generatorUtils.getPackageManager)(cwd))
|
|
91
88
|
}, {
|
|
@@ -37,8 +37,7 @@ const readJson = jsonPath => {
|
|
|
37
37
|
} catch (error) {
|
|
38
38
|
throw Error(`${jsonPath} is not a valid json, please check and try again.`);
|
|
39
39
|
}
|
|
40
|
-
};
|
|
41
|
-
|
|
40
|
+
};
|
|
42
41
|
|
|
43
42
|
exports.readJson = readJson;
|
|
44
43
|
|
|
@@ -52,15 +51,21 @@ function hasEnabledFunction(action, dependencies, devDependencies, peerDependenc
|
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
if (dependencies[action]) {
|
|
55
|
-
|
|
54
|
+
var _packageJson$dependen;
|
|
55
|
+
|
|
56
|
+
return (_packageJson$dependen = packageJson.dependencies) === null || _packageJson$dependen === void 0 ? void 0 : _packageJson$dependen[dependencies[action]];
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
if (peerDependencies[action]) {
|
|
59
|
-
|
|
60
|
+
var _packageJson$peerDepe;
|
|
61
|
+
|
|
62
|
+
return (_packageJson$peerDepe = packageJson.peerDependencies) === null || _packageJson$peerDepe === void 0 ? void 0 : _packageJson$peerDepe[peerDependencies[action]];
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
if (!peerDependencies[action] && devDependencies[action]) {
|
|
63
|
-
|
|
66
|
+
var _packageJson$devDepen;
|
|
67
|
+
|
|
68
|
+
return (_packageJson$devDepen = packageJson.devDependencies) === null || _packageJson$devDepen === void 0 ? void 0 : _packageJson$devDepen[devDependencies[action]];
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
return false;
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.3.
|
|
14
|
+
"version": "1.3.6",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -31,14 +31,13 @@
|
|
|
31
31
|
"@babel/runtime": "^7",
|
|
32
32
|
"@modern-js/codesmith": "^1.0.8",
|
|
33
33
|
"@modern-js/codesmith-api-app": "^1.0.8",
|
|
34
|
-
"@modern-js/generator-common": "^1.4.
|
|
35
|
-
"@modern-js/generator-utils": "^1.2.
|
|
36
|
-
"
|
|
37
|
-
"
|
|
34
|
+
"@modern-js/generator-common": "^1.4.9",
|
|
35
|
+
"@modern-js/generator-utils": "^1.2.2",
|
|
36
|
+
"@modern-js/utils": "^1.5.0",
|
|
37
|
+
"json5": "^2.2.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/jest": "^26",
|
|
41
|
-
"@types/lodash": "^4.14.168",
|
|
42
41
|
"@types/node": "^14",
|
|
43
42
|
"typescript": "^4",
|
|
44
43
|
"@scripts/build": "0.0.0",
|
package/tests/index.test.ts
DELETED
package/tests/tsconfig.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|