@antelopejs/dms-frontend 0.3.10 → 0.3.12
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 +20 -5
- package/dist/commands/clean-action.d.ts +1 -1
- package/dist/commands/clean-action.js +16 -12
- package/dist/commands/verify-source-action.js +2 -10
- package/dist/commands/verify-source.js +11 -7
- package/dist/layer-watch.d.ts +1 -1
- package/dist/layer-watch.js +5 -2
- package/dist/output.d.ts +4 -1
- package/dist/output.js +32 -12
- package/dist/update-check.d.ts +1 -0
- package/dist/update-check.js +8 -6
- package/dist/verify-source-runner.js +6 -42
- package/dist/verify-source-sources.d.ts +13 -0
- package/dist/verify-source-sources.js +189 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ pnpm add -g @antelopejs/core @antelopejs/dms-frontend
|
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
The plugin prints through the output module of `@antelopejs/core`
|
|
75
|
-
(`@antelopejs/core/cli`), so it needs `@antelopejs/core` 1.13.
|
|
75
|
+
(`@antelopejs/core/cli`), so it needs `@antelopejs/core` 1.13.2 or later.
|
|
76
76
|
`npm install -g` works too; this repository and every generated workspace use
|
|
77
77
|
pnpm. Inside a package script, `ajs` resolves from `node_modules/.bin`, and the
|
|
78
78
|
`dms` command it delegates to resolves the project-local plugin, so a script
|
|
@@ -100,7 +100,7 @@ generated server read, from the environment or the project's `.env`.
|
|
|
100
100
|
need a backend URL through `-b` or `DMS_API_BASE_URL`, and exit 2 without one.
|
|
101
101
|
`dev` also discovers it from the enclosing antelope project's
|
|
102
102
|
`.antelope/dev.json`, and exits 1 when there is none to discover.
|
|
103
|
-
`verify-source` needs
|
|
103
|
+
`verify-source` needs no backend: it runs in the project that installs `@antelopejs/dms`.
|
|
104
104
|
|
|
105
105
|
`prepare` runs anywhere: when it cannot prepare the workspace it warns on
|
|
106
106
|
stderr and exits 0, so a frontend module's `postinstall` hook never fails an
|
|
@@ -463,15 +463,30 @@ Use pnpm for all repository and workspace operations.
|
|
|
463
463
|
|
|
464
464
|
## Verify local frontend modules
|
|
465
465
|
|
|
466
|
-
Use the packaged source verifier to validate
|
|
466
|
+
Use the packaged source verifier to validate unpublished DMS frontend modules against this exact adapter version. Run it from the project:
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
ajs dms verify-source
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
The modules are verified on top of the DMS core layer, the `frontend-vue` directory of `@antelopejs/dms`. The verifier finds the `@antelopejs/dms` the project installs the way Node does, from the current directory, and names it before it starts: `Verifying against @antelopejs/dms 0.5.5 (installed in this project)`. When the project does not install it, the verifier stops with the command that adds it as a development dependency (`pnpm add -D @antelopejs/dms`, or the equivalent for the project's package manager).
|
|
473
|
+
|
|
474
|
+
Without `--module`, the verifier takes the current directory when it is a frontend module (it contains `dms.frontend.ts`), and its `frontend-vue` directory otherwise. `--module` names other ones and is repeatable, as is `--local-package`, which binds a local build of a package into the generated workspace. All supplied frontend packages are copied into the generated workspace and bound with `workspace:*`.
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
ajs dms verify-source --module ./admin-vue --module ./shop-vue
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
`--layer` is for the DMS core layer's own development: it verifies an unpublished core layer instead of the installed one, here against a local build of `@antelopejs/dms`:
|
|
467
481
|
|
|
468
482
|
```bash
|
|
469
483
|
ajs dms verify-source \
|
|
470
484
|
--layer /path/to/dms/frontend-vue \
|
|
471
|
-
--module /path/to/module/frontend-vue \
|
|
472
485
|
--local-package @antelopejs/dms=/path/to/dms
|
|
473
486
|
```
|
|
474
487
|
|
|
475
|
-
|
|
488
|
+
The checks look for what the core layer ships: its lazily loaded chart and rich-text libraries, the pages every DMS serves and its e-mail templates. A `--layer` that holds no core layer, such as a project's own `frontend-vue`, is refused before anything is installed, with exit code 2 and the command that verifies the same folder with `--module` instead.
|
|
489
|
+
|
|
490
|
+
A supplied package whose declared range excludes this adapter version is refused before anything is installed (see [Declaring the loader releases a module supports](#declaring-the-loader-releases-a-module-supports)). The verifier generates a temporary workspace, installs it, builds client, SSR, and email bundles, checks what the client bundle loads, runs `vue-tsc`, renders eight DMS email templates, and checks that the email bundle excludes browser-only modules. Each check is one line that ends in ✔ or ✖, and the run ends with `Verified <n> modules` and its duration, or with the first failure: a type or Vite error points at the file in the package you passed (`./frontend-vue/app/components/Callout.vue:17:7`), not at its copy in the workspace, and the command exits 1. `--verbose` streams the pnpm, Vite and `vue-tsc` output. The workspace is removed when the run ends. It does not start a backend or publish packages. Repository development can invoke the same runner through `pnpm test:real-source`, with `DMS_LAYER_SOURCE` set to a core layer root and `DMS_MODULE_SOURCES` to a JSON array of module roots.
|
|
476
491
|
|
|
477
492
|
Refresh rotation is single-flight within one frontend process. Horizontally scaled deployments must use sticky routing so a browser reaches the same process, or replace this process-local behavior with an external session adapter. It does not provide a distributed rotation guarantee.
|
|
@@ -4,5 +4,5 @@ export interface CleanOptions {
|
|
|
4
4
|
all?: boolean;
|
|
5
5
|
yes?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare function describeWorkspaces(records: WorkspaceRecord[], isTerminal: boolean): string[];
|
|
7
|
+
export declare function describeWorkspaces(records: WorkspaceRecord[], isTerminal: boolean, columns?: number): string[];
|
|
8
8
|
export declare function runClean(options: CleanOptions): Promise<void>;
|
|
@@ -11,25 +11,30 @@ const CLEAN_ALL_COMMAND = "ajs dms clean --all";
|
|
|
11
11
|
const YES_FLAG = "--yes";
|
|
12
12
|
const COLUMN_GAP = " ";
|
|
13
13
|
const ROW_INDENT = " ";
|
|
14
|
-
function describeWorkspaces(records, isTerminal) {
|
|
14
|
+
function describeWorkspaces(records, isTerminal, columns) {
|
|
15
15
|
const rows = records.map((record) => [
|
|
16
16
|
(0, output_1.workspaceId)(record.dir, isTerminal),
|
|
17
17
|
record.backendUrl,
|
|
18
18
|
(0, workspaces_action_1.describeKey)(record),
|
|
19
19
|
]);
|
|
20
20
|
const widths = rows[0].map((_, column) => Math.max(...rows.map((row) => row[column].length)));
|
|
21
|
-
return rows.
|
|
22
|
-
.map((cell, column) => cell.padEnd(widths[column]))
|
|
21
|
+
return rows.flatMap(([id, ...rest]) => (0, output_1.wrapAfter)(`${id.padEnd(widths[0])}${COLUMN_GAP}`, rest
|
|
22
|
+
.map((cell, column) => cell.padEnd(widths[column + 1]))
|
|
23
23
|
.join(COLUMN_GAP)
|
|
24
|
-
.trimEnd());
|
|
24
|
+
.trimEnd(), columns).map((line) => line.trimEnd()));
|
|
25
|
+
}
|
|
26
|
+
function writeWorkspaces(records, isTerminal, write, paint = (line) => line) {
|
|
27
|
+
const columns = (0, output_1.feedbackColumns)();
|
|
28
|
+
const width = columns === undefined ? undefined : columns - ROW_INDENT.length;
|
|
29
|
+
for (const line of describeWorkspaces(records, isTerminal, width)) {
|
|
30
|
+
write(`${ROW_INDENT}${paint(line)}`);
|
|
31
|
+
}
|
|
25
32
|
}
|
|
26
33
|
async function confirmCleanAll(records, totalBytes, options) {
|
|
27
34
|
const prompter = (0, cli_1.createPrompter)({ command: CLEAN_ALL_COMMAND });
|
|
28
35
|
if (!options.yes && prompter.isInteractive) {
|
|
29
36
|
(0, output_1.writeFeedback)(`Remove ${(0, cli_1.pluralize)(records.length, "workspace")} (${(0, output_1.formatSize)(totalBytes)})?`);
|
|
30
|
-
|
|
31
|
-
(0, output_1.writeFeedback)(`${ROW_INDENT}${line}`);
|
|
32
|
-
}
|
|
37
|
+
writeWorkspaces(records, true, output_1.writeFeedback);
|
|
33
38
|
}
|
|
34
39
|
return prompter.confirm({
|
|
35
40
|
message: "Continue?",
|
|
@@ -57,11 +62,10 @@ async function cleanAll(options) {
|
|
|
57
62
|
ui.message("success", [
|
|
58
63
|
`Removed ${(0, cli_1.pluralize)(records.length, "workspace")}`,
|
|
59
64
|
`freed ${(0, output_1.formatSize)(totalBytes)}`,
|
|
60
|
-
].join(ui.symbols.separator)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
+
].join(ui.symbols.separator));
|
|
66
|
+
if (options.yes) {
|
|
67
|
+
writeWorkspaces(records, (0, output_1.isTerminalFeedback)(), output_1.writeInfo, ui.palette().dim);
|
|
68
|
+
}
|
|
65
69
|
(0, workspaces_action_1.reportSkipped)(ui, skipped);
|
|
66
70
|
}
|
|
67
71
|
async function runClean(options) {
|
|
@@ -9,8 +9,6 @@ const node_path_1 = require("node:path");
|
|
|
9
9
|
const cli_1 = require("@antelopejs/core/cli");
|
|
10
10
|
const common_1 = require("../common");
|
|
11
11
|
const verify_source_result_1 = require("../verify-source-result");
|
|
12
|
-
const COMMAND_PATH = "ajs dms verify-source";
|
|
13
|
-
const LAYER_OPTION = "-l, --layer <path>";
|
|
14
12
|
function localPackageSeparator(value) {
|
|
15
13
|
const separator = value.indexOf("=");
|
|
16
14
|
return separator <= 0 || separator === value.length - 1 ? -1 : separator;
|
|
@@ -37,15 +35,10 @@ function directoryProblem(path, label) {
|
|
|
37
35
|
return undefined;
|
|
38
36
|
return { title: `${label} not found: ${path}`, fixes: [verify_source_result_1.LAYER_PATH_FIX] };
|
|
39
37
|
}
|
|
40
|
-
const MISSING_LAYER = {
|
|
41
|
-
title: `Required option '${LAYER_OPTION}' not specified`,
|
|
42
|
-
reason: `Usage: ${COMMAND_PATH} [options]`,
|
|
43
|
-
fixes: [`Run ${COMMAND_PATH} --help for usage`],
|
|
44
|
-
};
|
|
45
38
|
function usageProblems(options) {
|
|
46
39
|
const problems = [
|
|
47
40
|
options.layer === undefined
|
|
48
|
-
?
|
|
41
|
+
? undefined
|
|
49
42
|
: directoryProblem(options.layer, "Layer path"),
|
|
50
43
|
...(options.module ?? []).map((path) => directoryProblem(path, "Module path")),
|
|
51
44
|
...(options.localPackage ?? []).map(localPackageProblem),
|
|
@@ -71,7 +64,6 @@ function channelClosed(child) {
|
|
|
71
64
|
async function runVerifySource(options) {
|
|
72
65
|
const startedAt = Date.now();
|
|
73
66
|
assertValidUsage(usageProblems(options));
|
|
74
|
-
const layer = options.layer ?? "";
|
|
75
67
|
const modules = options.module ?? [];
|
|
76
68
|
const localPackages = parseLocalPackages(options.localPackage ?? []);
|
|
77
69
|
const runner = (0, node_path_1.join)(__dirname, "..", `verify-source-runner${(0, node_path_1.extname)(__filename)}`);
|
|
@@ -83,7 +75,7 @@ async function runVerifySource(options) {
|
|
|
83
75
|
stdio: ["inherit", "inherit", "inherit", "ipc"],
|
|
84
76
|
env: {
|
|
85
77
|
...process.env,
|
|
86
|
-
DMS_LAYER_SOURCE: (0, node_path_1.resolve)(layer),
|
|
78
|
+
DMS_LAYER_SOURCE: options.layer === undefined ? undefined : (0, node_path_1.resolve)(options.layer),
|
|
87
79
|
DMS_MODULE_SOURCES: JSON.stringify(modules.map((path) => (0, node_path_1.resolve)(path))),
|
|
88
80
|
DMS_LOCAL_PACKAGES: JSON.stringify(localPackages),
|
|
89
81
|
},
|
|
@@ -41,20 +41,24 @@ function collectOption(value, values = []) {
|
|
|
41
41
|
}
|
|
42
42
|
const VERIFY_SOURCE_EXAMPLES = [
|
|
43
43
|
{
|
|
44
|
-
description: "
|
|
45
|
-
command: "ajs dms verify-source
|
|
44
|
+
description: "The project's frontend module: the current directory or ./frontend-vue",
|
|
45
|
+
command: "ajs dms verify-source",
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
description: "
|
|
49
|
-
command: "ajs dms verify-source -
|
|
48
|
+
description: "Frontend modules in other directories",
|
|
49
|
+
command: "ajs dms verify-source -m ./admin-vue -m ./shop-vue",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
description: "An unpublished DMS core layer, with a local build of @antelopejs/dms",
|
|
53
|
+
command: "ajs dms verify-source -l . --local-package @antelopejs/dms=..",
|
|
50
54
|
},
|
|
51
55
|
];
|
|
52
56
|
function cmdVerifySource() {
|
|
53
57
|
const command = new commander_1.Command("verify-source")
|
|
54
58
|
.summary("Build and type-check unpublished frontend sources")
|
|
55
|
-
.description("Build and type-check unpublished DMS frontend
|
|
56
|
-
.option("-l, --layer <path>", "Root of
|
|
57
|
-
.option("-m, --module <path>", "Root of
|
|
59
|
+
.description("Build and type-check unpublished DMS frontend modules against this loader version, on top of the DMS core layer of the @antelopejs/dms installed in the project. Runs in a temporary workspace removed when the run ends, and starts no backend.")
|
|
60
|
+
.option("-l, --layer <path>", "Root of an unpublished DMS core layer to verify instead of the installed one")
|
|
61
|
+
.option("-m, --module <path>", "Root of a frontend module to verify (repeatable); without -l or -m, the current directory or ./frontend-vue", collectOption)
|
|
58
62
|
.option("--local-package <name=path>", "Bind a local package into the generated workspace (repeatable)", collectOption)
|
|
59
63
|
.action(async (options) => (await Promise.resolve().then(() => __importStar(require("./verify-source-action")))).runVerifySource(options));
|
|
60
64
|
return (0, cli_1.withExamples)(command, VERIFY_SOURCE_EXAMPLES);
|
package/dist/layer-watch.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Ui } from "@antelopejs/core/cli";
|
|
2
2
|
import { ResolvedLayer } from "./workspace";
|
|
3
|
-
export declare function startLayerWatchers(workspaceDir: string, layers: ResolvedLayer[], ui?: Ui, write?: (text: string) => void): () => Promise<void>;
|
|
3
|
+
export declare function startLayerWatchers(workspaceDir: string, layers: ResolvedLayer[], ui?: Ui, write?: (text: string) => void, isQuiet?: boolean): () => Promise<void>;
|
package/dist/layer-watch.js
CHANGED
|
@@ -272,11 +272,14 @@ function createDerivedOutputRefresher(workspaceDir, layers, reporter) {
|
|
|
272
272
|
},
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
|
-
function startLayerWatchers(workspaceDir, layers, ui = (0, cli_1.getProcessUi)(), write = output_1.writeFeedback) {
|
|
275
|
+
function startLayerWatchers(workspaceDir, layers, ui = (0, cli_1.getProcessUi)(), write = output_1.writeFeedback, isQuiet = (0, cli_1.isQuietRun)()) {
|
|
276
276
|
const mapPath = (0, child_output_1.createPathMapper)(workspaceDir, layers.map((layer) => ({ ...layer, sourcePath: layer.path })));
|
|
277
277
|
const reporter = {
|
|
278
278
|
warn: (text, options) => write((0, output_1.formatTimedMessage)("warn", text, options, ui)),
|
|
279
|
-
succeed: (text) =>
|
|
279
|
+
succeed: (text) => {
|
|
280
|
+
if (!isQuiet)
|
|
281
|
+
write((0, output_1.formatTimedMessage)("success", text, {}, ui));
|
|
282
|
+
},
|
|
280
283
|
describe: (error) => (0, output_1.failureDetails)(error, ui).map((line) => mapPath(line)),
|
|
281
284
|
show: (path) => {
|
|
282
285
|
const mapped = mapPath(path);
|
package/dist/output.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { CancelledError } from "./cancellation";
|
|
|
3
3
|
export declare function exitOnBrokenPipe(stream?: NodeJS.WriteStream): void;
|
|
4
4
|
export declare function isTerminalFeedback(): boolean;
|
|
5
5
|
export declare function isTerminalResult(): boolean;
|
|
6
|
+
export declare function feedbackColumns(): number | undefined;
|
|
7
|
+
export declare function wrapAfter(prefix: string, text: string, columns: number | undefined, paint?: (line: string) => string): string[];
|
|
6
8
|
export declare function writeFeedback(line: string): void;
|
|
7
9
|
export declare function writeInfo(line: string): void;
|
|
8
10
|
export declare function writeHeader(command: string, context: string[], ui?: Ui): void;
|
|
@@ -27,7 +29,7 @@ export interface ReadyBlock {
|
|
|
27
29
|
lines: ReadyLine[];
|
|
28
30
|
footer: string;
|
|
29
31
|
}
|
|
30
|
-
export declare function formatReadyBlock(block: ReadyBlock, ui?: Ui, isQuiet?: boolean): string[];
|
|
32
|
+
export declare function formatReadyBlock(block: ReadyBlock, ui?: Ui, isQuiet?: boolean, columns?: number | undefined): string[];
|
|
31
33
|
export declare function writeReadyBlock(block: ReadyBlock, ui?: Ui): void;
|
|
32
34
|
declare const TIMED_LEVEL_COLORS: {
|
|
33
35
|
readonly success: "green";
|
|
@@ -38,6 +40,7 @@ type TimedLevel = keyof typeof TIMED_LEVEL_COLORS;
|
|
|
38
40
|
export interface TimedMessageOptions {
|
|
39
41
|
details?: readonly string[];
|
|
40
42
|
fixes?: readonly string[];
|
|
43
|
+
columns?: number;
|
|
41
44
|
}
|
|
42
45
|
export declare function formatTimedMessage(level: TimedLevel, text: string, options?: TimedMessageOptions, ui?: Ui, now?: Date): string;
|
|
43
46
|
export {};
|
package/dist/output.js
CHANGED
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.exitOnBrokenPipe = exitOnBrokenPipe;
|
|
4
4
|
exports.isTerminalFeedback = isTerminalFeedback;
|
|
5
5
|
exports.isTerminalResult = isTerminalResult;
|
|
6
|
+
exports.feedbackColumns = feedbackColumns;
|
|
7
|
+
exports.wrapAfter = wrapAfter;
|
|
6
8
|
exports.writeFeedback = writeFeedback;
|
|
7
9
|
exports.writeInfo = writeInfo;
|
|
8
10
|
exports.writeHeader = writeHeader;
|
|
@@ -21,6 +23,7 @@ exports.writeReadyBlock = writeReadyBlock;
|
|
|
21
23
|
exports.formatTimedMessage = formatTimedMessage;
|
|
22
24
|
const node_os_1 = require("node:os");
|
|
23
25
|
const node_path_1 = require("node:path");
|
|
26
|
+
const node_util_1 = require("node:util");
|
|
24
27
|
const cli_1 = require("@antelopejs/core/cli");
|
|
25
28
|
const cancellation_1 = require("./cancellation");
|
|
26
29
|
const HOME_PREFIX = "~";
|
|
@@ -34,6 +37,8 @@ const BLOCK_INDENT = " ";
|
|
|
34
37
|
const LINK_GAP = " ";
|
|
35
38
|
const LABEL_SUFFIX = ":";
|
|
36
39
|
const TIME_LENGTH = 8;
|
|
40
|
+
const MIN_WRAP_WIDTH = 20;
|
|
41
|
+
const LEADING_SPACES = /^ */;
|
|
37
42
|
const BYTES_PER_UNIT = 1024;
|
|
38
43
|
const SIZE_UNITS = ["B", "KB", "MB", "GB", "TB"];
|
|
39
44
|
const DECIMAL_SIZE_LIMIT = 10;
|
|
@@ -56,6 +61,17 @@ function isTerminalFeedback() {
|
|
|
56
61
|
function isTerminalResult() {
|
|
57
62
|
return (0, cli_1.detectCapabilities)((0, cli_1.processCapabilityContext)()).terminals.result;
|
|
58
63
|
}
|
|
64
|
+
function feedbackColumns() {
|
|
65
|
+
return isTerminalFeedback() ? process.stderr.columns || undefined : undefined;
|
|
66
|
+
}
|
|
67
|
+
function wrapAfter(prefix, text, columns, paint = (line) => line) {
|
|
68
|
+
const indent = " ".repeat((0, node_util_1.stripVTControlCharacters)(prefix).length);
|
|
69
|
+
const leading = LEADING_SPACES.exec(text)?.[0] ?? "";
|
|
70
|
+
const lines = columns === undefined
|
|
71
|
+
? [text]
|
|
72
|
+
: (0, cli_1.wrapText)(text.slice(leading.length), Math.max(MIN_WRAP_WIDTH, columns - indent.length - leading.length)).map((line) => `${leading}${line}`);
|
|
73
|
+
return lines.map((line, index) => `${index === 0 ? prefix : indent}${paint(line)}`);
|
|
74
|
+
}
|
|
59
75
|
function writeFeedback(line) {
|
|
60
76
|
(0, cli_1.getProcessTasks)().write(process.stderr, `${line}\n`);
|
|
61
77
|
}
|
|
@@ -65,7 +81,10 @@ function writeInfo(line) {
|
|
|
65
81
|
}
|
|
66
82
|
function writeHeader(command, context, ui = (0, cli_1.getProcessUi)()) {
|
|
67
83
|
const title = ui.palette().bold(`ajs dms ${command}`);
|
|
68
|
-
|
|
84
|
+
const text = context.join(ui.symbols.separator);
|
|
85
|
+
for (const line of wrapAfter(`${title} `, text, feedbackColumns())) {
|
|
86
|
+
writeInfo(line);
|
|
87
|
+
}
|
|
69
88
|
}
|
|
70
89
|
function writeBlankLine() {
|
|
71
90
|
writeInfo("");
|
|
@@ -163,9 +182,11 @@ function reportStopped(stop, ui = (0, cli_1.getProcessUi)()) {
|
|
|
163
182
|
? STOPPED_SYMBOLS.unicode
|
|
164
183
|
: STOPPED_SYMBOLS.ascii;
|
|
165
184
|
const text = [stop.stopped, ...stop.context].join(ui.symbols.separator);
|
|
166
|
-
|
|
185
|
+
const symbolPrefix = `${ui.palette().red(symbol)} `;
|
|
186
|
+
const lines = wrapAfter(symbolPrefix, text, feedbackColumns());
|
|
187
|
+
writeFeedback(`${lineStart}${lines.join("\n")}`);
|
|
167
188
|
}
|
|
168
|
-
function formatReadyBlock(block, ui = (0, cli_1.getProcessUi)(), isQuiet = (0, cli_1.isQuietRun)()) {
|
|
189
|
+
function formatReadyBlock(block, ui = (0, cli_1.getProcessUi)(), isQuiet = (0, cli_1.isQuietRun)(), columns = feedbackColumns()) {
|
|
169
190
|
const palette = ui.palette();
|
|
170
191
|
const arrow = isUnicode(ui) ? LINK_SYMBOLS.unicode : LINK_SYMBOLS.ascii;
|
|
171
192
|
const shown = isQuiet
|
|
@@ -173,18 +194,17 @@ function formatReadyBlock(block, ui = (0, cli_1.getProcessUi)(), isQuiet = (0, c
|
|
|
173
194
|
: block.lines;
|
|
174
195
|
const width = Math.max(...shown.map(({ label }) => label.length + LABEL_SUFFIX.length));
|
|
175
196
|
const lead = (isLink) => `${BLOCK_INDENT}${isLink ? palette.cyan(arrow) : " ".repeat(arrow.length)}${LINK_GAP}`;
|
|
176
|
-
const lines = shown.
|
|
197
|
+
const lines = shown.flatMap(({ label, value, isLink }) => {
|
|
177
198
|
const shownLabel = `${label}${LABEL_SUFFIX}`.padEnd(width);
|
|
178
|
-
|
|
179
|
-
return `${lead(isLink)}${palette.dim(shownLabel)} ${shownValue}`;
|
|
199
|
+
return wrapAfter(`${lead(isLink)}${palette.dim(shownLabel)} `, value, columns, isLink ? palette.cyan : undefined);
|
|
180
200
|
});
|
|
181
201
|
if (isQuiet)
|
|
182
202
|
return lines;
|
|
183
203
|
return [
|
|
184
|
-
`${palette.green(ui.symbols.levels.success)}
|
|
204
|
+
...wrapAfter(`${palette.green(ui.symbols.levels.success)} `, block.title, columns),
|
|
185
205
|
"",
|
|
186
206
|
...lines,
|
|
187
|
-
|
|
207
|
+
...wrapAfter(lead(), block.footer, columns, palette.dim),
|
|
188
208
|
];
|
|
189
209
|
}
|
|
190
210
|
function writeReadyBlock(block, ui = (0, cli_1.getProcessUi)()) {
|
|
@@ -201,14 +221,14 @@ function clockTime(date) {
|
|
|
201
221
|
return date.toTimeString().slice(0, TIME_LENGTH);
|
|
202
222
|
}
|
|
203
223
|
function formatTimedMessage(level, text, options = {}, ui = (0, cli_1.getProcessUi)(), now = new Date()) {
|
|
204
|
-
const { details = [], fixes = [] } = options;
|
|
224
|
+
const { details = [], fixes = [], columns = feedbackColumns() } = options;
|
|
205
225
|
const palette = ui.palette();
|
|
206
226
|
const paint = palette[TIMED_LEVEL_COLORS[level]];
|
|
207
227
|
const hint = palette.cyan(ui.symbols.levels.hint);
|
|
208
228
|
const indent = " ".repeat(TIME_LENGTH + 1) + BLOCK_INDENT;
|
|
209
229
|
return [
|
|
210
|
-
`${palette.dim(clockTime(now))} ${paint(ui.symbols.levels[level])}
|
|
211
|
-
...details.
|
|
212
|
-
...fixes.
|
|
230
|
+
...wrapAfter(`${palette.dim(clockTime(now))} ${paint(ui.symbols.levels[level])} `, text, columns),
|
|
231
|
+
...details.flatMap((detail) => wrapAfter(indent, detail, columns, palette.dim)),
|
|
232
|
+
...fixes.flatMap((fix) => wrapAfter(`${indent}${hint} `, fix, columns)),
|
|
213
233
|
].join("\n");
|
|
214
234
|
}
|
package/dist/update-check.d.ts
CHANGED
package/dist/update-check.js
CHANGED
|
@@ -182,11 +182,11 @@ function fetchLatestVersionFromRegistry(packageName, registryUrl = DEFAULT_REGIS
|
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
function formatNotice(currentVersion, latestVersion, ui) {
|
|
185
|
+
function formatNotice(currentVersion, latestVersion, ui, columns) {
|
|
186
186
|
const palette = ui.palette("feedback");
|
|
187
187
|
const { info, hint } = ui.symbols.levels;
|
|
188
|
-
return (`${palette.blue(info)} ajs dms ${latestVersion} is available ` +
|
|
189
|
-
|
|
188
|
+
return (0, output_1.wrapAfter)(`${palette.blue(info)} `, `ajs dms ${latestVersion} is available (you have ${currentVersion}) ` +
|
|
189
|
+
palette.cyan(`${hint} ${UPDATE_COMMAND}`), columns);
|
|
190
190
|
}
|
|
191
191
|
async function isNewer(currentVersion, latestVersion) {
|
|
192
192
|
if (currentVersion === latestVersion)
|
|
@@ -200,7 +200,7 @@ async function isNewer(currentVersion, latestVersion) {
|
|
|
200
200
|
}
|
|
201
201
|
function startUpdateCheck(options) {
|
|
202
202
|
try {
|
|
203
|
-
const { currentVersion, argv = process.argv.slice(2), env = process.env, isTerminal = (0, output_1.isTerminalFeedback)(), now = Date.now, cacheFile = updateCheckCacheFile(), fetchLatestVersion = fetchLatestVersionFromRegistry, ui = (0, cli_1.getProcessUi)(), write = output_1.writeFeedback, } = options;
|
|
203
|
+
const { currentVersion, argv = process.argv.slice(2), env = process.env, isTerminal = (0, output_1.isTerminalFeedback)(), now = Date.now, cacheFile = updateCheckCacheFile(), fetchLatestVersion = fetchLatestVersionFromRegistry, ui = (0, cli_1.getProcessUi)(), write = output_1.writeFeedback, columns = (0, output_1.feedbackColumns)(), } = options;
|
|
204
204
|
if (!isTerminal || !isUpdateCheckEnabled(argv, env))
|
|
205
205
|
return undefined;
|
|
206
206
|
const cached = readCache(cacheFile);
|
|
@@ -230,8 +230,10 @@ function startUpdateCheck(options) {
|
|
|
230
230
|
const known = latestVersion;
|
|
231
231
|
if (!known || !(await isNewer(currentVersion, known)))
|
|
232
232
|
return;
|
|
233
|
-
const
|
|
234
|
-
for (const text of placement.isFollowed
|
|
233
|
+
const lines = formatNotice(currentVersion, known, ui, columns);
|
|
234
|
+
for (const text of placement.isFollowed
|
|
235
|
+
? [...lines, ""]
|
|
236
|
+
: ["", ...lines]) {
|
|
235
237
|
write(text);
|
|
236
238
|
}
|
|
237
239
|
};
|
|
@@ -43,6 +43,7 @@ const output_1 = require("./output");
|
|
|
43
43
|
const temporary_workspace_1 = require("./temporary-workspace");
|
|
44
44
|
const typecheck_output_1 = require("./typecheck-output");
|
|
45
45
|
const verify_source_result_1 = require("./verify-source-result");
|
|
46
|
+
const verify_source_sources_1 = require("./verify-source-sources");
|
|
46
47
|
const vite_output_1 = require("./vite-output");
|
|
47
48
|
const EMAIL_BUILD_SIZE_CEILING_BYTES = 256 * 1024;
|
|
48
49
|
const NON_EMAIL_RUNTIME_PATTERN = /DisplayRichText|ApexCharts|Tiptap|FlowCanvas|app\/.*table|components\/table/i;
|
|
@@ -58,44 +59,6 @@ function ensure(condition, title, reason) {
|
|
|
58
59
|
if (!condition)
|
|
59
60
|
throw new cli_1.CliError({ title, reason });
|
|
60
61
|
}
|
|
61
|
-
function readLayer(root) {
|
|
62
|
-
const packagePath = (0, node_path_1.join)(root, "package.json");
|
|
63
|
-
if (!(0, node_fs_1.existsSync)(packagePath))
|
|
64
|
-
throw new common_1.UsageError({
|
|
65
|
-
title: `No package.json in ${(0, output_1.showPath)(root)}`,
|
|
66
|
-
fixes: [verify_source_result_1.LAYER_PATH_FIX],
|
|
67
|
-
});
|
|
68
|
-
const { name } = readJson(packagePath);
|
|
69
|
-
return { path: root, sourcePath: root, packageName: name };
|
|
70
|
-
}
|
|
71
|
-
function readSources() {
|
|
72
|
-
const layerSource = process.env.DMS_LAYER_SOURCE;
|
|
73
|
-
if (!layerSource)
|
|
74
|
-
throw new common_1.UsageError({
|
|
75
|
-
title: "DMS_LAYER_SOURCE is not set",
|
|
76
|
-
fixes: [
|
|
77
|
-
`Set it to the root of a DMS frontend package, or run ${verify_source_result_1.VERIFY_SOURCE_COMMAND} -l <path>`,
|
|
78
|
-
],
|
|
79
|
-
});
|
|
80
|
-
const sourceRoot = (0, node_path_1.resolve)(layerSource);
|
|
81
|
-
if (!(0, node_fs_1.statSync)(sourceRoot, { throwIfNoEntry: false })?.isDirectory())
|
|
82
|
-
throw new common_1.UsageError({
|
|
83
|
-
title: `Layer path not found: ${(0, output_1.showPath)(sourceRoot)}`,
|
|
84
|
-
fixes: [verify_source_result_1.LAYER_PATH_FIX],
|
|
85
|
-
});
|
|
86
|
-
const extraSources = JSON.parse(process.env.DMS_MODULE_SOURCES ?? "[]");
|
|
87
|
-
const layerRoots = (0, node_fs_1.existsSync)((0, node_path_1.join)(sourceRoot, "dms.frontend.ts"))
|
|
88
|
-
? [sourceRoot]
|
|
89
|
-
: (0, node_fs_1.readdirSync)(sourceRoot, { withFileTypes: true })
|
|
90
|
-
.filter((entry) => entry.isDirectory())
|
|
91
|
-
.map((entry) => (0, node_path_1.join)(sourceRoot, entry.name));
|
|
92
|
-
if (layerRoots.length === 0)
|
|
93
|
-
throw new common_1.UsageError({
|
|
94
|
-
title: `No frontend package in ${(0, output_1.showPath)(sourceRoot)}`,
|
|
95
|
-
fixes: [verify_source_result_1.LAYER_PATH_FIX],
|
|
96
|
-
});
|
|
97
|
-
return [...layerRoots, ...extraSources.map((root) => (0, node_path_1.resolve)(root))].map(readLayer);
|
|
98
|
-
}
|
|
99
62
|
function removeDevelopmentDependencies(root) {
|
|
100
63
|
const packagePath = (0, node_path_1.join)(root, "package.json");
|
|
101
64
|
if (!(0, node_fs_1.existsSync)(packagePath))
|
|
@@ -104,7 +67,7 @@ function removeDevelopmentDependencies(root) {
|
|
|
104
67
|
delete packageData.devDependencies;
|
|
105
68
|
(0, node_fs_1.writeFileSync)(packagePath, `${JSON.stringify(packageData, null, 2)}\n`);
|
|
106
69
|
}
|
|
107
|
-
function materializeWorkspace(workspace, layers) {
|
|
70
|
+
function materializeWorkspace(workspace, layers, localPackages) {
|
|
108
71
|
const templateRoot = (0, node_path_1.join)((0, common_1.getPackageRoot)(), "templates", "vue");
|
|
109
72
|
const templateFiles = (0, node_fs_1.readdirSync)(templateRoot).filter((file) => !file.startsWith("npmrc"));
|
|
110
73
|
for (const file of templateFiles)
|
|
@@ -121,7 +84,6 @@ function materializeWorkspace(workspace, layers) {
|
|
|
121
84
|
(0, common_1.writeWorkspacePackageJson)(workspace, layers);
|
|
122
85
|
const packagePath = (0, node_path_1.join)(workspace, "package.json");
|
|
123
86
|
const workspacePackage = readJson(packagePath);
|
|
124
|
-
const localPackages = JSON.parse(process.env.DMS_LOCAL_PACKAGES ?? "{}");
|
|
125
87
|
workspacePackage.pnpm = {
|
|
126
88
|
overrides: {
|
|
127
89
|
...Object.fromEntries(layers.map((layer) => [layer.packageName, "workspace:*"])),
|
|
@@ -314,8 +276,10 @@ function describeError(error, isVerbose) {
|
|
|
314
276
|
};
|
|
315
277
|
}
|
|
316
278
|
async function verifySources() {
|
|
317
|
-
const
|
|
279
|
+
const options = (0, verify_source_sources_1.readSourceOptions)();
|
|
280
|
+
const { layers, coreLayer } = (0, verify_source_sources_1.readSources)(options);
|
|
318
281
|
(0, output_1.writeHeader)("verify-source", [(0, cli_1.pluralize)(layers.length, "module")]);
|
|
282
|
+
(0, cli_1.getProcessUi)().message("info", `Verifying against ${coreLayer}`);
|
|
319
283
|
(0, common_1.assertLayersSupportRenderer)(layers);
|
|
320
284
|
const workspace = (0, temporary_workspace_1.createTemporaryWorkspace)("dms-frontend-real-source-");
|
|
321
285
|
const isVerbose = (0, cli_1.isVerboseRun)();
|
|
@@ -327,7 +291,7 @@ async function verifySources() {
|
|
|
327
291
|
env: { ...process.env, [vite_output_1.VITE_LOG_LEVEL_VARIABLE]: (0, vite_output_1.viteLogLevel)(isVerbose) },
|
|
328
292
|
};
|
|
329
293
|
const tasks = (0, cli_1.getProcessTasks)();
|
|
330
|
-
await tasks.run(`Materializing ${(0, cli_1.pluralize)(layers.length, "module")}`, async () => materializeWorkspace(workspace, layers), { done: `Materialized ${(0, cli_1.pluralize)(layers.length, "module")}` });
|
|
294
|
+
await tasks.run(`Materializing ${(0, cli_1.pluralize)(layers.length, "module")}`, async () => materializeWorkspace(workspace, layers, options.localPackages), { done: `Materialized ${(0, cli_1.pluralize)(layers.length, "module")}` });
|
|
331
295
|
await (0, common_1.installDeps)(workspace, context.mapLine, ["--ignore-scripts"]);
|
|
332
296
|
await buildBundles(context);
|
|
333
297
|
await tasks.run("Checking the client bundle", async () => checkClientBundle(workspace), { done: "Client bundle checked", failed: "Client bundle check failed" });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ResolvedLayer } from "./common";
|
|
2
|
+
export interface SourceOptions {
|
|
3
|
+
projectDir: string;
|
|
4
|
+
layerSource?: string;
|
|
5
|
+
moduleSources: string[];
|
|
6
|
+
localPackages: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
export interface Sources {
|
|
9
|
+
layers: ResolvedLayer[];
|
|
10
|
+
coreLayer: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function readSourceOptions(): SourceOptions;
|
|
13
|
+
export declare function readSources(options: SourceOptions): Sources;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readSourceOptions = readSourceOptions;
|
|
4
|
+
exports.readSources = readSources;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
const output_1 = require("./output");
|
|
9
|
+
const verify_source_result_1 = require("./verify-source-result");
|
|
10
|
+
const DMS_PACKAGE = "@antelopejs/dms";
|
|
11
|
+
const DMS_CORE_LAYER_PACKAGE = "@antelopejs/dms-frontend-vue";
|
|
12
|
+
const CORE_LAYER_DIRECTORY = "frontend-vue";
|
|
13
|
+
const FRONTEND_ENTRY = "dms.frontend.ts";
|
|
14
|
+
const ADD_DEV_DEPENDENCY = {
|
|
15
|
+
pnpm: "pnpm add -D",
|
|
16
|
+
npm: "npm install -D",
|
|
17
|
+
yarn: "yarn add -D",
|
|
18
|
+
bun: "bun add -d",
|
|
19
|
+
};
|
|
20
|
+
const LOCKFILES = [
|
|
21
|
+
["pnpm-lock.yaml", "pnpm"],
|
|
22
|
+
["package-lock.json", "npm"],
|
|
23
|
+
["yarn.lock", "yarn"],
|
|
24
|
+
["bun.lock", "bun"],
|
|
25
|
+
["bun.lockb", "bun"],
|
|
26
|
+
];
|
|
27
|
+
function readSourceOptions() {
|
|
28
|
+
return {
|
|
29
|
+
projectDir: process.cwd(),
|
|
30
|
+
layerSource: process.env.DMS_LAYER_SOURCE || undefined,
|
|
31
|
+
moduleSources: JSON.parse(process.env.DMS_MODULE_SOURCES ?? "[]"),
|
|
32
|
+
localPackages: JSON.parse(process.env.DMS_LOCAL_PACKAGES ?? "{}"),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function readManifest(packagePath) {
|
|
36
|
+
return JSON.parse((0, node_fs_1.readFileSync)(packagePath, "utf8"));
|
|
37
|
+
}
|
|
38
|
+
function readLayer(root) {
|
|
39
|
+
const packagePath = (0, node_path_1.join)(root, "package.json");
|
|
40
|
+
if (!(0, node_fs_1.existsSync)(packagePath))
|
|
41
|
+
throw new common_1.UsageError({
|
|
42
|
+
title: `No package.json in ${(0, output_1.showPath)(root)}`,
|
|
43
|
+
fixes: [verify_source_result_1.LAYER_PATH_FIX],
|
|
44
|
+
});
|
|
45
|
+
const { name } = readManifest(packagePath);
|
|
46
|
+
return { path: root, sourcePath: root, packageName: name };
|
|
47
|
+
}
|
|
48
|
+
function isCoreLayer(layer) {
|
|
49
|
+
return layer.packageName === DMS_CORE_LAYER_PACKAGE;
|
|
50
|
+
}
|
|
51
|
+
function shellArgument(path) {
|
|
52
|
+
return /^[\w@%+=:,./~-]+$/.test(path) ? path : JSON.stringify(path);
|
|
53
|
+
}
|
|
54
|
+
function defaultModuleRoot(projectDir) {
|
|
55
|
+
const root = [projectDir, (0, node_path_1.join)(projectDir, CORE_LAYER_DIRECTORY)].find((candidate) => (0, node_fs_1.existsSync)((0, node_path_1.join)(candidate, FRONTEND_ENTRY)));
|
|
56
|
+
if (root)
|
|
57
|
+
return root;
|
|
58
|
+
throw new common_1.UsageError({
|
|
59
|
+
title: "No frontend module to verify",
|
|
60
|
+
reason: `Neither ${(0, output_1.showPath)(projectDir)} nor its ${CORE_LAYER_DIRECTORY} directory contains ${FRONTEND_ENTRY}.`,
|
|
61
|
+
fixes: [
|
|
62
|
+
`Run the command from the frontend module, or pass its root with -m`,
|
|
63
|
+
],
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function packageManager(projectDir) {
|
|
67
|
+
for (let directory = projectDir;; directory = (0, node_path_1.dirname)(directory)) {
|
|
68
|
+
const packagePath = (0, node_path_1.join)(directory, "package.json");
|
|
69
|
+
if ((0, node_fs_1.existsSync)(packagePath)) {
|
|
70
|
+
const [name] = (readManifest(packagePath).packageManager ?? "").split("@");
|
|
71
|
+
if (name && ADD_DEV_DEPENDENCY[name])
|
|
72
|
+
return name;
|
|
73
|
+
const lockfile = LOCKFILES.find(([file]) => (0, node_fs_1.existsSync)((0, node_path_1.join)(directory, file)));
|
|
74
|
+
if (lockfile)
|
|
75
|
+
return lockfile[1];
|
|
76
|
+
}
|
|
77
|
+
if ((0, node_path_1.dirname)(directory) === directory)
|
|
78
|
+
return "pnpm";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function addDmsCommand(projectDir, version = "") {
|
|
82
|
+
return `${ADD_DEV_DEPENDENCY[packageManager(projectDir)]} ${DMS_PACKAGE}${version}`;
|
|
83
|
+
}
|
|
84
|
+
function describeDirectory(directory) {
|
|
85
|
+
return (0, node_path_1.resolve)(directory) === process.cwd()
|
|
86
|
+
? "the current directory"
|
|
87
|
+
: (0, output_1.showPath)(directory);
|
|
88
|
+
}
|
|
89
|
+
function resolveDmsPackage(projectDir) {
|
|
90
|
+
try {
|
|
91
|
+
return require.resolve(`${DMS_PACKAGE}/package.json`, {
|
|
92
|
+
paths: [projectDir],
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function installedCoreLayer(projectDir) {
|
|
100
|
+
const packagePath = resolveDmsPackage(projectDir);
|
|
101
|
+
if (!packagePath)
|
|
102
|
+
throw new common_1.UsageError({
|
|
103
|
+
title: `${DMS_PACKAGE} is not installed in this project`,
|
|
104
|
+
reason: `Frontend modules are verified on top of the DMS core layer that ${DMS_PACKAGE} ships, and Node finds no ${DMS_PACKAGE} from ${describeDirectory(projectDir)}.`,
|
|
105
|
+
fixes: [
|
|
106
|
+
`Add it as a development dependency: ${addDmsCommand(projectDir)}`,
|
|
107
|
+
],
|
|
108
|
+
});
|
|
109
|
+
const { version } = readManifest(packagePath);
|
|
110
|
+
const root = (0, node_path_1.join)((0, node_path_1.dirname)(packagePath), CORE_LAYER_DIRECTORY);
|
|
111
|
+
const layer = (0, node_fs_1.existsSync)((0, node_path_1.join)(root, "package.json"))
|
|
112
|
+
? readLayer(root)
|
|
113
|
+
: undefined;
|
|
114
|
+
if (!layer || !isCoreLayer(layer))
|
|
115
|
+
throw new common_1.UsageError({
|
|
116
|
+
title: `${DMS_PACKAGE} ${version} ships no DMS core layer`,
|
|
117
|
+
reason: `${(0, output_1.showPath)((0, node_path_1.dirname)(packagePath))} has no ${CORE_LAYER_DIRECTORY} directory holding ${DMS_CORE_LAYER_PACKAGE}.`,
|
|
118
|
+
fixes: [`Update it: ${addDmsCommand(projectDir, "@latest")}`],
|
|
119
|
+
});
|
|
120
|
+
return {
|
|
121
|
+
layers: [layer],
|
|
122
|
+
coreLayer: `${DMS_PACKAGE} ${version} (installed in this project)`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function notCoreLayer(sourceRoot, layers, modules, localPackages) {
|
|
126
|
+
const command = [
|
|
127
|
+
verify_source_result_1.VERIFY_SOURCE_COMMAND,
|
|
128
|
+
...[...layers, ...modules].flatMap((layer) => [
|
|
129
|
+
"-m",
|
|
130
|
+
shellArgument((0, output_1.showPath)(layer.path)),
|
|
131
|
+
]),
|
|
132
|
+
...Object.entries(localPackages).flatMap(([name, path]) => [
|
|
133
|
+
"--local-package",
|
|
134
|
+
shellArgument(`${name}=${(0, output_1.showPath)(path)}`),
|
|
135
|
+
]),
|
|
136
|
+
].join(" ");
|
|
137
|
+
const names = layers
|
|
138
|
+
.map((layer) => layer.packageName ?? "a package without a name")
|
|
139
|
+
.join(", ");
|
|
140
|
+
const shown = (0, output_1.showPath)(sourceRoot);
|
|
141
|
+
return {
|
|
142
|
+
title: `${shown} is not the DMS core layer`,
|
|
143
|
+
reason: `--layer is for verifying an unpublished DMS core layer, ${DMS_CORE_LAYER_PACKAGE}, and ${shown} holds ${names}. ` +
|
|
144
|
+
`Without it, frontend modules are verified on the core layer of the ${DMS_PACKAGE} installed in the project.`,
|
|
145
|
+
fixes: [`Drop -l and pass the folder with -m: ${command}`],
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function readLayerSource(layerSource) {
|
|
149
|
+
const sourceRoot = (0, node_path_1.resolve)(layerSource);
|
|
150
|
+
if (!(0, node_fs_1.statSync)(sourceRoot, { throwIfNoEntry: false })?.isDirectory())
|
|
151
|
+
throw new common_1.UsageError({
|
|
152
|
+
title: `Layer path not found: ${(0, output_1.showPath)(sourceRoot)}`,
|
|
153
|
+
fixes: [verify_source_result_1.LAYER_PATH_FIX],
|
|
154
|
+
});
|
|
155
|
+
const roots = (0, node_fs_1.existsSync)((0, node_path_1.join)(sourceRoot, FRONTEND_ENTRY))
|
|
156
|
+
? [sourceRoot]
|
|
157
|
+
: (0, node_fs_1.readdirSync)(sourceRoot, { withFileTypes: true })
|
|
158
|
+
.filter((entry) => entry.isDirectory())
|
|
159
|
+
.map((entry) => (0, node_path_1.join)(sourceRoot, entry.name));
|
|
160
|
+
if (roots.length === 0)
|
|
161
|
+
throw new common_1.UsageError({
|
|
162
|
+
title: `No frontend package in ${(0, output_1.showPath)(sourceRoot)}`,
|
|
163
|
+
fixes: [verify_source_result_1.LAYER_PATH_FIX],
|
|
164
|
+
});
|
|
165
|
+
return { sourceRoot, layers: roots.map(readLayer) };
|
|
166
|
+
}
|
|
167
|
+
function readSources(options) {
|
|
168
|
+
const { projectDir, layerSource, localPackages } = options;
|
|
169
|
+
const modules = (options.moduleSources.length > 0 || layerSource
|
|
170
|
+
? options.moduleSources.map((root) => (0, node_path_1.resolve)(root))
|
|
171
|
+
: [defaultModuleRoot(projectDir)]).map(readLayer);
|
|
172
|
+
if (layerSource) {
|
|
173
|
+
const { sourceRoot, layers } = readLayerSource(layerSource);
|
|
174
|
+
if (!layers.some(isCoreLayer))
|
|
175
|
+
throw new common_1.UsageError(notCoreLayer(sourceRoot, layers, modules, localPackages));
|
|
176
|
+
return {
|
|
177
|
+
layers: [...layers, ...modules],
|
|
178
|
+
coreLayer: `the DMS core layer in ${(0, output_1.showPath)(sourceRoot)}`,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
const passedCore = modules.find(isCoreLayer);
|
|
182
|
+
if (passedCore)
|
|
183
|
+
return {
|
|
184
|
+
layers: [passedCore, ...modules.filter((layer) => layer !== passedCore)],
|
|
185
|
+
coreLayer: `the DMS core layer in ${(0, output_1.showPath)(passedCore.path)}`,
|
|
186
|
+
};
|
|
187
|
+
const installed = installedCoreLayer(projectDir);
|
|
188
|
+
return { ...installed, layers: [...installed.layers, ...modules] };
|
|
189
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms-frontend",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "Frontend-agnostic loader for AntelopeJS DMS, shipping the Vue 3 renderer (Vite, Inertia, SSR)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelope",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"unzipper": "^0.12.3"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@antelopejs/core": "^1.13.
|
|
76
|
+
"@antelopejs/core": "^1.13.2",
|
|
77
77
|
"@antelopejs/tooling-configs": ">=0.0.7 <1.0.0",
|
|
78
78
|
"@iconify/utils": "^3.1.0",
|
|
79
79
|
"@iconify/vue": "^5.0.1",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"vue-i18n": "^11.2.7"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@antelopejs/core": ">=1.13.
|
|
104
|
+
"@antelopejs/core": ">=1.13.2 <2"
|
|
105
105
|
},
|
|
106
106
|
"optionalDependencies": {
|
|
107
107
|
"@oxc-parser/binding-darwin-arm64": "^0.95.0",
|