@wzyjs/cli 0.2.12 → 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.
@@ -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 bootstrap_1 = require("@midwayjs/bootstrap");
29
- const hooks_internal_1 = require("@midwayjs/hooks-internal");
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 config = {
41
- ...Object.assign({ static: true }, (0, hooks_internal_1.getConfig)(root)),
42
- build: {
43
- outDir: './',
44
- },
45
- };
46
- (0, hooks_internal_1.setProjectRoot)(root);
47
- (0, hooks_internal_1.setConfig)(config);
48
- process.env.MIDWAY_HTTP_PORT = options.port.toString();
49
- const server = bootstrap_1.Bootstrap.configure({
50
- baseDir: root,
51
- ignore: ['**/_client/**'],
52
- });
53
- await server.run();
54
- console.log(`Your application is running at http://localhost:${options.port}`);
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
  };
@@ -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
- conditionNames: ["import", "require"]`);
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
- if (paths.length === 0 && remainingRequest === '.' && request.descriptionFileData.name === 'typeorm') {
127
- paths = ['./index.mjs']
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@wzyjs/cli",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "description",
5
5
  "author": "wzy",
6
6
  "scripts": {
@@ -44,5 +44,5 @@
44
44
  "type": "git",
45
45
  "url": "https://gitee.com/wang-zhenyu/app.git"
46
46
  },
47
- "gitHead": "41c740c5efe9cef6e892af9dfb8c1bd3ffaa6239"
47
+ "gitHead": "71a13cabc07c9a897ae1981dbb9c6120c01b1004"
48
48
  }