@utoo/pack-cli 1.2.0-rc.1 → 1.2.4

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/bin/run.js CHANGED
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // eslint-disable-next-line unicorn/prefer-top-level-await
4
- (async () => {
5
- const oclif = require("@oclif/core");
6
- await oclif.execute({ development: false, dir: __dirname });
7
- })();
3
+ const { run } = require("../cjs/index");
4
+ run();
5
+
@@ -0,0 +1,17 @@
1
+ declare const _default: import("citty").CommandDef<{
2
+ project: {
3
+ type: "string";
4
+ alias: string;
5
+ description: string;
6
+ };
7
+ root: {
8
+ type: "string";
9
+ alias: string;
10
+ description: string;
11
+ };
12
+ webpack: {
13
+ type: "boolean";
14
+ description: string;
15
+ };
16
+ }>;
17
+ export default _default;
@@ -33,21 +33,32 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- const core_1 = require("@oclif/core");
37
36
  const utooPack = __importStar(require("@utoo/pack"));
37
+ const citty_1 = require("citty");
38
38
  const common_1 = require("../utils/common");
39
- class Build extends core_1.Command {
40
- static description = "utoopack build";
41
- static examples = [
42
- `<%= config.bin %> <%= command.id %> build --project .`,
43
- `<%= config.bin %> <%= command.id %> build --project . --root ../..`,
44
- `<%= config.bin %> <%= command.id %> build --webpack`,
45
- ];
46
- static flags = common_1.commonFlags;
47
- async run() {
48
- const { flags } = await this.parse(Build);
49
- const { projectOptions, projectPath, rootPath } = (0, common_1.resolveBuildOptions)(flags);
39
+ exports.default = (0, citty_1.defineCommand)({
40
+ meta: {
41
+ name: "build",
42
+ description: "utoopack build",
43
+ },
44
+ args: {
45
+ project: {
46
+ type: "string",
47
+ alias: "p",
48
+ description: "Set the project path",
49
+ },
50
+ root: {
51
+ type: "string",
52
+ alias: "r",
53
+ description: "Set the root path",
54
+ },
55
+ webpack: {
56
+ type: "boolean",
57
+ description: "Enable webpack mode",
58
+ },
59
+ },
60
+ async run({ args }) {
61
+ const { projectOptions, projectPath, rootPath } = (0, common_1.resolveBuildOptions)(args);
50
62
  await utooPack.build(projectOptions, projectPath, rootPath);
51
- }
52
- }
53
- exports.default = Build;
63
+ },
64
+ });
@@ -0,0 +1,17 @@
1
+ declare const _default: import("citty").CommandDef<{
2
+ project: {
3
+ type: "string";
4
+ alias: string;
5
+ description: string;
6
+ };
7
+ root: {
8
+ type: "string";
9
+ alias: string;
10
+ description: string;
11
+ };
12
+ webpack: {
13
+ type: "boolean";
14
+ description: string;
15
+ };
16
+ }>;
17
+ export default _default;
@@ -33,24 +33,35 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- const core_1 = require("@oclif/core");
37
36
  const utooPack = __importStar(require("@utoo/pack"));
37
+ const citty_1 = require("citty");
38
38
  const common_1 = require("../utils/common");
39
- class Dev extends core_1.Command {
40
- static description = "utoopack dev";
41
- static examples = [
42
- `<%= config.bin %> <%= command.id %> dev --project .`,
43
- `<%= config.bin %> <%= command.id %> dev --project . --root ../..`,
44
- `<%= config.bin %> <%= command.id %> dev --webpack`,
45
- ];
46
- static flags = common_1.commonFlags;
47
- async run() {
48
- const { flags } = await this.parse(Dev);
49
- const { projectOptions, projectPath, rootPath } = (0, common_1.resolveBuildOptions)(flags);
39
+ exports.default = (0, citty_1.defineCommand)({
40
+ meta: {
41
+ name: "dev",
42
+ description: "utoopack dev",
43
+ },
44
+ args: {
45
+ project: {
46
+ type: "string",
47
+ alias: "p",
48
+ description: "Set the project path",
49
+ },
50
+ root: {
51
+ type: "string",
52
+ alias: "r",
53
+ description: "Set the root path",
54
+ },
55
+ webpack: {
56
+ type: "boolean",
57
+ description: "Enable webpack mode",
58
+ },
59
+ },
60
+ async run({ args }) {
61
+ const { projectOptions, projectPath, rootPath } = (0, common_1.resolveBuildOptions)(args);
50
62
  await utooPack.serve(projectOptions, projectPath, rootPath, {
51
63
  logServerInfo: true,
52
64
  port: 3000,
53
65
  });
54
- }
55
- }
56
- exports.default = Dev;
66
+ },
67
+ });
package/cjs/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const run: () => Promise<void>;
package/cjs/index.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.run = void 0;
7
+ const citty_1 = require("citty");
8
+ const build_1 = __importDefault(require("./commands/build"));
9
+ const dev_1 = __importDefault(require("./commands/dev"));
10
+ const main = (0, citty_1.defineCommand)({
11
+ meta: {
12
+ name: "up",
13
+ version: "0.0.0",
14
+ description: "Utoo pack cli",
15
+ },
16
+ subCommands: {
17
+ build: build_1.default,
18
+ dev: dev_1.default,
19
+ },
20
+ });
21
+ const run = () => (0, citty_1.runMain)(main);
22
+ exports.run = run;
@@ -0,0 +1,11 @@
1
+ import * as utooPack from "@utoo/pack";
2
+ export interface BuildOptions {
3
+ projectPath: string;
4
+ rootPath: string | undefined;
5
+ projectOptions: utooPack.WebpackConfig | utooPack.BundleOptions;
6
+ }
7
+ export declare function resolveBuildOptions(flags: {
8
+ project?: string;
9
+ root?: string;
10
+ webpack?: boolean;
11
+ }): BuildOptions;
@@ -3,30 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.commonFlags = void 0;
7
6
  exports.resolveBuildOptions = resolveBuildOptions;
8
- const core_1 = require("@oclif/core");
9
7
  const fs_1 = __importDefault(require("fs"));
10
8
  const path_1 = __importDefault(require("path"));
11
- exports.commonFlags = {
12
- project: core_1.Flags.string({
13
- char: "p",
14
- description: "Set the project path",
15
- required: false,
16
- aliases: ["projectPath"],
17
- }),
18
- root: core_1.Flags.string({
19
- char: "r",
20
- description: "Set the root path",
21
- required: false,
22
- aliases: ["rootPath"],
23
- }),
24
- webpack: core_1.Flags.boolean({
25
- name: "webpack",
26
- description: "Enable webpack mode",
27
- required: false,
28
- }),
29
- };
30
9
  function resolveBuildOptions(flags) {
31
10
  const { project, root, webpack } = flags;
32
11
  const cwd = process.cwd();
package/package.json CHANGED
@@ -1,18 +1,17 @@
1
1
  {
2
2
  "name": "@utoo/pack-cli",
3
3
  "description": "Utoo pack cli",
4
- "version": "1.2.0-rc.1",
4
+ "version": "1.2.4",
5
5
  "author": "xusd320",
6
6
  "bin": {
7
7
  "up": "./bin/run.js"
8
8
  },
9
9
  "dependencies": {
10
- "@oclif/core": "^4",
11
- "@utoo/pack": "1.2.0-rc.1"
10
+ "@utoo/pack": "1.2.4",
11
+ "citty": "^0.1.6"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@types/node": "^20.3.0",
15
- "oclif": "^4",
16
15
  "typescript": "^5"
17
16
  },
18
17
  "engines": {
@@ -20,28 +19,14 @@
20
19
  },
21
20
  "files": [
22
21
  "./bin",
23
- "./dist",
24
- "./oclif.manifest.json"
22
+ "./cjs"
25
23
  ],
26
24
  "license": "MIT",
27
- "main": "dist/index.js",
28
- "oclif": {
29
- "bin": "up",
30
- "commands": "./dist/commands",
31
- "topicSeparator": " ",
32
- "topics": {
33
- "build": {
34
- "description": "Build with production"
35
- },
36
- "dev": {
37
- "description": "Build with development and HMR"
38
- }
39
- }
40
- },
25
+ "main": "cjs/index.js",
41
26
  "scripts": {
42
- "build": "rm -rf dist && tsc -b",
43
- "clean": "rm -rf dist",
27
+ "build": "rm -rf cjs && tsc -b",
28
+ "clean": "rm -rf cjs",
44
29
  "prepublishOnly": "npm run build"
45
30
  },
46
- "types": "dist/index.d.ts"
31
+ "types": "cjs/index.d.ts"
47
32
  }
package/bin/dev.cmd DELETED
@@ -1,3 +0,0 @@
1
- @echo off
2
-
3
- node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
package/bin/dev.js DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node_modules/.bin/ts-node
2
- // eslint-disable-next-line node/shebang, unicorn/prefer-top-level-await
3
- (async () => {
4
- const oclif = require("@oclif/core");
5
- await oclif.execute({ development: true, dir: __dirname });
6
- })();
@@ -1,11 +0,0 @@
1
- import { Command } from "@oclif/core";
2
- export default class Build extends Command {
3
- static description: string;
4
- static examples: string[];
5
- static flags: {
6
- project: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
7
- root: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
- webpack: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
- };
10
- run(): Promise<void>;
11
- }
@@ -1,11 +0,0 @@
1
- import { Command } from "@oclif/core";
2
- export default class Dev extends Command {
3
- static description: string;
4
- static examples: string[];
5
- static flags: {
6
- project: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
7
- root: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
- webpack: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
- };
10
- run(): Promise<void>;
11
- }
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { run } from "@oclif/core";
package/dist/index.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.run = void 0;
4
- var core_1 = require("@oclif/core");
5
- Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
@@ -1,16 +0,0 @@
1
- import * as utooPack from "@utoo/pack";
2
- export declare const commonFlags: {
3
- project: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
4
- root: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
5
- webpack: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
- };
7
- export interface BuildOptions {
8
- projectPath: string;
9
- rootPath: string | undefined;
10
- projectOptions: utooPack.WebpackConfig | utooPack.BundleOptions;
11
- }
12
- export declare function resolveBuildOptions(flags: {
13
- project?: string;
14
- root?: string;
15
- webpack?: boolean;
16
- }): BuildOptions;