@wzyjs/cli 0.2.11 → 0.2.13
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/dist/commands/start/index.js +28 -17
- package/dist/utils/index.js +6 -5
- package/package.json +3 -3
|
@@ -25,8 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const path_1 = require("path");
|
|
27
27
|
const fs = __importStar(require("fs-extra"));
|
|
28
|
-
const
|
|
29
|
-
|
|
28
|
+
const child_process_1 = require("child_process");
|
|
29
|
+
// import { Bootstrap } from '@midwayjs/bootstrap'
|
|
30
|
+
// import { getConfig, setConfig, setProjectRoot } from '@midwayjs/hooks-internal'
|
|
30
31
|
exports.default = (cli) => {
|
|
31
32
|
cli.command('start', 'start')
|
|
32
33
|
.option('-p, --port <port>', '[number] specify port', { default: 3000 })
|
|
@@ -37,20 +38,30 @@ exports.default = (cli) => {
|
|
|
37
38
|
console.error('dist 目录不存在,请先执行 build 命令');
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
41
|
+
const command = (0, child_process_1.spawn)('hooks', ['start']);
|
|
42
|
+
command.stdout.on('data', data => console.log(data.toString()));
|
|
43
|
+
command.stderr.on('data', err => console.error(err.toString()));
|
|
44
|
+
command.on('error', err => console.error(err.toString()));
|
|
45
|
+
// const config = {
|
|
46
|
+
// ...Object.assign({ static: true }, getConfig(root)),
|
|
47
|
+
// build: {
|
|
48
|
+
// outDir: './',
|
|
49
|
+
// },
|
|
50
|
+
// }
|
|
51
|
+
//
|
|
52
|
+
// setProjectRoot(root)
|
|
53
|
+
// setConfig(config)
|
|
54
|
+
//
|
|
55
|
+
// process.env.MIDWAY_HTTP_PORT = options.port.toString()
|
|
56
|
+
//
|
|
57
|
+
// const server = Bootstrap.configure({
|
|
58
|
+
// baseDir: root,
|
|
59
|
+
// ignore: ['**/_client/**'],
|
|
60
|
+
// })
|
|
61
|
+
//
|
|
62
|
+
// await server.run()
|
|
63
|
+
// console.log(
|
|
64
|
+
// `Your application is running at http://localhost:${options.port}`,
|
|
65
|
+
// )
|
|
55
66
|
});
|
|
56
67
|
};
|
package/dist/utils/index.js
CHANGED
|
@@ -121,11 +121,12 @@ const replaceContentInFile = (filePath, targetContent, replacement) => {
|
|
|
121
121
|
const hack = async () => {
|
|
122
122
|
const pwd = path_1.default.resolve(__dirname, '../../');
|
|
123
123
|
await replaceContentInFile(`${pwd}/node_modules/@umijs/preset-umi/dist/libs/scan.js`, 'exportsFields: []', `exportsFields: ['exports'],
|
|
124
|
-
|
|
124
|
+
conditionNames: ["import", "require"]
|
|
125
|
+
`);
|
|
125
126
|
await replaceContentInFile(`${pwd}/node_modules/enhanced-resolve/lib/ExportsFieldPlugin.js`, 'paths = fieldProcessor(remainingRequest, this.conditionNames);', `paths = fieldProcessor(remainingRequest, this.conditionNames)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
if (paths.length === 0 && remainingRequest === '.' && request.descriptionFileData.name === 'typeorm') {
|
|
128
|
+
paths = ['./index.mjs']
|
|
129
|
+
}
|
|
130
|
+
`);
|
|
130
131
|
};
|
|
131
132
|
exports.hack = hack;
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wzyjs/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "description",
|
|
5
5
|
"author": "wzy",
|
|
6
|
-
"license": "ISC",
|
|
7
6
|
"scripts": {
|
|
8
7
|
"dev": "tsc -w",
|
|
9
8
|
"build": "tsc --noEmitOnError false",
|
|
@@ -22,6 +21,7 @@
|
|
|
22
21
|
"@midwayjs/command-core": "^1.3.14",
|
|
23
22
|
"@midwayjs/core": "^3.12.3",
|
|
24
23
|
"@midwayjs/hooks-internal": "^3.1.6",
|
|
24
|
+
"@midwayjs/logger": "^3.4.2",
|
|
25
25
|
"@midwayjs/rpc": "^3.1.6",
|
|
26
26
|
"@umijs/plugins": "^4.0.28",
|
|
27
27
|
"cac": "^6.7.14",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"type": "git",
|
|
45
45
|
"url": "https://gitee.com/wang-zhenyu/app.git"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "71a13cabc07c9a897ae1981dbb9c6120c01b1004"
|
|
48
48
|
}
|