@antelopejs/dms-frontend 0.3.10 → 0.3.11
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 +1 -1
- package/dist/commands/clean-action.d.ts +1 -1
- package/dist/commands/clean-action.js +16 -12
- 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/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
|
|
@@ -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) {
|
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
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms-frontend",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
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",
|