@colpu/cli 1.0.0 → 1.0.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/package.json +1 -1
- package/src/command/deploy.js +1 -3
- package/src/utils/index.js +9 -4
package/package.json
CHANGED
package/src/command/deploy.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: colpu
|
|
3
3
|
* @Date: 2025-03-29 17:57:34
|
|
4
4
|
* @LastEditors: colpu ycg520520@qq.com
|
|
5
|
-
* @LastEditTime: 2026-
|
|
5
|
+
* @LastEditTime: 2026-03-01 17:54:39
|
|
6
6
|
* @
|
|
7
7
|
* @Copyright (c) 2025 by colpu, All Rights Reserved.
|
|
8
8
|
*/
|
|
@@ -32,8 +32,6 @@ export default async function deploy(env, argv) {
|
|
|
32
32
|
program.parse();
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
let index = -1;
|
|
36
|
-
console.log(argv)
|
|
37
35
|
if (argv.includes("-g") || argv.includes("--generate")) {
|
|
38
36
|
const index = argv.indexOf("-g") || argv.indexOf("--generate");
|
|
39
37
|
argv.splice(index, 1);
|
package/src/utils/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: colpu
|
|
3
3
|
* @Date: 2025-03-29 19:38:16
|
|
4
4
|
* @LastEditors: colpu ycg520520@qq.com
|
|
5
|
-
* @LastEditTime: 2026-
|
|
5
|
+
* @LastEditTime: 2026-03-01 18:26:02
|
|
6
6
|
* @
|
|
7
7
|
* @Copyright (c) 2025 by colpu, All Rights Reserved.
|
|
8
8
|
*/
|
|
@@ -13,7 +13,6 @@ import { fileURLToPath } from "node:url";
|
|
|
13
13
|
import BuiltinModule from "node:module";
|
|
14
14
|
import debugFactory from "debug";
|
|
15
15
|
const debug = debugFactory("@colpu/cli:utils");
|
|
16
|
-
const DEFAULT_ENV = process.env.NODE_ENV || "development";
|
|
17
16
|
// Guard against poorly mocked module constructors.
|
|
18
17
|
const Module =
|
|
19
18
|
typeof module !== "undefined" && module.constructor.length > 1
|
|
@@ -114,10 +113,16 @@ export async function writeJSModuleToJSON(filepath, writepath) {
|
|
|
114
113
|
/**
|
|
115
114
|
* @function getConfig 获取配置
|
|
116
115
|
* @param {String} root 配置文件目录
|
|
117
|
-
* @param {
|
|
116
|
+
* @param {Object} options 配置选项
|
|
117
|
+
* @param {String} options.env 环境变量,默认为development
|
|
118
|
+
* @param {String} options.dir 配置文件目录,默认为src
|
|
118
119
|
* @returns {Promise<Object>} 配置
|
|
119
120
|
*/
|
|
120
|
-
export async function getConfig(root,
|
|
121
|
+
export async function getConfig(root, options = {}) {
|
|
122
|
+
const { env = "development", dir = "src" } = options;
|
|
123
|
+
if (!root) {
|
|
124
|
+
throw new Error("root is required");
|
|
125
|
+
}
|
|
121
126
|
root = fixFilepath(root);
|
|
122
127
|
console.time("加载config时间");
|
|
123
128
|
const pkg = readJSONSync(path.join(root, "package.json"));
|