@modern-js/generator-utils 1.0.0 → 1.1.1
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 +28 -0
- package/README.md +1 -4
- package/dist/js/modern/index.js +3 -2
- package/dist/js/node/index.js +11 -9
- package/dist/types/index.d.ts +1 -1
- package/package.json +5 -5
- package/src/index.ts +3 -2
- package/tests/.eslintrc.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @modern-js/generator-utils
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0fa83663: support more .env files
|
|
8
|
+
- Updated dependencies [0fa83663]
|
|
9
|
+
- Updated dependencies [f594fbc8]
|
|
10
|
+
- @modern-js/plugin-i18n@1.1.1
|
|
11
|
+
- @modern-js/utils@1.1.2
|
|
12
|
+
|
|
13
|
+
## 1.1.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 96119db2: Relese v1.1.0
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [96119db2]
|
|
22
|
+
- @modern-js/plugin-i18n@1.1.0
|
|
23
|
+
- @modern-js/utils@1.1.0
|
|
24
|
+
|
|
25
|
+
## 1.0.1
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- feat: update generator template
|
|
30
|
+
|
|
3
31
|
## 1.0.0
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -17,10 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
- [迈入现代 Web 开发](https://zhuanlan.zhihu.com/p/386607009)
|
|
22
|
-
- [现代 Web 开发者问卷调查报告](https://zhuanlan.zhihu.com/p/403206195)
|
|
23
|
-
- [字节跳动是如何落地微前端的](https://mp.weixin.qq.com/s/L9wbfNG5fTXF5bx7dcgj4Q)
|
|
20
|
+
- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)
|
|
24
21
|
|
|
25
22
|
## Getting Started
|
|
26
23
|
|
package/dist/js/modern/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
|
-
import
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fs, getMonorepoPackages } from '@modern-js/utils';
|
|
3
4
|
import execa from 'execa';
|
|
4
5
|
import ora from 'ora';
|
|
5
6
|
import { canUseNpm, canUsePnpm, canUseYarn } from "./utils/env";
|
|
6
7
|
import { stripAnsi } from "./utils/strip-ansi";
|
|
7
8
|
import { i18n, localeKeys } from "./locale";
|
|
8
9
|
export * from "./utils";
|
|
9
|
-
export { fs,
|
|
10
|
+
export { fs, readTsConfigByFile } from '@modern-js/utils';
|
|
10
11
|
export { i18n } from "./locale"; // eslint-disable-next-line max-statements
|
|
11
12
|
|
|
12
13
|
export async function getPackageVersion(packageName, registry) {
|
package/dist/js/node/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var _exportNames = {
|
|
|
15
15
|
getModuleProjectPath: true,
|
|
16
16
|
getMWAProjectPath: true,
|
|
17
17
|
fs: true,
|
|
18
|
-
|
|
18
|
+
readTsConfigByFile: true,
|
|
19
19
|
i18n: true
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "fs", {
|
|
@@ -38,10 +38,10 @@ Object.defineProperty(exports, "i18n", {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
exports.isTsProject = isTsProject;
|
|
41
|
-
Object.defineProperty(exports, "
|
|
41
|
+
Object.defineProperty(exports, "readTsConfigByFile", {
|
|
42
42
|
enumerable: true,
|
|
43
43
|
get: function () {
|
|
44
|
-
return _utils.
|
|
44
|
+
return _utils.readTsConfigByFile;
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
exports.validatePackageName = validatePackageName;
|
|
@@ -49,6 +49,8 @@ exports.validatePackagePath = validatePackagePath;
|
|
|
49
49
|
|
|
50
50
|
var _os = _interopRequireDefault(require("os"));
|
|
51
51
|
|
|
52
|
+
var _path = _interopRequireDefault(require("path"));
|
|
53
|
+
|
|
52
54
|
var _utils = require("@modern-js/utils");
|
|
53
55
|
|
|
54
56
|
var _execa = _interopRequireDefault(require("execa"));
|
|
@@ -126,19 +128,19 @@ function getPackageManager(cwd = process.cwd()) {
|
|
|
126
128
|
let appDirectory = cwd;
|
|
127
129
|
|
|
128
130
|
while (_os.default.homedir() !== appDirectory) {
|
|
129
|
-
if (_utils.fs.existsSync(
|
|
131
|
+
if (_utils.fs.existsSync(_path.default.resolve(appDirectory, 'pnpm-lock.yaml'))) {
|
|
130
132
|
return 'pnpm';
|
|
131
133
|
}
|
|
132
134
|
|
|
133
|
-
if (_utils.fs.existsSync(
|
|
135
|
+
if (_utils.fs.existsSync(_path.default.resolve(appDirectory, 'yarn.lock'))) {
|
|
134
136
|
return 'yarn';
|
|
135
137
|
}
|
|
136
138
|
|
|
137
|
-
if (_utils.fs.existsSync(
|
|
139
|
+
if (_utils.fs.existsSync(_path.default.resolve(appDirectory, 'package-lock.json'))) {
|
|
138
140
|
return 'npm';
|
|
139
141
|
}
|
|
140
142
|
|
|
141
|
-
appDirectory =
|
|
143
|
+
appDirectory = _path.default.join(appDirectory, '..');
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
return 'npm';
|
|
@@ -149,7 +151,7 @@ function getPackageManagerText(packageManager) {
|
|
|
149
151
|
}
|
|
150
152
|
|
|
151
153
|
function isTsProject(appDir) {
|
|
152
|
-
return _utils.fs.existsSync(
|
|
154
|
+
return _utils.fs.existsSync(_path.default.join(appDir, 'tsconfig.json'));
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
async function getPackageObj(context) {
|
|
@@ -195,7 +197,7 @@ function validatePackagePath(value, projectDir, options) {
|
|
|
195
197
|
dir = isPublic ? 'packages' : 'features';
|
|
196
198
|
}
|
|
197
199
|
|
|
198
|
-
const packageDir =
|
|
200
|
+
const packageDir = _path.default.resolve(projectDir || '', dir, value);
|
|
199
201
|
|
|
200
202
|
if (_utils.fs.existsSync(packageDir)) {
|
|
201
203
|
return {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GeneratorContext } from '@modern-js/codesmith';
|
|
2
2
|
export * from './utils';
|
|
3
|
-
export { fs,
|
|
3
|
+
export { fs, readTsConfigByFile } from '@modern-js/utils';
|
|
4
4
|
export { i18n } from './locale';
|
|
5
5
|
export declare function getPackageVersion(packageName: string, registry?: string): Promise<string>;
|
|
6
6
|
export declare function getPackageManager(cwd?: string): "npm" | "yarn" | "pnpm";
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.1.1",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7",
|
|
31
|
-
"@modern-js/plugin-i18n": "^1.
|
|
32
|
-
"@modern-js/utils": "^1.
|
|
31
|
+
"@modern-js/plugin-i18n": "^1.1.1",
|
|
32
|
+
"@modern-js/utils": "^1.1.2",
|
|
33
33
|
"execa": "^5.1.1",
|
|
34
34
|
"ora": "^5.4.1"
|
|
35
35
|
},
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@types/jest": "^26",
|
|
39
39
|
"@types/node": "^14",
|
|
40
40
|
"typescript": "^4",
|
|
41
|
-
"@modern-js/module-tools": "^1.
|
|
42
|
-
"@modern-js/plugin-testing": "^1.
|
|
41
|
+
"@modern-js/module-tools": "^1.1.0",
|
|
42
|
+
"@modern-js/plugin-testing": "^1.1.0"
|
|
43
43
|
},
|
|
44
44
|
"sideEffects": false,
|
|
45
45
|
"modernConfig": {
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
|
-
import
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fs, getMonorepoPackages } from '@modern-js/utils';
|
|
3
4
|
import execa from 'execa';
|
|
4
5
|
import ora from 'ora';
|
|
5
6
|
import { GeneratorContext } from '@modern-js/codesmith';
|
|
@@ -9,7 +10,7 @@ import { i18n, localeKeys } from './locale';
|
|
|
9
10
|
|
|
10
11
|
export * from './utils';
|
|
11
12
|
|
|
12
|
-
export { fs,
|
|
13
|
+
export { fs, readTsConfigByFile } from '@modern-js/utils';
|
|
13
14
|
|
|
14
15
|
export { i18n } from './locale';
|
|
15
16
|
|