@lenne.tech/cli 1.48.0 → 1.50.0
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/build/commands/dev/doctor.js +27 -10
- package/build/commands/dev/down.js +48 -5
- package/build/commands/dev/status.js +32 -8
- package/build/commands/dev/test.js +5 -3
- package/build/commands/dev/up.js +59 -21
- package/build/commands/fullstack/init.js +12 -3
- package/build/commands/git/squash.js +4 -1
- package/build/extensions/api-mode.js +69 -0
- package/build/extensions/frontend-helper.js +11 -12
- package/build/extensions/server.js +43 -33
- package/build/lib/caddy.js +17 -10
- package/build/lib/check-template-sync.js +62 -2
- package/build/lib/config-env-graphql.js +106 -0
- package/build/lib/cross-env.js +94 -0
- package/build/lib/dev-api-launch.js +34 -8
- package/build/lib/dev-env-bridge.js +7 -0
- package/build/lib/dev-env.js +44 -4
- package/build/lib/dev-log-tail.js +91 -0
- package/build/lib/dev-package-manager.js +13 -9
- package/build/lib/dev-patches.js +15 -5
- package/build/lib/dev-process.js +362 -127
- package/build/lib/dev-project.js +14 -1
- package/build/lib/dev-prune.js +15 -5
- package/build/lib/dev-service.js +29 -15
- package/build/lib/dev-state.js +40 -4
- package/build/lib/dev-test-session.js +141 -73
- package/build/lib/dev-ticket.js +13 -1
- package/build/lib/fail-run.js +11 -0
- package/build/lib/heal-vendor-migrate-store.js +4 -3
- package/build/lib/hoist-workspace-pnpm-config.js +17 -6
- package/build/lib/migrate-scripts.js +69 -0
- package/build/lib/module-specifiers.js +144 -0
- package/build/lib/platform.js +53 -1
- package/build/lib/spinner-lifetime.js +245 -0
- package/build/templates/check/check.mjs +59 -9
- package/build/templates/check/lt-monorepo-pin.json +4 -4
- package/build/templates/nest-server-starter/README.md.ejs +13 -6
- package/docs/commands.md +16 -12
- package/package.json +4 -1
- package/build/lib/strip-comments.js +0 -78
|
@@ -91,14 +91,21 @@ JavaScript file: src/main.ts
|
|
|
91
91
|
see [Debug.run.xml](.run/Debug.run.xml)
|
|
92
92
|
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
<% if (props.vendor) { -%>
|
|
95
|
+
## Working on the framework core
|
|
96
|
+
This project runs in vendor mode: the `@lenne.tech/nest-server` core is part of the source tree under `src/core/`, not an npm package, so there is nothing to link.
|
|
97
|
+
|
|
98
|
+
- Read `src/core/VENDOR.md` first. It records the upstream baseline and every local change to the core.
|
|
99
|
+
- Put project-specific code outside `src/core/`: extend, inherit from or override the core, never patch it for one project.
|
|
100
|
+
- Pull in upstream changes with `/lt-dev:backend:update-nest-server-core`, and propose generally useful core fixes upstream with `/lt-dev:backend:contribute-nest-server-core`.
|
|
96
101
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
<% } else { -%>
|
|
103
|
+
## Test & debug the NestServer package in this project
|
|
104
|
+
1. Clone [NestServer](https://github.com/lenneTech/nest-server): `git clone https://github.com/lenneTech/nest-server.git`
|
|
105
|
+
2. Link it into this project with `pnpm run link:nest-server` and start the server: `pnpm start`
|
|
106
|
+
3. Switch back to the published package when you are done: `pnpm run unlink:nest-server`
|
|
101
107
|
|
|
108
|
+
<% } -%>
|
|
102
109
|
## Deployment with deploy.party
|
|
103
110
|
|
|
104
111
|
This project is prepared for deployment with deploy.party.
|
package/docs/commands.md
CHANGED
|
@@ -663,29 +663,33 @@ Run `--explain` to see three commonly recommended keys the profile deliberately
|
|
|
663
663
|
|
|
664
664
|
### `lt dev test`
|
|
665
665
|
|
|
666
|
-
One-shot E2E wrapper:
|
|
666
|
+
One-shot E2E wrapper: brings up an isolated test stack next to the `lt dev up` session (own URLs `<slug>-test.localhost` / `api.<slug>-test.localhost`, own ports, own Caddy block, own database `<…>-test`), runs `test:e2e` against it, and tears the stack down afterwards. The dev session is never touched.
|
|
667
667
|
|
|
668
668
|
**Usage:**
|
|
669
669
|
```bash
|
|
670
|
-
lt dev test # App E2E
|
|
671
|
-
lt dev test --
|
|
672
|
-
lt dev test
|
|
670
|
+
lt dev test # App E2E against the isolated stack, auto teardown
|
|
671
|
+
lt dev test --keep # leave the test stack up afterwards
|
|
672
|
+
lt dev test down # tear a leftover test stack down
|
|
673
|
+
lt dev test --api # API E2E (projects/api) — no stack, no Caddy
|
|
673
674
|
lt dev test --debug # PWDEBUG=1 + HEADED=1
|
|
675
|
+
lt dev test --shard [N|auto] # split across N isolated stacks (bare --shard = 2)
|
|
674
676
|
lt dev test -- --ui spec.ts # everything after `--` is forwarded to playwright
|
|
675
677
|
```
|
|
676
678
|
|
|
677
679
|
**Alias:** `lt d t`
|
|
678
680
|
|
|
679
|
-
**Behaviour:**
|
|
680
|
-
1. Pre-flight: Caddy installed + daemon running (
|
|
681
|
-
2.
|
|
682
|
-
3.
|
|
683
|
-
4.
|
|
684
|
-
5.
|
|
685
|
-
6.
|
|
681
|
+
**Behaviour (App mode):**
|
|
682
|
+
1. Pre-flight: Caddy installed + daemon running, and `playwright.config.ts` env-aware (otherwise abort; `--force` overrides).
|
|
683
|
+
2. Builds the API and applies pending migrations to the test DB (`migrate:up`, with the API's own env, so it hits the same DB). A failed migration aborts the run; a project without a `migrate:up` script starts unmigrated. Then starts the compiled API. Without a build output it falls back to the project's `start` script, which migrates by itself.
|
|
684
|
+
3. Builds the App (`nuxt build`) and serves the Nitro output.
|
|
685
|
+
4. Waits for both to answer and aborts if either never does, so the suite never runs against a dead stack.
|
|
686
|
+
5. Runs `test:e2e [forwarded args]` in the App with the `.lt-dev/.env.test` bridge loaded.
|
|
687
|
+
6. Tears the stack down (processes, Caddy block, env bridge, session file) unless `--keep` is set.
|
|
688
|
+
|
|
689
|
+
The test DB outlives the run: the CLI never drops it. That is why step 2 migrates it: without the migration the DB drifts behind every environment that does migrate. A project whose Playwright global-setup resets the DB gets it passed as `MONGO_URI`.
|
|
686
690
|
|
|
687
691
|
**When to use this vs. `pnpm run test:e2e` directly:**
|
|
688
|
-
- Use **`lt dev test`** for TDD loops, ad-hoc reproduction, or when you want a single-command "
|
|
692
|
+
- Use **`lt dev test`** for TDD loops, ad-hoc reproduction, or when you want a single-command "isolated stack + run + teardown" flow.
|
|
689
693
|
- Use **direct `pnpm run test:e2e`** (or VS Code Playwright Extension, IDE test runners) for everyday work — the auto-injected `playwright.config.ts` bridge loads the `.lt-dev/.env` automatically, so the env is correct without the wrapper.
|
|
690
694
|
|
|
691
695
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.50.0",
|
|
4
4
|
"description": "lenne.Tech CLI: lt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lenne.Tech",
|
|
@@ -134,6 +134,9 @@
|
|
|
134
134
|
"rootDir": "__tests__",
|
|
135
135
|
"testTimeout": 60000,
|
|
136
136
|
"workerIdleMemoryLimit": "512MB",
|
|
137
|
+
"setupFilesAfterEnv": [
|
|
138
|
+
"<rootDir>/support/signal-guard.ts"
|
|
139
|
+
],
|
|
137
140
|
"testMatch": [
|
|
138
141
|
"<rootDir>/*.test.ts"
|
|
139
142
|
],
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.stripComments = stripComments;
|
|
37
|
-
const ts = __importStar(require("typescript"));
|
|
38
|
-
/**
|
|
39
|
-
* Removes comments from TypeScript/JavaScript source, preserving everything else verbatim.
|
|
40
|
-
*
|
|
41
|
-
* Exists because detectors that search source for import specifiers must not read comments as
|
|
42
|
-
* code. A keyword-anchored regex is not sufficient on its own: a docblock that DOCUMENTS an import
|
|
43
|
-
* rewrite legitimately quotes the exact syntax the detector looks for. nest-server-starter's
|
|
44
|
-
* `tests/unit/bootstrap-diagnostics.spec.ts` contains
|
|
45
|
-
*
|
|
46
|
-
* * CLI's vendor conversion rewrites `from '@lenne.tech/nest-server'` to a relative `./core` path
|
|
47
|
-
*
|
|
48
|
-
* which matched `/(?:from|import|…)\s*['"]@lenne\.tech\/nest-server['"]/` and made
|
|
49
|
-
* `lt fullstack init --framework-mode vendor` warn about imports that file does not have.
|
|
50
|
-
*
|
|
51
|
-
* Uses the TypeScript scanner rather than a regex, so string literals, template literals and
|
|
52
|
-
* regex literals containing `//` or `/*` are handled correctly by construction — a hand-rolled
|
|
53
|
-
* stripper trips over `'https://…'` and over `/* ` inside a string.
|
|
54
|
-
*
|
|
55
|
-
* Comment characters are replaced with spaces instead of being deleted, so byte offsets and line
|
|
56
|
-
* numbers of the surrounding code stay unchanged — a caller can still report a meaningful
|
|
57
|
-
* position from a match.
|
|
58
|
-
*
|
|
59
|
-
* @param source - TypeScript or JavaScript source text
|
|
60
|
-
* @returns The source with every comment blanked out
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* stripComments("// from 'pkg'\nimport x from 'pkg';")
|
|
64
|
-
* // => " \nimport x from 'pkg';"
|
|
65
|
-
*/
|
|
66
|
-
function stripComments(source) {
|
|
67
|
-
const scanner = ts.createScanner(ts.ScriptTarget.Latest, /* skipTrivia */ false, ts.LanguageVariant.Standard, source);
|
|
68
|
-
let result = '';
|
|
69
|
-
let token = scanner.scan();
|
|
70
|
-
while (token !== ts.SyntaxKind.EndOfFileToken) {
|
|
71
|
-
const text = scanner.getTokenText();
|
|
72
|
-
const isComment = token === ts.SyntaxKind.SingleLineCommentTrivia || token === ts.SyntaxKind.MultiLineCommentTrivia;
|
|
73
|
-
// Keep newlines so line numbers survive; blank everything else in the comment.
|
|
74
|
-
result += isComment ? text.replace(/[^\n]/g, ' ') : text;
|
|
75
|
-
token = scanner.scan();
|
|
76
|
-
}
|
|
77
|
-
return result;
|
|
78
|
-
}
|