umi 4.0.0-beta.1 → 4.0.0-beta.5

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.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('v8-compile-cache');
4
+ require('../dist/cli/forkedDev');
package/bin/umi.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('v8-compile-cache');
4
+ require('../dist/cli/cli')
5
+ .run()
6
+ .catch((e) => {
7
+ console.error(e);
8
+ process.exit(1);
9
+ });
package/dist/cli/cli.d.ts CHANGED
@@ -1 +1,5 @@
1
+ interface IOpts {
2
+ presets?: string[];
3
+ }
4
+ export declare function run(opts?: IOpts): Promise<void>;
1
5
  export {};
package/dist/cli/cli.js CHANGED
@@ -9,43 +9,50 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.run = void 0;
12
13
  const utils_1 = require("@umijs/utils");
13
14
  const constants_1 = require("../constants");
14
15
  const service_1 = require("../service/service");
15
16
  const dev_1 = require("./dev");
16
17
  const node_1 = require("./node");
17
- (0, node_1.checkVersion)();
18
- (0, node_1.checkLocal)();
19
- (0, node_1.setNodeTitle)();
20
- (0, node_1.setNoDeprecation)();
21
- (() => __awaiter(void 0, void 0, void 0, function* () {
22
- const args = (0, utils_1.yParser)(process.argv.slice(2), {
23
- alias: {
24
- version: ['v'],
25
- help: ['h'],
26
- },
27
- boolean: ['version'],
28
- });
29
- const command = args._[0];
30
- if ([constants_1.DEV_COMMAND, 'setup'].includes(command)) {
31
- process.env.NODE_ENV = 'development';
32
- }
33
- else if (command === 'build') {
34
- process.env.NODE_ENV = 'production';
35
- }
36
- if (command === constants_1.DEV_COMMAND) {
37
- (0, dev_1.dev)();
38
- }
39
- else {
40
- try {
41
- yield new service_1.Service().run2({
42
- name: args._[0],
43
- args,
44
- });
18
+ function run(opts) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ (0, node_1.checkVersion)();
21
+ (0, node_1.checkLocal)();
22
+ (0, node_1.setNodeTitle)();
23
+ (0, node_1.setNoDeprecation)();
24
+ const args = (0, utils_1.yParser)(process.argv.slice(2), {
25
+ alias: {
26
+ version: ['v'],
27
+ help: ['h'],
28
+ },
29
+ boolean: ['version'],
30
+ });
31
+ const command = args._[0];
32
+ if ([constants_1.DEV_COMMAND, 'setup'].includes(command)) {
33
+ process.env.NODE_ENV = 'development';
34
+ }
35
+ else if (command === 'build') {
36
+ process.env.NODE_ENV = 'production';
37
+ }
38
+ if (opts === null || opts === void 0 ? void 0 : opts.presets) {
39
+ process.env.UMI_PRESETS = opts.presets.join(',');
45
40
  }
46
- catch (e) {
47
- utils_1.logger.error(e);
48
- process.exit(1);
41
+ if (command === constants_1.DEV_COMMAND) {
42
+ (0, dev_1.dev)();
49
43
  }
50
- }
51
- }))();
44
+ else {
45
+ try {
46
+ yield new service_1.Service().run2({
47
+ name: args._[0],
48
+ args,
49
+ });
50
+ }
51
+ catch (e) {
52
+ utils_1.logger.error(e);
53
+ process.exit(1);
54
+ }
55
+ }
56
+ });
57
+ }
58
+ exports.run = run;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  import { IServicePluginAPI, PluginAPI } from '@umijs/core';
2
+ import * as utils from '@umijs/utils';
2
3
  export declare type IApi = PluginAPI & IServicePluginAPI;
3
4
  export * from './service/service';
5
+ export { utils };
package/dist/index.js CHANGED
@@ -6,8 +6,23 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
6
6
  if (k2 === undefined) k2 = k;
7
7
  o[k2] = m[k];
8
8
  }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
9
21
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
22
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
23
  };
12
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.utils = void 0;
26
+ const utils = __importStar(require("@umijs/utils"));
27
+ exports.utils = utils;
13
28
  __exportStar(require("./service/service"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umi",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.5",
4
4
  "description": "umi",
5
5
  "main": "dist/index.js",
6
6
  "module": "index.esm.js",
@@ -9,8 +9,12 @@
9
9
  "dist",
10
10
  "index.d.ts",
11
11
  "index.esm.js",
12
- "client"
12
+ "client",
13
+ "bin"
13
14
  ],
15
+ "bin": {
16
+ "umi": "bin/umi.js"
17
+ },
14
18
  "scripts": {
15
19
  "build": "pnpm tsc",
16
20
  "build:client": "pnpm tsc --project ./tsconfig.client.json",
@@ -31,10 +35,10 @@
31
35
  "access": "public"
32
36
  },
33
37
  "dependencies": {
34
- "@umijs/core": "4.0.0-beta.1",
35
- "@umijs/preset-built-in": "4.0.0-beta.1",
36
- "@umijs/renderer-react": "4.0.0-beta.1",
37
- "@umijs/utils": "4.0.0-beta.1",
38
+ "@umijs/core": "4.0.0-beta.5",
39
+ "@umijs/preset-built-in": "4.0.0-beta.5",
40
+ "@umijs/renderer-react": "4.0.0-beta.5",
41
+ "@umijs/utils": "4.0.0-beta.5",
38
42
  "v8-compile-cache": "2.3.0"
39
43
  }
40
44
  }