@absterr/nestkit 0.1.0 → 0.1.1
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.md +55 -25
- package/dist/args.js +37 -0
- package/dist/choices/compat.js +15 -0
- package/dist/choices/preset.js +40 -0
- package/dist/choices/stack.js +111 -0
- package/dist/choices/testing.js +110 -0
- package/dist/choices/types.js +1 -0
- package/dist/cli.js +4 -433
- package/dist/new.js +114 -0
- package/dist/options.js +0 -77
- package/dist/overlays.js +61 -0
- package/dist/rules.js +19 -0
- package/dist/scaffold/esm.js +30 -0
- package/dist/scaffold/files.js +44 -0
- package/dist/scaffold/generate.js +24 -0
- package/dist/scaffold/install.js +33 -0
- package/dist/scaffold/json.js +4 -0
- package/dist/scaffold/package-json.js +62 -0
- package/dist/ui.js +24 -0
- package/package.json +9 -3
- package/templates/base/package.json +5 -5
- package/templates/code-quality/prettier/.prettierrc +1 -1
- package/templates/environment/common/package.json +1 -1
- package/templates/test-runners/common/package.json +1 -1
- package/dist/scaffold.js +0 -158
- package/templates/cjs-module/package.json +0 -7
- package/templates/esm-module/package.json +0 -3
package/README.md
CHANGED
|
@@ -1,63 +1,93 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Nestkit
|
|
2
2
|
|
|
3
3
|
Scaffold NestJS projects with the stack you choose, in the spirit of `create-next-app`. Pick the Nest version, module system, linting, test tools and environment validation instead of accepting one fixed setup.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@absterr/nestkit)
|
|
6
|
-
[](
|
|
6
|
+
[](LICENSE)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
[Documentation](https://docs-nestkit.vercel.app) · [npm](https://www.npmjs.com/package/@absterr/nestkit) · [Contributing](CONTRIBUTING.md)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Requirements
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- Node.js 22.12 or later
|
|
13
|
+
- npm, pnpm, yarn or bun (nestkit detects what is installed). Yarn has not been tested yet.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
## Quick start
|
|
15
16
|
|
|
16
17
|
```bash
|
|
17
18
|
npx @absterr/nestkit new my-app
|
|
18
|
-
# or
|
|
19
|
-
bunx @absterr/nestkit new my-app
|
|
20
19
|
```
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
Use `bunx` instead of `npx` if you prefer. To install it globally:
|
|
23
22
|
|
|
24
23
|
```bash
|
|
25
24
|
npm install -g @absterr/nestkit
|
|
26
25
|
nestkit new my-app
|
|
27
26
|
```
|
|
28
27
|
|
|
29
|
-
`nestkit create` is an alias for `nestkit new`. Generated projects
|
|
28
|
+
`nestkit create` is an alias for `nestkit new`. Generated projects keep `@nestjs/cli`, so `nest generate` still works.
|
|
30
29
|
|
|
31
30
|
## Presets
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
| Preset | What you get |
|
|
33
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
34
|
+
| **Base** | Plain NestJS, no extras |
|
|
35
|
+
| **Recommended** | The defaults of `nest new` for the chosen Nest version, plus agent files |
|
|
36
|
+
| **Previous** | The choices from your last Custom run (saved in `~/.nestkit/settings.json`). Only offered once a saved file exists |
|
|
37
|
+
| **Custom** | Choose each tool yourself |
|
|
38
|
+
|
|
39
|
+
Recommended picks CommonJS, ESLint + Prettier, Jest and Supertest on Nest 11, and ESM, Oxlint + Prettier, Vitest and Supertest on Nest 12.
|
|
37
40
|
|
|
38
41
|
## Options
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
43
|
+
| Option | Choices |
|
|
44
|
+
| ---------------------- | ------------------------------------------------------------------- |
|
|
45
|
+
| NestJS | 11, 12 |
|
|
46
|
+
| Module system | CommonJS, ESM |
|
|
47
|
+
| Linting and formatting | Biome, ESLint + Prettier, Oxlint + Prettier, none |
|
|
48
|
+
| Unit tests | Jest, Vitest, Mocha, none |
|
|
49
|
+
| End-to-end tests | Supertest, Playwright, Cypress, Selenium, none |
|
|
50
|
+
| Environment validation | Joi, class-validator, Zod, Valibot, ArkType, plain TypeScript, none |
|
|
51
|
+
| Agent files | `AGENTS.md` and `CLAUDE.md` |
|
|
52
|
+
| Git and install | Initialize a repository, install dependencies |
|
|
53
|
+
|
|
54
|
+
Not every combination is offered:
|
|
48
55
|
|
|
49
|
-
Jest is only
|
|
56
|
+
- **Jest** is available only for Nest 11 with CommonJS.
|
|
57
|
+
- **ArkType** is available only with ESM.
|
|
50
58
|
|
|
51
59
|
## Non-interactive use
|
|
52
60
|
|
|
53
61
|
```bash
|
|
62
|
+
# Recommended defaults
|
|
54
63
|
nestkit new my-app --preset recommended --pm npm --skip-git
|
|
64
|
+
|
|
65
|
+
# Pick everything
|
|
55
66
|
nestkit new my-app --nest-version 12 --module-system esm \
|
|
56
67
|
--code-quality oxlint --unit-tests vitest --e2e supertest --env zod
|
|
57
68
|
```
|
|
58
69
|
|
|
59
|
-
|
|
70
|
+
With no flags and no terminal, nestkit uses the Base preset. Passing `--code-quality`, `--unit-tests`, `--e2e` or `--env` selects Custom. Explicit flags override preset values.
|
|
71
|
+
|
|
72
|
+
| Flag | Values |
|
|
73
|
+
| ------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
74
|
+
| `--pm` | `npm`, `pnpm`, `yarn`, `bun` |
|
|
75
|
+
| `--nest-version` | `latest`, `previous`, `11`, `12` |
|
|
76
|
+
| `--preset` | `base`, `recommended`, `previous`, `custom` |
|
|
77
|
+
| `--module-system` | `cjs`, `esm` |
|
|
78
|
+
| `--code-quality` | `biome`, `eslint`, `oxlint`, `none` |
|
|
79
|
+
| `--unit-tests` | `jest`, `vitest`, `mocha`, `none` |
|
|
80
|
+
| `--e2e` | `supertest`, `playwright`, `cypress`, `selenium`, `none` |
|
|
81
|
+
| `--e2e-runner` | `jest`, `vitest`, `mocha` (needed for Supertest or Selenium when there are no unit tests) |
|
|
82
|
+
| `--env` | `joi`, `class-validator`, `zod`, `valibot`, `arktype`, `vanilla`, `none` |
|
|
83
|
+
| `--agent-files`, `--skip-agent-files` | Add or skip `AGENTS.md` and `CLAUDE.md` |
|
|
84
|
+
| `--git`, `--skip-git` | Initialize a git repository or not |
|
|
85
|
+
| `--skip-install` | Do not install dependencies |
|
|
86
|
+
|
|
87
|
+
## Contributing
|
|
88
|
+
|
|
89
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
60
90
|
|
|
61
91
|
## License
|
|
62
92
|
|
|
63
|
-
[MIT](
|
|
93
|
+
[MIT](LICENSE)
|
package/dist/args.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { parseArgs } from "node:util";
|
|
2
|
+
export const USAGE = [
|
|
3
|
+
"Usage: nestkit new [directory]",
|
|
4
|
+
"[--pm npm|pnpm|yarn|bun]",
|
|
5
|
+
"[--nest-version latest|previous|11|12]",
|
|
6
|
+
"[--preset base|recommended|previous|custom]",
|
|
7
|
+
"[--module-system cjs|esm]",
|
|
8
|
+
"[--code-quality biome|eslint|oxlint|none]",
|
|
9
|
+
"[--unit-tests jest|vitest|mocha|none]",
|
|
10
|
+
"[--e2e supertest|playwright|cypress|selenium|none]",
|
|
11
|
+
"[--e2e-runner jest|vitest|mocha]",
|
|
12
|
+
"[--env joi|class-validator|zod|valibot|arktype|vanilla|none]",
|
|
13
|
+
"[--agent-files|--skip-agent-files]",
|
|
14
|
+
"[--git|--skip-git]",
|
|
15
|
+
"[--skip-install]",
|
|
16
|
+
].join(" ");
|
|
17
|
+
export function parseCli() {
|
|
18
|
+
return parseArgs({
|
|
19
|
+
allowPositionals: true,
|
|
20
|
+
options: {
|
|
21
|
+
pm: { type: "string" },
|
|
22
|
+
"nest-version": { type: "string" },
|
|
23
|
+
"module-system": { type: "string" },
|
|
24
|
+
preset: { type: "string" },
|
|
25
|
+
"code-quality": { type: "string" },
|
|
26
|
+
"unit-tests": { type: "string" },
|
|
27
|
+
e2e: { type: "string" },
|
|
28
|
+
"e2e-runner": { type: "string" },
|
|
29
|
+
env: { type: "string" },
|
|
30
|
+
"agent-files": { type: "boolean" },
|
|
31
|
+
"skip-agent-files": { type: "boolean" },
|
|
32
|
+
git: { type: "boolean" },
|
|
33
|
+
"skip-git": { type: "boolean" },
|
|
34
|
+
"skip-install": { type: "boolean" },
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ENV, UNIT_TESTS } from "../options.js";
|
|
2
|
+
import { fail, oneOf } from "../ui.js";
|
|
3
|
+
// Reject bad flag and saved combinations now, before any further prompt
|
|
4
|
+
export function checkCompat({ flags, previous }, nest, moduleSystem, runners) {
|
|
5
|
+
const unitTests = flags["unit-tests"]
|
|
6
|
+
? oneOf("unit-tests", flags["unit-tests"], UNIT_TESTS)
|
|
7
|
+
: previous?.unitTests;
|
|
8
|
+
if (unitTests && unitTests !== "none" && !runners.isAvailable(unitTests)) {
|
|
9
|
+
fail(`${unitTests} is not available for Nest ${nest} with ${moduleSystem}.`);
|
|
10
|
+
}
|
|
11
|
+
const env = flags.env ? oneOf("env", flags.env, ENV) : previous?.env;
|
|
12
|
+
if (env === "arktype" && moduleSystem !== "esm") {
|
|
13
|
+
fail("ArkType is ESM only. Use --module-system esm or choose another library.");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
import { PRESETS } from "../options.js";
|
|
3
|
+
import { describeSettings } from "../settings.js";
|
|
4
|
+
import { ensure, fail, oneOf } from "../ui.js";
|
|
5
|
+
export async function resolvePreset(flags, saved) {
|
|
6
|
+
if (flags.preset)
|
|
7
|
+
return oneOf("preset", flags.preset, PRESETS);
|
|
8
|
+
if (flags["code-quality"] || flags["unit-tests"] || flags.e2e || flags.env) {
|
|
9
|
+
return "custom";
|
|
10
|
+
}
|
|
11
|
+
if (!process.stdin.isTTY)
|
|
12
|
+
return "base";
|
|
13
|
+
return ensure(await p.select({
|
|
14
|
+
message: "Preset",
|
|
15
|
+
options: [
|
|
16
|
+
{ value: "base", label: "Base", hint: "plain NestJS, no extras" },
|
|
17
|
+
{
|
|
18
|
+
value: "recommended",
|
|
19
|
+
label: "Recommended",
|
|
20
|
+
hint: "NestJS defaults for this version",
|
|
21
|
+
},
|
|
22
|
+
...(saved
|
|
23
|
+
? [
|
|
24
|
+
{
|
|
25
|
+
value: "previous",
|
|
26
|
+
label: "Previous",
|
|
27
|
+
hint: describeSettings(saved),
|
|
28
|
+
},
|
|
29
|
+
]
|
|
30
|
+
: []),
|
|
31
|
+
{ value: "custom", label: "Custom", hint: "choose your tools" },
|
|
32
|
+
],
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
export function resolvePrevious(preset, saved) {
|
|
36
|
+
if (preset !== "previous")
|
|
37
|
+
return undefined;
|
|
38
|
+
return (saved ??
|
|
39
|
+
fail("No previous settings found. Use the custom preset once to save them."));
|
|
40
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
import { CODE_QUALITY, ENV, MODULE_SYSTEMS, } from "../options.js";
|
|
3
|
+
import { recommendedCodeQuality, recommendedModuleSystem } from "../rules.js";
|
|
4
|
+
import { ensure, oneOf } from "../ui.js";
|
|
5
|
+
export async function resolveModuleSystem({ flags, preset, previous }, nest) {
|
|
6
|
+
if (flags["module-system"]) {
|
|
7
|
+
return oneOf("module-system", flags["module-system"], MODULE_SYSTEMS);
|
|
8
|
+
}
|
|
9
|
+
if (preset === "recommended")
|
|
10
|
+
return recommendedModuleSystem(nest);
|
|
11
|
+
if (previous)
|
|
12
|
+
return previous.moduleSystem;
|
|
13
|
+
if (!process.stdin.isTTY)
|
|
14
|
+
return "cjs";
|
|
15
|
+
return ensure(await p.select({
|
|
16
|
+
message: "Module system",
|
|
17
|
+
options: [
|
|
18
|
+
{
|
|
19
|
+
value: "cjs",
|
|
20
|
+
label: "CommonJS",
|
|
21
|
+
hint: recommendedModuleSystem(nest) === "cjs" ? "recommended" : undefined,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: "esm",
|
|
25
|
+
label: "ESM",
|
|
26
|
+
hint: recommendedModuleSystem(nest) === "esm"
|
|
27
|
+
? "recommended"
|
|
28
|
+
: "not officially supported by Nest 11",
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
export async function resolveCodeQuality({ flags, preset, previous }, nest) {
|
|
34
|
+
if (flags["code-quality"]) {
|
|
35
|
+
return oneOf("code-quality", flags["code-quality"], CODE_QUALITY);
|
|
36
|
+
}
|
|
37
|
+
if (preset === "recommended")
|
|
38
|
+
return recommendedCodeQuality(nest);
|
|
39
|
+
if (previous)
|
|
40
|
+
return previous.codeQuality;
|
|
41
|
+
if (preset === "custom" && process.stdin.isTTY) {
|
|
42
|
+
return ensure(await p.select({
|
|
43
|
+
message: "Linting and formatting",
|
|
44
|
+
options: [
|
|
45
|
+
{ value: "biome", label: "Biome", hint: "lint + format" },
|
|
46
|
+
{ value: "eslint", label: "ESLint + Prettier" },
|
|
47
|
+
{ value: "oxlint", label: "Oxlint + Prettier" },
|
|
48
|
+
{ value: "none", label: "None" },
|
|
49
|
+
],
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
return "none";
|
|
53
|
+
}
|
|
54
|
+
export async function resolveEnv({ flags, preset, previous }, moduleSystem) {
|
|
55
|
+
if (flags.env)
|
|
56
|
+
return oneOf("env", flags.env, ENV);
|
|
57
|
+
if (previous)
|
|
58
|
+
return previous.env;
|
|
59
|
+
if (preset !== "custom" || !process.stdin.isTTY)
|
|
60
|
+
return "none";
|
|
61
|
+
const wantsEnv = ensure(await p.confirm({
|
|
62
|
+
message: "Add environment config with validation?",
|
|
63
|
+
initialValue: true,
|
|
64
|
+
}));
|
|
65
|
+
if (!wantsEnv)
|
|
66
|
+
return "none";
|
|
67
|
+
return ensure(await p.select({
|
|
68
|
+
message: moduleSystem === "cjs"
|
|
69
|
+
? "Validation library (ArkType is not available with CommonJS)"
|
|
70
|
+
: "Validation library",
|
|
71
|
+
options: [
|
|
72
|
+
{ value: "joi", label: "Joi" },
|
|
73
|
+
{
|
|
74
|
+
value: "class-validator",
|
|
75
|
+
label: "class-validator",
|
|
76
|
+
hint: "with class-transformer",
|
|
77
|
+
},
|
|
78
|
+
{ value: "zod", label: "Zod" },
|
|
79
|
+
{ value: "valibot", label: "Valibot" },
|
|
80
|
+
...(moduleSystem === "esm"
|
|
81
|
+
? [
|
|
82
|
+
{
|
|
83
|
+
value: "arktype",
|
|
84
|
+
label: "ArkType",
|
|
85
|
+
hint: "ESM-only package",
|
|
86
|
+
},
|
|
87
|
+
]
|
|
88
|
+
: []),
|
|
89
|
+
{
|
|
90
|
+
value: "vanilla",
|
|
91
|
+
label: "None",
|
|
92
|
+
hint: "plain TypeScript, no library",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
export async function resolveAgentFiles({ flags, preset, previous, }) {
|
|
98
|
+
if (flags["skip-agent-files"])
|
|
99
|
+
return false;
|
|
100
|
+
if (flags["agent-files"] || preset === "recommended")
|
|
101
|
+
return true;
|
|
102
|
+
if (previous)
|
|
103
|
+
return previous.agentFiles;
|
|
104
|
+
if (preset === "custom" && process.stdin.isTTY) {
|
|
105
|
+
return ensure(await p.confirm({
|
|
106
|
+
message: "Add AGENTS.md and CLAUDE.md for coding agents?",
|
|
107
|
+
initialValue: true,
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
import { E2E, RUNNERS, UNIT_TESTS, } from "../options.js";
|
|
3
|
+
import { needsRunner, recommendedRunner, runnersFor } from "../rules.js";
|
|
4
|
+
import { ensure, fail, oneOf } from "../ui.js";
|
|
5
|
+
const RUNNER_LABELS = {
|
|
6
|
+
jest: "Jest",
|
|
7
|
+
vitest: "Vitest",
|
|
8
|
+
mocha: "Mocha",
|
|
9
|
+
};
|
|
10
|
+
const MODULE_LABELS = {
|
|
11
|
+
cjs: "CommonJS",
|
|
12
|
+
esm: "ESM",
|
|
13
|
+
};
|
|
14
|
+
// Runner options and prompt notes for this Nest version and module system
|
|
15
|
+
export function runnerInfo(nest, moduleSystem) {
|
|
16
|
+
const recommended = recommendedRunner(nest, moduleSystem);
|
|
17
|
+
const options = runnersFor(nest, moduleSystem).map((value) => ({
|
|
18
|
+
value,
|
|
19
|
+
label: RUNNER_LABELS[value],
|
|
20
|
+
hint: value === recommended ? "recommended" : undefined,
|
|
21
|
+
}));
|
|
22
|
+
const isAvailable = (runner) => options.some((o) => o.value === runner);
|
|
23
|
+
// Runners not offered for this Nest version with the given module system
|
|
24
|
+
const missingFor = (system) => RUNNERS.filter((r) => !runnersFor(nest, system).includes(r));
|
|
25
|
+
// e.g. "Jest is not available for Nest 11 with ESM". Undefined when everything is offered.
|
|
26
|
+
const note = () => {
|
|
27
|
+
const missing = missingFor(moduleSystem);
|
|
28
|
+
if (missing.length === 0)
|
|
29
|
+
return undefined;
|
|
30
|
+
const names = new Intl.ListFormat("en").format(missing.map((r) => RUNNER_LABELS[r]));
|
|
31
|
+
// Name the module system only when it changes what is offered
|
|
32
|
+
const sameForBoth = missingFor("cjs").join() === missingFor("esm").join();
|
|
33
|
+
const where = sameForBoth
|
|
34
|
+
? `Nest ${nest}`
|
|
35
|
+
: `Nest ${nest} with ${MODULE_LABELS[moduleSystem]}`;
|
|
36
|
+
return `${names} ${missing.length === 1 ? "is" : "are"} not available for ${where}`;
|
|
37
|
+
};
|
|
38
|
+
// Puts the note in brackets after a runner prompt's title
|
|
39
|
+
const withNote = (message) => {
|
|
40
|
+
const text = note();
|
|
41
|
+
return text ? `${message} (${text})` : message;
|
|
42
|
+
};
|
|
43
|
+
return { recommended, options, isAvailable, withNote };
|
|
44
|
+
}
|
|
45
|
+
export async function resolveUnitTests({ flags, preset, previous }, runners) {
|
|
46
|
+
if (flags["unit-tests"]) {
|
|
47
|
+
return oneOf("unit-tests", flags["unit-tests"], UNIT_TESTS);
|
|
48
|
+
}
|
|
49
|
+
if (preset === "recommended")
|
|
50
|
+
return runners.recommended;
|
|
51
|
+
if (previous)
|
|
52
|
+
return previous.unitTests;
|
|
53
|
+
if (preset === "custom" && process.stdin.isTTY) {
|
|
54
|
+
return ensure(await p.select({
|
|
55
|
+
message: runners.withNote("Unit tests"),
|
|
56
|
+
options: [...runners.options, { value: "none", label: "None" }],
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
return "none";
|
|
60
|
+
}
|
|
61
|
+
export async function resolveE2e({ flags, preset, previous, }) {
|
|
62
|
+
if (flags.e2e)
|
|
63
|
+
return oneOf("e2e", flags.e2e, E2E);
|
|
64
|
+
if (preset === "recommended")
|
|
65
|
+
return "supertest";
|
|
66
|
+
if (previous)
|
|
67
|
+
return previous.e2e;
|
|
68
|
+
if (preset === "custom" && process.stdin.isTTY) {
|
|
69
|
+
return ensure(await p.select({
|
|
70
|
+
message: "End-to-end tests",
|
|
71
|
+
options: [
|
|
72
|
+
{ value: "supertest", label: "Supertest", hint: "HTTP, recommended" },
|
|
73
|
+
{ value: "playwright", label: "Playwright" },
|
|
74
|
+
{ value: "cypress", label: "Cypress" },
|
|
75
|
+
{ value: "selenium", label: "Selenium" },
|
|
76
|
+
{ value: "none", label: "None" },
|
|
77
|
+
],
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
return "none";
|
|
81
|
+
}
|
|
82
|
+
// Supertest and selenium need a runner: reuse the unit-test one, else ask
|
|
83
|
+
export async function resolveE2eRunner({ flags, previous }, nest, moduleSystem, e2e, unitTests, runners) {
|
|
84
|
+
if (!needsRunner(e2e))
|
|
85
|
+
return undefined;
|
|
86
|
+
const flag = flags["e2e-runner"]
|
|
87
|
+
? oneOf("e2e-runner", flags["e2e-runner"], RUNNERS)
|
|
88
|
+
: undefined;
|
|
89
|
+
const chosen = flag ?? previous?.e2eRunner;
|
|
90
|
+
if (unitTests !== "none") {
|
|
91
|
+
if (flag && flag !== unitTests) {
|
|
92
|
+
fail(`--e2e-runner ${flag} conflicts with --unit-tests ${unitTests}.`);
|
|
93
|
+
}
|
|
94
|
+
p.log.info(`Using ${unitTests} for e2e tests.`);
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
if (chosen) {
|
|
98
|
+
if (!runners.isAvailable(chosen)) {
|
|
99
|
+
fail(`${chosen} is not available for Nest ${nest} with ${moduleSystem}.`);
|
|
100
|
+
}
|
|
101
|
+
return chosen;
|
|
102
|
+
}
|
|
103
|
+
if (process.stdin.isTTY) {
|
|
104
|
+
return ensure(await p.select({
|
|
105
|
+
message: runners.withNote("Test runner for e2e tests"),
|
|
106
|
+
options: runners.options,
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
return fail(`${e2e} needs a test runner. Pass --e2e-runner ${RUNNERS.join("|")}.`);
|
|
110
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|