@fluojs/cli 1.0.0-beta.2 → 1.0.0-beta.3
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/README.ko.md +5 -2
- package/README.md +5 -2
- package/dist/commands/inspect.d.ts.map +1 -1
- package/dist/commands/inspect.js +5 -1
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +4 -0
- package/dist/generators/controller.d.ts +7 -0
- package/dist/generators/controller.d.ts.map +1 -1
- package/dist/generators/controller.js +8 -0
- package/dist/generators/guard.d.ts +6 -0
- package/dist/generators/guard.d.ts.map +1 -1
- package/dist/generators/guard.js +7 -0
- package/dist/generators/interceptor.d.ts +6 -0
- package/dist/generators/interceptor.d.ts.map +1 -1
- package/dist/generators/interceptor.js +7 -0
- package/dist/generators/middleware.d.ts +6 -0
- package/dist/generators/middleware.d.ts.map +1 -1
- package/dist/generators/middleware.js +7 -0
- package/dist/generators/module.d.ts +22 -0
- package/dist/generators/module.d.ts.map +1 -1
- package/dist/generators/module.js +25 -0
- package/dist/generators/render.d.ts +7 -0
- package/dist/generators/render.d.ts.map +1 -1
- package/dist/generators/render.js +8 -0
- package/dist/generators/repository.d.ts +7 -0
- package/dist/generators/repository.d.ts.map +1 -1
- package/dist/generators/repository.js +8 -0
- package/dist/generators/request-dto.d.ts +6 -0
- package/dist/generators/request-dto.d.ts.map +1 -1
- package/dist/generators/request-dto.js +7 -0
- package/dist/generators/response-dto.d.ts +6 -0
- package/dist/generators/response-dto.d.ts.map +1 -1
- package/dist/generators/response-dto.js +7 -0
- package/dist/generators/service.d.ts +7 -0
- package/dist/generators/service.d.ts.map +1 -1
- package/dist/generators/service.js +8 -0
- package/dist/generators/utils.d.ts +18 -0
- package/dist/generators/utils.d.ts.map +1 -1
- package/dist/generators/utils.js +20 -0
- package/dist/help.d.ts +13 -0
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/new/package-spec-resolver.d.ts +7 -0
- package/dist/new/package-spec-resolver.d.ts.map +1 -1
- package/dist/new/package-spec-resolver.js +8 -0
- package/dist/new/prompt.d.ts.map +1 -1
- package/dist/new/prompt.js +5 -3
- package/dist/prompt-cancel.d.ts +44 -0
- package/dist/prompt-cancel.d.ts.map +1 -0
- package/dist/prompt-cancel.js +49 -0
- package/dist/transforms/nestjs-migrate.d.ts +48 -0
- package/dist/transforms/nestjs-migrate.d.ts.map +1 -1
- package/dist/transforms/nestjs-migrate.js +62 -0
- package/dist/update-check.d.ts +32 -0
- package/dist/update-check.d.ts.map +1 -1
- package/dist/update-check.js +125 -6
- package/package.json +3 -3
package/README.ko.md
CHANGED
|
@@ -30,12 +30,12 @@ pnpm dlx @fluojs/cli new my-app
|
|
|
30
30
|
## 릴리스 계약
|
|
31
31
|
|
|
32
32
|
- `@fluojs/cli`는 intended publish surface에 포함되는 공개 패키지입니다.
|
|
33
|
-
- 지원되는 설치 경로는 전역 패키지(`pnpm add -g @fluojs/cli`)와 무설치 실행 경로(`pnpm dlx @fluojs/cli ...`)입니다.
|
|
33
|
+
- 지원되는 설치 경로는 전역 패키지(`npm install -g @fluojs/cli`, `pnpm add -g @fluojs/cli`, `bun add -g @fluojs/cli`, `yarn global add @fluojs/cli`)와 무설치 실행 경로(`pnpm dlx @fluojs/cli ...`)입니다.
|
|
34
34
|
- 배포되는 `fluo` bin은 `package.json`에 선언된 dist 빌드 CLI 엔트리포인트를 기준으로 동작합니다.
|
|
35
35
|
|
|
36
36
|
## 업데이트 확인
|
|
37
37
|
|
|
38
|
-
`fluo`가 interactive TTY에서 실행되면 로컬 캐시를 사용해 공개 npm `latest` dist-tag의 `@fluojs/cli` 버전을 확인하므로 매 invocation마다 registry를 호출하지 않습니다. 더 새로운 버전이 있으면 CLI가 설치 여부를 묻습니다. 거절하면 현재 설치된 버전으로 기존 명령을 계속 실행하고, 승인하면 `pnpm add -g
|
|
38
|
+
`fluo`가 interactive TTY에서 실행되면 로컬 캐시를 사용해 공개 npm `latest` dist-tag의 `@fluojs/cli` 버전을 확인하므로 매 invocation마다 registry를 호출하지 않습니다. 더 새로운 버전이 있으면 CLI가 설치 여부를 묻습니다. 거절하면 현재 설치된 버전으로 기존 명령을 계속 실행하고, 승인하면 현재 설치를 소유한 것으로 보이는 package manager의 전역 업데이트 명령(`npm install -g`, `pnpm add -g`, `bun add -g`, `yarn global add`)을 사용한 뒤 같은 인자로 업데이트된 `fluo` 바이너리를 다시 시작합니다. 설치 도구를 추론할 수 없으면 Node.js 기본 전역 설치 경로를 소유하는 npm 기준으로 `npm install -g @fluojs/cli@<latest>`를 fallback으로 사용합니다.
|
|
39
39
|
|
|
40
40
|
업데이트 확인은 CI, non-TTY 출력, npm-script context, 업데이트 후 재실행 context, registry/network 실패, 명시적 opt-out 경로에서는 건너뜁니다. 한 번만 끄려면 `--no-update-check`(또는 compatibility alias `--no-update-notifier`)를 사용하고, 자동화에서 절대 prompt가 뜨면 안 되는 경우에는 `FLUO_NO_UPDATE_CHECK=1`을 설정하세요.
|
|
41
41
|
|
|
@@ -184,8 +184,11 @@ Studio가 없으면 CI와 non-interactive 실행은 prompt나 package manager
|
|
|
184
184
|
|---|---|
|
|
185
185
|
| `runCli(argv?, options?)` | 모든 CLI 명령을 실행하는 메인 진입점입니다. |
|
|
186
186
|
| `runNewCommand(argv, options?)` | 프로젝트 스캐폴딩 로직에 대한 프로그래밍적 접근을 제공합니다. |
|
|
187
|
+
| `CliPromptCancelledError` | 호출자가 제공한 prompt hook이 정상 취소를 알리기 위해 throw할 수 있는 안정적인 sentinel입니다. |
|
|
187
188
|
| `GeneratorKind` | 지원되는 모든 생성기 유형(예: `'controller'`, `'service'`)의 유니온 타입입니다. |
|
|
188
189
|
|
|
190
|
+
프로그래밍 방식 진입점은 호출자 프로세스의 소유권을 보존합니다. `runCli(...)`와 `runNewCommand(...)`는 `process.exit(...)`를 호출하지 않고 숫자 exit code를 반환하며, prompt 취소는 command runner를 통해 exit code `0`으로 해석됩니다. dependency 설치나 git 초기화 같은 setup 작업은 해석된 `fluo new` 옵션이 요청한 경우에만 실행됩니다. 호출자가 제공한 prompt hook은 공개 패키지 엔트리포인트의 `CliPromptCancelledError`를 throw해 CLI 내부 파일에 의존하지 않고 정상 취소를 표현할 수 있습니다.
|
|
191
|
+
|
|
189
192
|
## 관련 패키지
|
|
190
193
|
|
|
191
194
|
- **[@fluojs/runtime](../runtime/README.ko.md)**: 부트스트랩 안전 런타임 검사 중 inspection snapshot을 생산하는 기본 엔진입니다.
|
package/README.md
CHANGED
|
@@ -30,12 +30,12 @@ pnpm dlx @fluojs/cli new my-app
|
|
|
30
30
|
## Release Contract
|
|
31
31
|
|
|
32
32
|
- `@fluojs/cli` is a public package in the intended publish surface.
|
|
33
|
-
- The supported install paths are the global package (`pnpm add -g @fluojs/cli`) and the no-install runner (`pnpm dlx @fluojs/cli ...`).
|
|
33
|
+
- The supported install paths are the global package (`npm install -g @fluojs/cli`, `pnpm add -g @fluojs/cli`, `bun add -g @fluojs/cli`, or `yarn global add @fluojs/cli`) and the no-install runner (`pnpm dlx @fluojs/cli ...`).
|
|
34
34
|
- The published `fluo` bin is backed by the dist-built CLI entrypoint declared in `package.json`.
|
|
35
35
|
|
|
36
36
|
## Update Checks
|
|
37
37
|
|
|
38
|
-
When `fluo` runs in an interactive TTY, it checks the public npm `latest` dist-tag for `@fluojs/cli` using a local cache so every invocation does not hit the registry. If a newer version is available, the CLI asks whether to install it. Declining continues the current command with the installed version; accepting
|
|
38
|
+
When `fluo` runs in an interactive TTY, it checks the public npm `latest` dist-tag for `@fluojs/cli` using a local cache so every invocation does not hit the registry. If a newer version is available, the CLI asks whether to install it. Declining continues the current command with the installed version; accepting updates the global CLI with the package manager that appears to own the current installation (`npm install -g`, `pnpm add -g`, `bun add -g`, or `yarn global add`) and then restarts `fluo` with the same arguments under the updated binary. If the installer cannot be inferred, the CLI falls back to `npm install -g @fluojs/cli@<latest>` because npm owns the default Node.js global installation path.
|
|
39
39
|
|
|
40
40
|
The update check is skipped in CI, non-TTY output, npm-script contexts, rerun-after-update contexts, registry/network failures, and explicit opt-out paths. Use `--no-update-check` (or the compatibility alias `--no-update-notifier`) for one invocation, or set `FLUO_NO_UPDATE_CHECK=1` when automation must never prompt.
|
|
41
41
|
|
|
@@ -184,8 +184,11 @@ The package can be used programmatically to trigger CLI actions from within othe
|
|
|
184
184
|
|---|---|
|
|
185
185
|
| `runCli(argv?, options?)` | Main entry point to execute any CLI command. |
|
|
186
186
|
| `runNewCommand(argv, options?)` | Programmatic access to the project scaffolding logic. |
|
|
187
|
+
| `CliPromptCancelledError` | Stable sentinel that caller-supplied prompt hooks can throw to report normal cancellation. |
|
|
187
188
|
| `GeneratorKind` | Union type of all supported generator types (e.g., `'controller'`, `'service'`). |
|
|
188
189
|
|
|
190
|
+
Programmatic entry points preserve caller process ownership. `runCli(...)` and `runNewCommand(...)` return numeric exit codes instead of calling `process.exit(...)`; prompt cancellation resolves as exit code `0` through the command runner, and setup actions such as dependency installation or git initialization only run when the resolved `fluo new` options request them. Caller-supplied prompt hooks can throw `CliPromptCancelledError` from the public package entrypoint to express normal cancellation without depending on CLI-internal files.
|
|
191
|
+
|
|
189
192
|
## Related Packages
|
|
190
193
|
|
|
191
194
|
- **[@fluojs/runtime](../runtime/README.md)**: The underlying engine that produces inspection snapshots during bootstrap-safe runtime inspection.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/commands/inspect.ts"],"names":[],"mappings":"AAMA,OAAO,EAML,KAAK,qBAAqB,EAE3B,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/commands/inspect.ts"],"names":[],"mappings":"AAMA,OAAO,EAML,KAAK,qBAAqB,EAE3B,MAAM,iBAAiB,CAAC;AAKzB,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,CAAC,IAAI,IAAI,CAAC;IACf,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnE,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,KAAK,qBAAqB,GAAG,CAAC,QAAQ,EAAE,qBAAqB,KAAK,MAAM,CAAC;AAEzE,KAAK,2BAA2B,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC;AAE/F;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,yEAAyE;IACzE,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yEAAyE;IACzE,yBAAyB,CAAC,EAAE,2BAA2B,CAAC;IACxD,wFAAwF;IACxF,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,sCAAsC;IACtC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,yCAAyC;IACzC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAkFD;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAarC;AA+PD;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,4BAAiC,GAAG,OAAO,CAAC,MAAM,CAAC,CA4EnH"}
|
package/dist/commands/inspect.js
CHANGED
|
@@ -5,6 +5,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
5
5
|
import * as clack from '@clack/prompts';
|
|
6
6
|
import { FluoFactory, PLATFORM_SHELL } from '@fluojs/runtime';
|
|
7
7
|
import { renderAliasList, renderHelpTable } from '../help.js';
|
|
8
|
+
import { CliPromptCancelledError, isCliPromptCancelledError } from '../prompt-cancel.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Runtime options for the inspect command when used programmatically.
|
|
@@ -210,7 +211,7 @@ function createInspectPrompter() {
|
|
|
210
211
|
});
|
|
211
212
|
if (clack.isCancel(result)) {
|
|
212
213
|
clack.cancel('Operation cancelled.');
|
|
213
|
-
|
|
214
|
+
throw new CliPromptCancelledError();
|
|
214
215
|
}
|
|
215
216
|
return result;
|
|
216
217
|
}
|
|
@@ -332,6 +333,9 @@ export async function runInspectCommand(argv, runtime = {}) {
|
|
|
332
333
|
}
|
|
333
334
|
return 0;
|
|
334
335
|
} catch (error) {
|
|
336
|
+
if (isCliPromptCancelledError(error)) {
|
|
337
|
+
return 0;
|
|
338
|
+
}
|
|
335
339
|
const message = error instanceof Error ? error.message : String(error);
|
|
336
340
|
stderr.write(`${message}\n`);
|
|
337
341
|
return 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../src/commands/new.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../src/commands/new.ts"],"names":[],"mappings":"AAOA,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAWnF,OAAO,KAAK,EAAoB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE3E,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC,CAAC;AAuBF;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA0UD;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,MAAM,CA0BjC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,MAAM,CAAC,CA4G3G"}
|
package/dist/commands/new.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
2
|
import { spinner as clackSpinner, log as clackLog } from '@clack/prompts';
|
|
3
3
|
import { renderAliasList, renderHelpTable } from '../help.js';
|
|
4
|
+
import { isCliPromptCancelledError } from '../prompt-cancel.js';
|
|
4
5
|
import { installDependencies } from '../new/install.js';
|
|
5
6
|
import { collectBootstrapAnswers } from '../new/prompt.js';
|
|
6
7
|
import { resolveBootstrapPlan } from '../new/resolver.js';
|
|
@@ -366,6 +367,9 @@ export async function runNewCommand(argv, runtime = {}) {
|
|
|
366
367
|
stdout.write(`Next steps:\n cd ${answers.targetDirectory}\n ${answers.packageManager === 'npm' ? 'npm run dev' : answers.packageManager === 'bun' ? 'bun run dev' : `${answers.packageManager} dev`}\n`);
|
|
367
368
|
return 0;
|
|
368
369
|
} catch (error) {
|
|
370
|
+
if (isCliPromptCancelledError(error)) {
|
|
371
|
+
return 0;
|
|
372
|
+
}
|
|
369
373
|
const message = error instanceof Error ? error.message : String(error);
|
|
370
374
|
stderr.write(`${message}\n`);
|
|
371
375
|
return 1;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { GenerateOptions, GeneratedFile } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate controller files.
|
|
4
|
+
*
|
|
5
|
+
* @param name The name.
|
|
6
|
+
* @param options The options.
|
|
7
|
+
* @returns The generate controller files result.
|
|
8
|
+
*/
|
|
2
9
|
export declare function generateControllerFiles(name: string, options?: GenerateOptions): GeneratedFile[];
|
|
3
10
|
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/generators/controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKlE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,aAAa,EAAE,CAkBpG"}
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/generators/controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKlE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,aAAa,EAAE,CAkBpG"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { renderTemplate } from './render.js';
|
|
2
2
|
import { toKebabCase, toPascalCase } from './utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate controller files.
|
|
6
|
+
*
|
|
7
|
+
* @param name The name.
|
|
8
|
+
* @param options The options.
|
|
9
|
+
* @returns The generate controller files result.
|
|
10
|
+
*/
|
|
3
11
|
export function generateControllerFiles(name, options = {}) {
|
|
4
12
|
const kebab = toKebabCase(name);
|
|
5
13
|
const resource = toPascalCase(name);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { GeneratedFile } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate guard files.
|
|
4
|
+
*
|
|
5
|
+
* @param name The name.
|
|
6
|
+
* @returns The generate guard files result.
|
|
7
|
+
*/
|
|
2
8
|
export declare function generateGuardFiles(name: string): GeneratedFile[];
|
|
3
9
|
//# sourceMappingURL=guard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/generators/guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAShE"}
|
|
1
|
+
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/generators/guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAShE"}
|
package/dist/generators/guard.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { renderTemplate } from './render.js';
|
|
2
2
|
import { toKebabCase, toPascalCase } from './utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate guard files.
|
|
6
|
+
*
|
|
7
|
+
* @param name The name.
|
|
8
|
+
* @returns The generate guard files result.
|
|
9
|
+
*/
|
|
3
10
|
export function generateGuardFiles(name) {
|
|
4
11
|
const kebab = toKebabCase(name);
|
|
5
12
|
const resource = toPascalCase(name);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { GeneratedFile } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate interceptor files.
|
|
4
|
+
*
|
|
5
|
+
* @param name The name.
|
|
6
|
+
* @returns The generate interceptor files result.
|
|
7
|
+
*/
|
|
2
8
|
export declare function generateInterceptorFiles(name: string): GeneratedFile[];
|
|
3
9
|
//# sourceMappingURL=interceptor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../../src/generators/interceptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAStE"}
|
|
1
|
+
{"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../../src/generators/interceptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAStE"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { renderTemplate } from './render.js';
|
|
2
2
|
import { toKebabCase, toPascalCase } from './utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate interceptor files.
|
|
6
|
+
*
|
|
7
|
+
* @param name The name.
|
|
8
|
+
* @returns The generate interceptor files result.
|
|
9
|
+
*/
|
|
3
10
|
export function generateInterceptorFiles(name) {
|
|
4
11
|
const kebab = toKebabCase(name);
|
|
5
12
|
const resource = toPascalCase(name);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { GeneratedFile } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate middleware files.
|
|
4
|
+
*
|
|
5
|
+
* @param name The name.
|
|
6
|
+
* @returns The generate middleware files result.
|
|
7
|
+
*/
|
|
2
8
|
export declare function generateMiddlewareFiles(name: string): GeneratedFile[];
|
|
3
9
|
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/generators/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CASrE"}
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/generators/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CASrE"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { renderTemplate } from './render.js';
|
|
2
2
|
import { toKebabCase, toPascalCase } from './utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate middleware files.
|
|
6
|
+
*
|
|
7
|
+
* @param name The name.
|
|
8
|
+
* @returns The generate middleware files result.
|
|
9
|
+
*/
|
|
3
10
|
export function generateMiddlewareFiles(name) {
|
|
4
11
|
const kebab = toKebabCase(name);
|
|
5
12
|
const resource = toPascalCase(name);
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import type { GeneratedFile } from '../types.js';
|
|
2
2
|
import type { ModuleArrayKey } from './manifest.js';
|
|
3
|
+
/**
|
|
4
|
+
* Ensure module import.
|
|
5
|
+
*
|
|
6
|
+
* @param source The source.
|
|
7
|
+
* @param className The class name.
|
|
8
|
+
* @param importPath The import path.
|
|
9
|
+
* @returns The ensure module import result.
|
|
10
|
+
*/
|
|
3
11
|
export declare function ensureModuleImport(source: string, className: string, importPath: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Generate module files.
|
|
14
|
+
*
|
|
15
|
+
* @param name The name.
|
|
16
|
+
* @returns The generate module files result.
|
|
17
|
+
*/
|
|
4
18
|
export declare function generateModuleFiles(name: string): GeneratedFile[];
|
|
19
|
+
/**
|
|
20
|
+
* Register in module.
|
|
21
|
+
*
|
|
22
|
+
* @param source The source.
|
|
23
|
+
* @param arrayKey The array key.
|
|
24
|
+
* @param className The class name.
|
|
25
|
+
* @returns The register in module result.
|
|
26
|
+
*/
|
|
5
27
|
export declare function registerInModule(source: string, arrayKey: ModuleArrayKey, className: string): string;
|
|
6
28
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/generators/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA6FpD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAyDhG;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAUjE;AAwDD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpG"}
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/generators/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA6FpD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAyDhG;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAUjE;AAwDD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpG"}
|
|
@@ -64,6 +64,15 @@ function findNamedImportSource(sourceFile, className) {
|
|
|
64
64
|
function buildImportDeclaration(className, importPath) {
|
|
65
65
|
return ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier(className))])), ts.factory.createStringLiteral(`./${importPath}`));
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Ensure module import.
|
|
70
|
+
*
|
|
71
|
+
* @param source The source.
|
|
72
|
+
* @param className The class name.
|
|
73
|
+
* @param importPath The import path.
|
|
74
|
+
* @returns The ensure module import result.
|
|
75
|
+
*/
|
|
67
76
|
export function ensureModuleImport(source, className, importPath) {
|
|
68
77
|
const sourceFile = parseSource(source);
|
|
69
78
|
const moduleSpecifier = `./${importPath}`;
|
|
@@ -96,6 +105,13 @@ export function ensureModuleImport(source, className, importPath) {
|
|
|
96
105
|
}
|
|
97
106
|
return `${newImportLine}\n${source}`;
|
|
98
107
|
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Generate module files.
|
|
111
|
+
*
|
|
112
|
+
* @param name The name.
|
|
113
|
+
* @returns The generate module files result.
|
|
114
|
+
*/
|
|
99
115
|
export function generateModuleFiles(name) {
|
|
100
116
|
const kebab = toKebabCase(name);
|
|
101
117
|
const pascal = `${toPascalCase(name)}Module`;
|
|
@@ -138,6 +154,15 @@ function insertIntoModuleArray(source, arrayKey, className) {
|
|
|
138
154
|
const updatedModuleMetadata = ts.factory.updateObjectLiteralExpression(moduleMetadata, updatedProperties);
|
|
139
155
|
return replaceNodeText(source, sourceFile, moduleMetadata, printer.printNode(ts.EmitHint.Unspecified, updatedModuleMetadata, sourceFile));
|
|
140
156
|
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Register in module.
|
|
160
|
+
*
|
|
161
|
+
* @param source The source.
|
|
162
|
+
* @param arrayKey The array key.
|
|
163
|
+
* @param className The class name.
|
|
164
|
+
* @returns The register in module result.
|
|
165
|
+
*/
|
|
141
166
|
export function registerInModule(source, arrayKey, className) {
|
|
142
167
|
return insertIntoModuleArray(source, arrayKey, className);
|
|
143
168
|
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render template.
|
|
3
|
+
*
|
|
4
|
+
* @param templateName The template name.
|
|
5
|
+
* @param vars The vars.
|
|
6
|
+
* @returns The render template result.
|
|
7
|
+
*/
|
|
1
8
|
export declare function renderTemplate(templateName: string, vars: Record<string, unknown>): string;
|
|
2
9
|
//# sourceMappingURL=render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/generators/render.ts"],"names":[],"mappings":"AAQA,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAU1F"}
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/generators/render.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAU1F"}
|
|
@@ -4,6 +4,14 @@ import { fileURLToPath } from 'node:url';
|
|
|
4
4
|
import ejs from 'ejs';
|
|
5
5
|
const templatesDir = join(dirname(fileURLToPath(import.meta.url)), 'templates');
|
|
6
6
|
const templateCache = new Map();
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Render template.
|
|
10
|
+
*
|
|
11
|
+
* @param templateName The template name.
|
|
12
|
+
* @param vars The vars.
|
|
13
|
+
* @returns The render template result.
|
|
14
|
+
*/
|
|
7
15
|
export function renderTemplate(templateName, vars) {
|
|
8
16
|
const templatePath = join(templatesDir, templateName);
|
|
9
17
|
let template = templateCache.get(templatePath);
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { GenerateOptions, GeneratedFile } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate repo files.
|
|
4
|
+
*
|
|
5
|
+
* @param name The name.
|
|
6
|
+
* @param _options The options.
|
|
7
|
+
* @returns The generate repo files result.
|
|
8
|
+
*/
|
|
2
9
|
export declare function generateRepoFiles(name: string, _options?: GenerateOptions): GeneratedFile[];
|
|
3
10
|
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/generators/repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKlE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,eAAoB,GAAG,aAAa,EAAE,CAmB/F"}
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/generators/repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKlE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,eAAoB,GAAG,aAAa,EAAE,CAmB/F"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { renderTemplate } from './render.js';
|
|
2
2
|
import { toKebabCase, toPascalCase } from './utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate repo files.
|
|
6
|
+
*
|
|
7
|
+
* @param name The name.
|
|
8
|
+
* @param _options The options.
|
|
9
|
+
* @returns The generate repo files result.
|
|
10
|
+
*/
|
|
3
11
|
export function generateRepoFiles(name, _options = {}) {
|
|
4
12
|
const kebab = toKebabCase(name);
|
|
5
13
|
const resource = toPascalCase(name);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { GeneratedFile } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate request dto files.
|
|
4
|
+
*
|
|
5
|
+
* @param name The name.
|
|
6
|
+
* @returns The generate request dto files result.
|
|
7
|
+
*/
|
|
2
8
|
export declare function generateRequestDtoFiles(name: string): GeneratedFile[];
|
|
3
9
|
//# sourceMappingURL=request-dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-dto.d.ts","sourceRoot":"","sources":["../../src/generators/request-dto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAYrE"}
|
|
1
|
+
{"version":3,"file":"request-dto.d.ts","sourceRoot":"","sources":["../../src/generators/request-dto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAYrE"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { renderTemplate } from './render.js';
|
|
2
2
|
import { toKebabCase, toPascalCase } from './utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate request dto files.
|
|
6
|
+
*
|
|
7
|
+
* @param name The name.
|
|
8
|
+
* @returns The generate request dto files result.
|
|
9
|
+
*/
|
|
3
10
|
export function generateRequestDtoFiles(name) {
|
|
4
11
|
const kebab = toKebabCase(name);
|
|
5
12
|
const resource = toPascalCase(name);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { GeneratedFile } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate response dto files.
|
|
4
|
+
*
|
|
5
|
+
* @param name The name.
|
|
6
|
+
* @returns The generate response dto files result.
|
|
7
|
+
*/
|
|
2
8
|
export declare function generateResponseDtoFiles(name: string): GeneratedFile[];
|
|
3
9
|
//# sourceMappingURL=response-dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-dto.d.ts","sourceRoot":"","sources":["../../src/generators/response-dto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAYtE"}
|
|
1
|
+
{"version":3,"file":"response-dto.d.ts","sourceRoot":"","sources":["../../src/generators/response-dto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAYtE"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { renderTemplate } from './render.js';
|
|
2
2
|
import { toKebabCase, toPascalCase } from './utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate response dto files.
|
|
6
|
+
*
|
|
7
|
+
* @param name The name.
|
|
8
|
+
* @returns The generate response dto files result.
|
|
9
|
+
*/
|
|
3
10
|
export function generateResponseDtoFiles(name) {
|
|
4
11
|
const kebab = toKebabCase(name);
|
|
5
12
|
const resource = toPascalCase(name);
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { GenerateOptions, GeneratedFile } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate service files.
|
|
4
|
+
*
|
|
5
|
+
* @param name The name.
|
|
6
|
+
* @param _options The options.
|
|
7
|
+
* @returns The generate service files result.
|
|
8
|
+
*/
|
|
2
9
|
export declare function generateServiceFiles(name: string, _options?: GenerateOptions): GeneratedFile[];
|
|
3
10
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/generators/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKlE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,eAAoB,GAAG,aAAa,EAAE,CAkBlG"}
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/generators/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKlE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,eAAoB,GAAG,aAAa,EAAE,CAkBlG"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { renderTemplate } from './render.js';
|
|
2
2
|
import { toKebabCase, toPascalCase } from './utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate service files.
|
|
6
|
+
*
|
|
7
|
+
* @param name The name.
|
|
8
|
+
* @param _options The options.
|
|
9
|
+
* @returns The generate service files result.
|
|
10
|
+
*/
|
|
3
11
|
export function generateServiceFiles(name, _options = {}) {
|
|
4
12
|
const kebab = toKebabCase(name);
|
|
5
13
|
const resource = toPascalCase(name);
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* To kebab case.
|
|
3
|
+
*
|
|
4
|
+
* @param value The value.
|
|
5
|
+
* @returns The to kebab case result.
|
|
6
|
+
*/
|
|
1
7
|
export declare function toKebabCase(value: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* To pascal case.
|
|
10
|
+
*
|
|
11
|
+
* @param value The value.
|
|
12
|
+
* @returns The to pascal case result.
|
|
13
|
+
*/
|
|
2
14
|
export declare function toPascalCase(value: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* To plural.
|
|
17
|
+
*
|
|
18
|
+
* @param value The value.
|
|
19
|
+
* @returns The to plural result.
|
|
20
|
+
*/
|
|
3
21
|
export declare function toPlural(value: string): string;
|
|
4
22
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/generators/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAa9C"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/generators/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAa9C"}
|
package/dist/generators/utils.js
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* To kebab case.
|
|
3
|
+
*
|
|
4
|
+
* @param value The value.
|
|
5
|
+
* @returns The to kebab case result.
|
|
6
|
+
*/
|
|
1
7
|
export function toKebabCase(value) {
|
|
2
8
|
return value.replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/[_\s]+/g, '-').replace(/-+/g, '-').toLowerCase();
|
|
3
9
|
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* To pascal case.
|
|
13
|
+
*
|
|
14
|
+
* @param value The value.
|
|
15
|
+
* @returns The to pascal case result.
|
|
16
|
+
*/
|
|
4
17
|
export function toPascalCase(value) {
|
|
5
18
|
return toKebabCase(value).split('-').filter(Boolean).map(segment => segment[0].toUpperCase() + segment.slice(1)).join('');
|
|
6
19
|
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* To plural.
|
|
23
|
+
*
|
|
24
|
+
* @param value The value.
|
|
25
|
+
* @returns The to plural result.
|
|
26
|
+
*/
|
|
7
27
|
export function toPlural(value) {
|
|
8
28
|
if (value.endsWith('s') || value.endsWith('x') || value.endsWith('z') || value.endsWith('ch') || value.endsWith('sh')) {
|
|
9
29
|
return `${value}es`;
|
package/dist/help.d.ts
CHANGED
|
@@ -2,7 +2,20 @@ type HelpTableColumn<Row> = {
|
|
|
2
2
|
header: string;
|
|
3
3
|
render: (row: Row) => string;
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* Render alias list.
|
|
7
|
+
*
|
|
8
|
+
* @param aliases The aliases.
|
|
9
|
+
* @returns The render alias list result.
|
|
10
|
+
*/
|
|
5
11
|
export declare function renderAliasList(aliases: string[]): string;
|
|
12
|
+
/**
|
|
13
|
+
* Render help table.
|
|
14
|
+
*
|
|
15
|
+
* @param rows The rows.
|
|
16
|
+
* @param columns The columns.
|
|
17
|
+
* @returns The render help table result.
|
|
18
|
+
*/
|
|
6
19
|
export declare function renderHelpTable<Row>(rows: Row[], columns: HelpTableColumn<Row>[]): string;
|
|
7
20
|
export {};
|
|
8
21
|
//# sourceMappingURL=help.d.ts.map
|
package/dist/help.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,CAAC,GAAG,IAAI;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;CAC9B,CAAC;AAUF,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAEzD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,CAazF"}
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,CAAC,GAAG,IAAI;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;CAC9B,CAAC;AAUF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAEzD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,CAazF"}
|
package/dist/help.js
CHANGED
|
@@ -4,9 +4,24 @@ function border(widths) {
|
|
|
4
4
|
function renderRow(values, widths) {
|
|
5
5
|
return `| ${values.map((value, index) => value.padEnd(widths[index] ?? 0)).join(' | ')} |`;
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Render alias list.
|
|
10
|
+
*
|
|
11
|
+
* @param aliases The aliases.
|
|
12
|
+
* @returns The render alias list result.
|
|
13
|
+
*/
|
|
7
14
|
export function renderAliasList(aliases) {
|
|
8
15
|
return aliases.length === 0 ? '-' : aliases.join(', ');
|
|
9
16
|
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Render help table.
|
|
20
|
+
*
|
|
21
|
+
* @param rows The rows.
|
|
22
|
+
* @param columns The columns.
|
|
23
|
+
* @returns The render help table result.
|
|
24
|
+
*/
|
|
10
25
|
export function renderHelpTable(rows, columns) {
|
|
11
26
|
const widths = columns.map(column => {
|
|
12
27
|
const values = rows.map(row => column.render(row));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { runCli, type CliRuntimeOptions } from './cli.js';
|
|
2
2
|
export { newUsage, runNewCommand, type NewCommandRuntimeOptions } from './commands/new.js';
|
|
3
|
+
export { CliPromptCancelledError } from './prompt-cancel.js';
|
|
3
4
|
export type { GenerateOptions, GeneratedFile, GeneratorKind, ModuleRegistration } from './types.js';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC3F,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { ResolvedBootstrapPlan } from './resolver.js';
|
|
2
2
|
import type { BootstrapOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve package specs.
|
|
5
|
+
*
|
|
6
|
+
* @param options The options.
|
|
7
|
+
* @param bootstrapPlan The bootstrap plan.
|
|
8
|
+
* @returns The resolve package specs result.
|
|
9
|
+
*/
|
|
3
10
|
export declare function resolvePackageSpecs(options: BootstrapOptions, bootstrapPlan: ResolvedBootstrapPlan): Promise<Record<string, string>>;
|
|
4
11
|
//# sourceMappingURL=package-spec-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-spec-resolver.d.ts","sourceRoot":"","sources":["../../src/new/package-spec-resolver.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAkhBnD,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,gBAAgB,EACzB,aAAa,EAAE,qBAAqB,GACnC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgCjC"}
|
|
1
|
+
{"version":3,"file":"package-spec-resolver.d.ts","sourceRoot":"","sources":["../../src/new/package-spec-resolver.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAkhBnD;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,gBAAgB,EACzB,aAAa,EAAE,qBAAqB,GACnC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgCjC"}
|