@gadmin2n/cli 0.0.124 → 0.0.125

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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gadmin2n/cli",
3
- "version": "0.0.124",
3
+ "version": "0.0.125",
4
4
  "description": "Gadmin - modern, fast, powerful node.js web framework (@cli)",
5
5
  "publishConfig": {
6
6
  "access": "public"