@utoo/pack-cli 1.3.9-alpha.4 → 1.3.10-alpha.0

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.
@@ -46,6 +46,9 @@ const CONFIG_FILE_NAMES = [
46
46
  "utoopack.config.mjs",
47
47
  "utoopack.config.js",
48
48
  ];
49
+ function resolveOptionalPath(baseDir, value) {
50
+ return typeof value === "string" ? path_1.default.resolve(baseDir, value) : undefined;
51
+ }
49
52
  async function resolveFromConfigFile(configDir) {
50
53
  const resolvedDir = path_1.default.resolve(configDir);
51
54
  for (const name of CONFIG_FILE_NAMES) {
@@ -73,16 +76,21 @@ async function resolveFromConfigFile(configDir) {
73
76
  async function resolveBuildOptions(flags) {
74
77
  const { project, root, webpack } = flags;
75
78
  const cwd = process.cwd();
76
- let projectPath = path_1.default.resolve(cwd, project || cwd);
79
+ const configDir = path_1.default.resolve(cwd, project || "");
80
+ let projectPath = project ? path_1.default.resolve(cwd, project) : undefined;
77
81
  let rootPath = root ? path_1.default.resolve(cwd, root) : undefined;
78
82
  let projectOptions;
79
83
  if (webpack) {
80
84
  projectOptions = { webpackMode: true };
81
85
  }
82
86
  else {
83
- const configDir = path_1.default.resolve(cwd, project || "");
84
87
  const rawOptions = await resolveFromConfigFile(configDir);
85
- const { processEnv, watch, dev, buildId, packPath, rootPath: _rootPath, projectPath: _projectPath, ...config } = rawOptions;
88
+ const { processEnv, watch, dev, buildId, packPath, rootPath: configRootPath, projectPath: configProjectPath, ...config } = rawOptions;
89
+ projectPath =
90
+ projectPath ??
91
+ resolveOptionalPath(configDir, configProjectPath) ??
92
+ configDir;
93
+ rootPath = rootPath || resolveOptionalPath(configDir, configRootPath);
86
94
  projectOptions = {
87
95
  config,
88
96
  processEnv,
@@ -92,5 +100,5 @@ async function resolveBuildOptions(flags) {
92
100
  packPath,
93
101
  };
94
102
  }
95
- return { projectPath, rootPath, projectOptions };
103
+ return { projectPath: projectPath ?? configDir, rootPath, projectOptions };
96
104
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@utoo/pack-cli",
3
3
  "description": "Utoo pack cli",
4
- "version": "1.3.9-alpha.4",
4
+ "version": "1.3.10-alpha.0",
5
5
  "author": "xusd320",
6
6
  "bin": {
7
7
  "up": "./bin/run.js"
8
8
  },
9
9
  "dependencies": {
10
- "@utoo/pack": "1.3.9-alpha.4",
10
+ "@utoo/pack": "1.3.10-alpha.0",
11
11
  "citty": "^0.1.6"
12
12
  },
13
13
  "devDependencies": {