@gadmin2n/cli 0.0.124 → 0.0.126

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.
@@ -43,9 +43,9 @@ class NewAction extends abstract_action_1.AbstractAction {
43
43
  ? projectDirectory
44
44
  : (0, path_1.join)(process.cwd(), projectDirectory);
45
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);
46
+ // projectDirectory 已包含 appName(父目录 + appName),将其转为相对路径传给引擎。
47
+ if (directoryOption === null || directoryOption === void 0 ? void 0 : directoryOption.value) {
48
+ directoryOption.value = (0, path_1.relative)(process.cwd(), projectAbsDir);
49
49
  }
50
50
  yield generateApplicationFiles(inputs, options).catch(exports.exit);
51
51
  const shouldSkipInstall = options.some((option) => option.name === 'skip-install' && option.value === true);
@@ -198,8 +198,12 @@ exports.NewAction = NewAction;
198
198
  const getApplicationNameInput = (inputs) => inputs.find((input) => input.name === 'name');
199
199
  const getOptionByName = (inputs, option) => { var _a; return (_a = inputs.find((input) => input.name === option)) === null || _a === void 0 ? void 0 : _a.value; };
200
200
  const getProjectDirectory = (applicationName, directoryOption) => {
201
- return ((directoryOption && directoryOption.value) ||
202
- (0, formatting_1.normalizeToKebabOrSnakeCase)(applicationName.value));
201
+ const appName = (0, formatting_1.normalizeToKebabOrSnakeCase)(applicationName.value);
202
+ if (directoryOption === null || directoryOption === void 0 ? void 0 : directoryOption.value) {
203
+ // --directory 是父目录,项目实际创建在 <directory>/<appName> 下
204
+ return (0, path_1.join)(directoryOption.value, appName);
205
+ }
206
+ return appName;
203
207
  };
204
208
  const askForMissingInformation = (inputs, options) => __awaiter(void 0, void 0, void 0, function* () {
205
209
  console.info(ui_1.MESSAGES.PROJECT_INFORMATION_START);
@@ -33,8 +33,11 @@ class AbstractPackageManager {
33
33
  try {
34
34
  const commandArgs = `${this.cli.install} ${this.cli.silentFlag}`;
35
35
  const collect = true;
36
- const normalizedDirectory = (0, formatting_1.normalizeToKebabOrSnakeCase)(directory);
37
- yield this.runner.run(commandArgs, collect, (0, path_1.join)(process.cwd(), normalizedDirectory));
36
+ // 绝对路径直接使用;相对路径保持原有 kebab-case 规范化 + cwd 拼接逻辑
37
+ const resolvedDir = (0, path_1.isAbsolute)(directory)
38
+ ? directory
39
+ : (0, path_1.join)(process.cwd(), (0, formatting_1.normalizeToKebabOrSnakeCase)(directory));
40
+ yield this.runner.run(commandArgs, collect, resolvedDir);
38
41
  spinner.succeed();
39
42
  }
40
43
  catch (_a) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gadmin2n/cli",
3
- "version": "0.0.124",
3
+ "version": "0.0.126",
4
4
  "description": "Gadmin - modern, fast, powerful node.js web framework (@cli)",
5
5
  "publishConfig": {
6
6
  "access": "public"