@gadmin2n/cli 0.0.123 → 0.0.124
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/actions/new.action.js +9 -3
- package/package.json +1 -1
package/actions/new.action.js
CHANGED
|
@@ -36,14 +36,20 @@ class NewAction extends abstract_action_1.AbstractAction {
|
|
|
36
36
|
const isDryRunEnabled = dryRunOption && dryRunOption.value;
|
|
37
37
|
yield askForMissingInformation(inputs, options);
|
|
38
38
|
console.info();
|
|
39
|
-
|
|
40
|
-
const shouldSkipInstall = options.some((option) => option.name === 'skip-install' && option.value === true);
|
|
41
|
-
const shouldSkipGit = options.some((option) => option.name === 'skip-git' && option.value === true);
|
|
39
|
+
// 在调用 schematics 之前先解析项目目录
|
|
42
40
|
const projectDirectory = getProjectDirectory(getApplicationNameInput(inputs), directoryOption);
|
|
43
41
|
// 统一解析为绝对路径,确保 --directory /absolute/path 可以正常工作
|
|
44
42
|
const projectAbsDir = (0, path_1.isAbsolute)(projectDirectory)
|
|
45
43
|
? projectDirectory
|
|
46
44
|
: (0, path_1.join)(process.cwd(), projectDirectory);
|
|
45
|
+
// Angular DevKit schematics 引擎始终把 --directory 当作相对于 cwd 的路径处理。
|
|
46
|
+
// 若用户传入绝对路径,需转换为相对路径再传给引擎,否则会被重复拼接 cwd。
|
|
47
|
+
if ((directoryOption === null || directoryOption === void 0 ? void 0 : directoryOption.value) && (0, path_1.isAbsolute)(directoryOption.value)) {
|
|
48
|
+
directoryOption.value = (0, path_1.relative)(process.cwd(), directoryOption.value);
|
|
49
|
+
}
|
|
50
|
+
yield generateApplicationFiles(inputs, options).catch(exports.exit);
|
|
51
|
+
const shouldSkipInstall = options.some((option) => option.name === 'skip-install' && option.value === true);
|
|
52
|
+
const shouldSkipGit = options.some((option) => option.name === 'skip-git' && option.value === true);
|
|
47
53
|
// 落盘用户提供的环境配置(dry-run 模式跳过,因为目录可能未实际生成)
|
|
48
54
|
if (!isDryRunEnabled) {
|
|
49
55
|
yield applyEnvConfig(projectAbsDir, options).catch((err) => {
|