@packtory/cli 0.0.8 → 0.0.9
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/command-line-interface/config-loader.js +7 -5
- package/command-line-interface/config-loader.js.map +1 -1
- package/command-line-interface/one-time-password-prompt.js +29 -0
- package/command-line-interface/one-time-password-prompt.js.map +1 -0
- package/command-line-interface/preview-io-shared.js +75 -0
- package/command-line-interface/preview-io-shared.js.map +1 -0
- package/command-line-interface/preview-io.js +15 -0
- package/command-line-interface/preview-io.js.map +1 -0
- package/command-line-interface/runner.js +211 -76
- package/command-line-interface/runner.js.map +1 -1
- package/command-line-interface/spinner-boot.entry-point.js +25 -0
- package/command-line-interface/spinner-boot.entry-point.js.map +1 -0
- package/command-line-interface/spinner-boot.js +9 -0
- package/command-line-interface/spinner-boot.js.map +1 -0
- package/command-line-interface/spinner-shared-state.js +167 -0
- package/command-line-interface/spinner-shared-state.js.map +1 -0
- package/command-line-interface/spinner-worker-backend.js +62 -0
- package/command-line-interface/spinner-worker-backend.js.map +1 -0
- package/command-line-interface/terminal-spinner-renderer.js +21 -15
- package/command-line-interface/terminal-spinner-renderer.js.map +1 -1
- package/common/typed-diff.js +5 -0
- package/common/typed-diff.js.map +1 -0
- package/package.json +6 -6
- package/packages/command-line-interface/command-line-interface.entry-point.d.ts.map +1 -1
- package/packages/command-line-interface/command-line-interface.entry-point.js +61 -7
- package/packages/command-line-interface/command-line-interface.entry-point.js.map +1 -1
- package/readme.md +33 -1
- package/report/changed-artifacts.js +10 -0
- package/report/changed-artifacts.js.map +1 -0
- package/report/html-escaping.js +9 -0
- package/report/html-escaping.js.map +1 -0
- package/report/html-renderer.js +337 -0
- package/report/html-renderer.js.map +1 -0
- package/report/preview-document-diff.js +17 -0
- package/report/preview-document-diff.js.map +1 -0
- package/report/preview-document-helpers.js +173 -0
- package/report/preview-document-helpers.js.map +1 -0
- package/report/preview-document-tree.js +13 -0
- package/report/preview-document-tree.js.map +1 -0
- package/report/preview-document.js +97 -0
- package/report/preview-document.js.map +1 -0
- package/report/terminal-preview-renderer-shared.js +41 -0
- package/report/terminal-preview-renderer-shared.js.map +1 -0
- package/report/terminal-preview-renderer.js +94 -0
- package/report/terminal-preview-renderer.js.map +1 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
const headerByteLength = 16;
|
|
2
|
+
const slotByteLength = 384;
|
|
3
|
+
const labelByteLength = 64;
|
|
4
|
+
const messageByteLength = 256;
|
|
5
|
+
const slotStateOffset = 4;
|
|
6
|
+
const slotLabelLengthOffset = 8;
|
|
7
|
+
const slotMessageLengthOffset = 10;
|
|
8
|
+
const slotLabelOffset = 16;
|
|
9
|
+
const slotMessageOffset = slotLabelOffset + labelByteLength;
|
|
10
|
+
const headerControlIndex = 0;
|
|
11
|
+
const headerColumnsIndex = 1;
|
|
12
|
+
const headerIntervalIndex = 2;
|
|
13
|
+
const slotGenerationIndex = 0;
|
|
14
|
+
const controlShutdownValue = 1;
|
|
15
|
+
const controlIdleValue = 0;
|
|
16
|
+
const maximumReadSlotAttempts = 1024;
|
|
17
|
+
const slotStateEmpty = 0;
|
|
18
|
+
const slotStateRunning = 1;
|
|
19
|
+
const slotStateSucceeded = 2;
|
|
20
|
+
const slotStateFailed = 3;
|
|
21
|
+
const slotStateCanceled = 4;
|
|
22
|
+
const textEncoder = new TextEncoder();
|
|
23
|
+
const textDecoder = new TextDecoder();
|
|
24
|
+
const stateToByteMap = {
|
|
25
|
+
empty: slotStateEmpty,
|
|
26
|
+
running: slotStateRunning,
|
|
27
|
+
succeeded: slotStateSucceeded,
|
|
28
|
+
failed: slotStateFailed,
|
|
29
|
+
canceled: slotStateCanceled
|
|
30
|
+
};
|
|
31
|
+
const byteToStateMap = {
|
|
32
|
+
[slotStateEmpty]: 'empty',
|
|
33
|
+
[slotStateRunning]: 'running',
|
|
34
|
+
[slotStateSucceeded]: 'succeeded',
|
|
35
|
+
[slotStateFailed]: 'failed',
|
|
36
|
+
[slotStateCanceled]: 'canceled'
|
|
37
|
+
};
|
|
38
|
+
export function createSpinnerSharedLayout(slotCount) {
|
|
39
|
+
return {
|
|
40
|
+
bufferByteLength: headerByteLength + slotCount * slotByteLength,
|
|
41
|
+
slotCount,
|
|
42
|
+
slotByteLength,
|
|
43
|
+
headerByteLength
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function stateToByte(state) {
|
|
47
|
+
return stateToByteMap[state];
|
|
48
|
+
}
|
|
49
|
+
function byteToState(byte) {
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- writers always go through stateToByteMap so the byte is one of the known state values
|
|
51
|
+
return byteToStateMap[byte];
|
|
52
|
+
}
|
|
53
|
+
const labelSlice = {
|
|
54
|
+
contentOffset: slotLabelOffset,
|
|
55
|
+
contentCapacity: labelByteLength,
|
|
56
|
+
lengthOffset: slotLabelLengthOffset
|
|
57
|
+
};
|
|
58
|
+
const messageSlice = {
|
|
59
|
+
contentOffset: slotMessageOffset,
|
|
60
|
+
contentCapacity: messageByteLength,
|
|
61
|
+
lengthOffset: slotMessageLengthOffset
|
|
62
|
+
};
|
|
63
|
+
function createViews(buffer, layout) {
|
|
64
|
+
const headerInt32 = new Int32Array(buffer);
|
|
65
|
+
const headerUint32 = new Uint32Array(buffer);
|
|
66
|
+
const slotOffset = (slotIndex) => {
|
|
67
|
+
return layout.headerByteLength + slotIndex * layout.slotByteLength;
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
headerInt32,
|
|
71
|
+
headerUint32,
|
|
72
|
+
slotInt32: (slotIndex) => {
|
|
73
|
+
return new Int32Array(buffer, slotOffset(slotIndex), 1);
|
|
74
|
+
},
|
|
75
|
+
slotBytes: (slotIndex) => {
|
|
76
|
+
return new Uint8Array(buffer, slotOffset(slotIndex), layout.slotByteLength);
|
|
77
|
+
},
|
|
78
|
+
slotData: (slotIndex) => {
|
|
79
|
+
return new DataView(buffer, slotOffset(slotIndex), layout.slotByteLength);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function writeStringIntoSlot(views, slotIndex, slice, value) {
|
|
84
|
+
const target = views
|
|
85
|
+
.slotBytes(slotIndex)
|
|
86
|
+
.subarray(slice.contentOffset, slice.contentOffset + slice.contentCapacity);
|
|
87
|
+
target.fill(0);
|
|
88
|
+
const { written } = textEncoder.encodeInto(value, target);
|
|
89
|
+
views.slotData(slotIndex).setUint16(slice.lengthOffset, written, true);
|
|
90
|
+
}
|
|
91
|
+
function readStringFromSlot(views, slotIndex, slice) {
|
|
92
|
+
const length = views.slotData(slotIndex).getUint16(slice.lengthOffset, true);
|
|
93
|
+
return textDecoder.decode(views.slotBytes(slotIndex).subarray(slice.contentOffset, slice.contentOffset + length));
|
|
94
|
+
}
|
|
95
|
+
function readSlotContent(views, slotIndex) {
|
|
96
|
+
return {
|
|
97
|
+
state: byteToState(views.slotData(slotIndex).getUint8(slotStateOffset)),
|
|
98
|
+
label: readStringFromSlot(views, slotIndex, labelSlice),
|
|
99
|
+
message: readStringFromSlot(views, slotIndex, messageSlice)
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function createSpinnerSharedAccessors(buffer, layout) {
|
|
103
|
+
const views = createViews(buffer, layout);
|
|
104
|
+
function writeStateByte(slotIndex, stateByte) {
|
|
105
|
+
views.slotData(slotIndex).setUint8(slotStateOffset, stateByte);
|
|
106
|
+
}
|
|
107
|
+
function readSlotGeneration(slotIndex) {
|
|
108
|
+
return Atomics.load(views.slotInt32(slotIndex), slotGenerationIndex);
|
|
109
|
+
}
|
|
110
|
+
function readSlotAttempt(slotIndex) {
|
|
111
|
+
return {
|
|
112
|
+
slot: readSlotContent(views, slotIndex),
|
|
113
|
+
generationAfter: readSlotGeneration(slotIndex)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
layout,
|
|
118
|
+
buffer,
|
|
119
|
+
setColumns(columns) {
|
|
120
|
+
Atomics.store(views.headerUint32, headerColumnsIndex, columns);
|
|
121
|
+
},
|
|
122
|
+
getColumns() {
|
|
123
|
+
return Atomics.load(views.headerUint32, headerColumnsIndex);
|
|
124
|
+
},
|
|
125
|
+
setIntervalMs(intervalMs) {
|
|
126
|
+
Atomics.store(views.headerUint32, headerIntervalIndex, intervalMs);
|
|
127
|
+
},
|
|
128
|
+
getIntervalMs() {
|
|
129
|
+
return Atomics.load(views.headerUint32, headerIntervalIndex);
|
|
130
|
+
},
|
|
131
|
+
requestShutdown() {
|
|
132
|
+
Atomics.store(views.headerInt32, headerControlIndex, controlShutdownValue);
|
|
133
|
+
},
|
|
134
|
+
isShutdownRequested() {
|
|
135
|
+
return Atomics.load(views.headerInt32, headerControlIndex) !== controlIdleValue;
|
|
136
|
+
},
|
|
137
|
+
bumpSlotGeneration(slotIndex) {
|
|
138
|
+
Atomics.add(views.slotInt32(slotIndex), slotGenerationIndex, 1);
|
|
139
|
+
},
|
|
140
|
+
writeSlot(slotIndex, state, label, message) {
|
|
141
|
+
writeStateByte(slotIndex, stateToByte(state));
|
|
142
|
+
writeStringIntoSlot(views, slotIndex, labelSlice, label);
|
|
143
|
+
writeStringIntoSlot(views, slotIndex, messageSlice, message);
|
|
144
|
+
},
|
|
145
|
+
readSlot(slotIndex) {
|
|
146
|
+
// Seqlock retry: writers atomically bump the slot generation after
|
|
147
|
+
// updating the (non-atomic) label/message bytes; if the generation
|
|
148
|
+
// moves between the two reads we observed a torn write and retry.
|
|
149
|
+
let generationBefore = readSlotGeneration(slotIndex);
|
|
150
|
+
const attempts = Array.from({ length: maximumReadSlotAttempts + 1 }, (_value, index) => {
|
|
151
|
+
return maximumReadSlotAttempts - index;
|
|
152
|
+
});
|
|
153
|
+
for (const remainingAttempts of attempts) {
|
|
154
|
+
if (remainingAttempts === 0) {
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
const attemptResult = readSlotAttempt(slotIndex);
|
|
158
|
+
if (attemptResult.generationAfter === generationBefore) {
|
|
159
|
+
return attemptResult.slot;
|
|
160
|
+
}
|
|
161
|
+
generationBefore = attemptResult.generationAfter;
|
|
162
|
+
}
|
|
163
|
+
throw new Error('Failed to read a stable spinner slot snapshot');
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=spinner-shared-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner-shared-state.js","sourceRoot":"","sources":["../../../../source/command-line-interface/spinner-shared-state.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,iBAAiB,GAAG,eAAe,GAAG,eAAe,CAAC;AAE5D,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,WAAW,E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,MAAM,EAAE,KAAK,EAAE,EAAE;gBACnF,OAAO,uBAAuB,GAAG,KAAK,CAAC;YAC3C,CAAC,CAAC,CAAC;YACH,KAAK,MAAM,iBAAiB,IAAI,QAAQ,EAAE,CAAC;gBACvC,IAAI,iBAAiB,KAAK,CAAC,EAAE,CAAC;oBAC1B,MAAM;gBACV,CAAC;gBACD,MAAM,aAAa,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;gBACjD,IAAI,aAAa,CAAC,eAAe,KAAK,gBAAgB,EAAE,CAAC;oBACrD,OAAO,aAAa,CAAC,IAAI,CAAC;gBAC9B,CAAC;gBACD,gBAAgB,GAAG,aAAa,CAAC,eAAe,CAAC;YACrD,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACrE,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createSpinnerSharedAccessors, createSpinnerSharedLayout } from "./spinner-shared-state.js";
|
|
2
|
+
const defaultSlotCount = 64;
|
|
3
|
+
const defaultIntervalMs = 80;
|
|
4
|
+
const defaultColumns = 80;
|
|
5
|
+
function resolveOptions(options) {
|
|
6
|
+
return {
|
|
7
|
+
slotCount: options.slotCount ?? defaultSlotCount,
|
|
8
|
+
intervalMs: options.intervalMs ?? defaultIntervalMs,
|
|
9
|
+
stdoutFileDescriptor: options.stdoutFileDescriptor ?? process.stdout.fd,
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- process.stdout.columns is undefined at runtime when stdout is not a TTY, despite the type declaring it as number
|
|
11
|
+
stdoutColumns: options.stdoutColumns ?? process.stdout.columns ?? defaultColumns,
|
|
12
|
+
spawnWorker: options.spawnWorker
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function setupSharedBuffer(resolved) {
|
|
16
|
+
const layout = createSpinnerSharedLayout(resolved.slotCount);
|
|
17
|
+
const buffer = new SharedArrayBuffer(layout.bufferByteLength);
|
|
18
|
+
const accessors = createSpinnerSharedAccessors(buffer, layout);
|
|
19
|
+
accessors.setIntervalMs(resolved.intervalMs);
|
|
20
|
+
accessors.setColumns(resolved.stdoutColumns);
|
|
21
|
+
return accessors;
|
|
22
|
+
}
|
|
23
|
+
export function createSpinnerRuntime(options) {
|
|
24
|
+
const resolved = resolveOptions(options);
|
|
25
|
+
const accessors = setupSharedBuffer(resolved);
|
|
26
|
+
resolved.spawnWorker({
|
|
27
|
+
buffer: accessors.buffer,
|
|
28
|
+
slotCount: accessors.layout.slotCount,
|
|
29
|
+
stdoutFileDescriptor: resolved.stdoutFileDescriptor
|
|
30
|
+
});
|
|
31
|
+
return { accessors, slotCount: resolved.slotCount };
|
|
32
|
+
}
|
|
33
|
+
function writeSlot(accessors, update) {
|
|
34
|
+
accessors.writeSlot(update.slotIndex, update.state, update.label, update.message);
|
|
35
|
+
accessors.bumpSlotGeneration(update.slotIndex);
|
|
36
|
+
}
|
|
37
|
+
export function createWorkerSpinnerBackend(dependencies) {
|
|
38
|
+
const { runtime } = dependencies;
|
|
39
|
+
function ensureSlotIndexFits(slotIndex) {
|
|
40
|
+
if (slotIndex >= runtime.slotCount) {
|
|
41
|
+
throw new RangeError(`Spinner slot index ${slotIndex} exceeds backend capacity ${runtime.slotCount}; increase slotCount`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
add(slotIndex, label, message) {
|
|
46
|
+
ensureSlotIndexFits(slotIndex);
|
|
47
|
+
writeSlot(runtime.accessors, { slotIndex, state: 'running', label, message });
|
|
48
|
+
},
|
|
49
|
+
update(slotIndex, label, message) {
|
|
50
|
+
ensureSlotIndexFits(slotIndex);
|
|
51
|
+
writeSlot(runtime.accessors, { slotIndex, state: 'running', label, message });
|
|
52
|
+
},
|
|
53
|
+
finish(slotIndex, status, label, message) {
|
|
54
|
+
ensureSlotIndexFits(slotIndex);
|
|
55
|
+
writeSlot(runtime.accessors, { slotIndex, state: status, label, message });
|
|
56
|
+
},
|
|
57
|
+
shutdown() {
|
|
58
|
+
runtime.accessors.requestShutdown();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=spinner-worker-backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner-worker-backend.js","sourceRoot":"","sources":["../../../../source/command-line-interface/spinner-worker-backend.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,4BAA4B,EAC5B,yBAAyB,EAG5B,MAAM,2BAA2B,CAAC;AAGnC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,cAAc,GAAG,EAAE,CAAC;AA+B1B,SAAS,cAAc,CAAC,OAA8B;IAClD,OAAO;QACH,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,gBAAgB;QAChD,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,iBAAiB;QACnD,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;QACvE,2LAA2L;QAC3L,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,cAAc;QAChF,WAAW,EAAE,OAAO,CAAC,WAAW;KACnC,CAAC;AACN,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAyB;IAChD,MAAM,MAAM,GAAG,yBAAyB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAC9D,MAAM,SAAS,GAAG,4BAA4B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/D,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC7C,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAC7C,OAAO,SAAS,CAAC;A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AAE,OAAO;YAC5B,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAC/B,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;YACpC,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAC/B,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAC/E,CAAC;QACD,QAAQ;YACJ,OAAO,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;QACxC,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
const cancelMessage = 'Canceled …';
|
|
1
2
|
export function createTerminalSpinnerRenderer(dependencies) {
|
|
2
|
-
const {
|
|
3
|
+
const { backend } = dependencies;
|
|
3
4
|
const spinners = new Map();
|
|
5
|
+
const usedSlots = new Set();
|
|
6
|
+
function nextFreeSlotIndex() {
|
|
7
|
+
return usedSlots.size;
|
|
8
|
+
}
|
|
4
9
|
function getSpinnerById(id) {
|
|
5
10
|
const spinner = spinners.get(id);
|
|
6
11
|
if (spinner === undefined) {
|
|
@@ -16,31 +21,32 @@ export function createTerminalSpinnerRenderer(dependencies) {
|
|
|
16
21
|
return {
|
|
17
22
|
add(id, label, message) {
|
|
18
23
|
ensureIdDoesNotExist(id);
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
const slotIndex = nextFreeSlotIndex();
|
|
25
|
+
usedSlots.add(slotIndex);
|
|
26
|
+
spinners.set(id, { slotIndex, label, message, status: 'running' });
|
|
27
|
+
backend.add(slotIndex, label, message);
|
|
22
28
|
},
|
|
23
29
|
updateMessage(id, message) {
|
|
24
30
|
const spinner = getSpinnerById(id);
|
|
25
|
-
spinner.
|
|
31
|
+
spinner.message = message;
|
|
32
|
+
backend.update(spinner.slotIndex, spinner.label, message);
|
|
26
33
|
},
|
|
27
34
|
stop(id, status, message) {
|
|
28
35
|
const spinner = getSpinnerById(id);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
else {
|
|
34
|
-
spinner.instance.succeed(message);
|
|
35
|
-
}
|
|
36
|
+
spinner.message = message;
|
|
37
|
+
spinner.status = status;
|
|
38
|
+
const finalState = status === 'success' ? 'succeeded' : 'failed';
|
|
39
|
+
backend.finish(spinner.slotIndex, finalState, spinner.label, message);
|
|
36
40
|
},
|
|
37
41
|
stopAll() {
|
|
38
42
|
for (const spinner of spinners.values()) {
|
|
39
|
-
if (spinner.
|
|
40
|
-
spinner.
|
|
43
|
+
if (spinner.status === 'running') {
|
|
44
|
+
spinner.message = cancelMessage;
|
|
45
|
+
backend.finish(spinner.slotIndex, 'canceled', spinner.label, cancelMessage);
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
|
-
|
|
48
|
+
spinners.clear();
|
|
49
|
+
backend.shutdown();
|
|
44
50
|
}
|
|
45
51
|
};
|
|
46
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-spinner-renderer.js","sourceRoot":"","sources":["../../../../source/command-line-interface/terminal-spinner-renderer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"terminal-spinner-renderer.js","sourceRoot":"","sources":["../../../../source/command-line-interface/terminal-spinner-renderer.ts"],"names":[],"mappings":"AAgCA,MAAM,aAAa,GAAG,YAAY,CAAC;AAEnC,MAAM,UAAU,6BAA6B,CACzC,YAAiD;IAEjD,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;IACjC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAuB,CAAC;IAChD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IAEpC,SAAS,iBAAiB;QACt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CAAC,OAAO,GAAG,OAAO,CAAC;YAC1B,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;YACxB,MAAM,UAAU,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;YACjE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC1E,CAAC;QAED,OAAO;YACH,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;gBACtC,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;oBAC/B,OAAO,CAAC,OAAO,GAAG,aAAa,CAAC;oBAChC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;gBAChF,CAAC;YACL,CAAC;YACD,QAAQ,CAAC,KAAK,EAAE,CAAC;YACjB,OAAO,CAAC,QAAQ,EAAE,CAAC;QACvB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-diff.js","sourceRoot":"","sources":["../../../../source/common/typed-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiE,MAAM,MAAM,CAAC;AAYtG,MAAM,UAAU,qBAAqB,CAAC,GAAG,IAAyB;IAC9D,OAAO,eAAe,CAAC,GAAG,IAAI,CAAC,CAAC;AACpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
"Christian Rackerseder <github@echooff.de>"
|
|
8
8
|
],
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@topcli/spinner": "4.2.1",
|
|
11
10
|
"cmd-ts": "0.15.0",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
11
|
+
"diff": "9.0.0",
|
|
12
|
+
"packtory": "0.0.9",
|
|
13
|
+
"remeda": "2.34.1",
|
|
14
|
+
"yoctocolors": "2.1.2"
|
|
15
15
|
},
|
|
16
16
|
"description": "Effortlessly bundle and publish npm packages from the command line with @packtory/cli.",
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": "^
|
|
18
|
+
"node": "^24 || ^26"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"bundler",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
},
|
|
39
39
|
"type": "module",
|
|
40
40
|
"types": "packages/command-line-interface/command-line-interface.entry-point.d.ts",
|
|
41
|
-
"version": "0.0.
|
|
41
|
+
"version": "0.0.9"
|
|
42
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-line-interface.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/command-line-interface/command-line-interface.entry-point.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"command-line-interface.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/command-line-interface/command-line-interface.entry-point.ts"],"names":[],"mappings":";AAOA,OAAO,KAAK,KAAK,WAAW,MAAM,wBAAwB,CAAC;AAsF3D,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC"}
|
|
@@ -7,25 +7,79 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
7
7
|
}
|
|
8
8
|
return path;
|
|
9
9
|
};
|
|
10
|
-
import
|
|
10
|
+
import fs from 'node:fs/promises';
|
|
11
|
+
import readline from 'node:readline/promises';
|
|
12
|
+
import { createClock } from "packtory/common/clock.js";
|
|
13
|
+
import { bootedSpinnerRuntime } from "../../command-line-interface/spinner-boot.entry-point.js";
|
|
14
|
+
import { createOneTimePasswordPrompt } from "../../command-line-interface/one-time-password-prompt.js";
|
|
11
15
|
import { createCommandLineInterfaceRunner } from "../../command-line-interface/runner.js";
|
|
12
16
|
import { createTerminalSpinnerRenderer } from "../../command-line-interface/terminal-spinner-renderer.js";
|
|
17
|
+
import { createWorkerSpinnerBackend } from "../../command-line-interface/spinner-worker-backend.js";
|
|
13
18
|
import { createConfigLoader } from "../../command-line-interface/config-loader.js";
|
|
14
|
-
import {
|
|
19
|
+
import { previewIo } from "../../command-line-interface/preview-io.js";
|
|
20
|
+
import { createPacktory } from "packtory/packtory/packtory.js";
|
|
21
|
+
import { createScheduler } from "packtory/packtory/scheduler.js";
|
|
22
|
+
import { readCiEnvironment } from "packtory/bundle-emitter/repository-coherence.js";
|
|
23
|
+
import { buildPackageProcessorComposition } from "packtory/packages/package-processor.composition.js";
|
|
15
24
|
async function importModule(modulePath) {
|
|
16
25
|
return import(__rewriteRelativeImportExtension(modulePath));
|
|
17
26
|
}
|
|
27
|
+
const spinnerRenderer = createTerminalSpinnerRenderer({
|
|
28
|
+
backend: createWorkerSpinnerBackend({ runtime: bootedSpinnerRuntime })
|
|
29
|
+
});
|
|
30
|
+
const clock = createClock();
|
|
31
|
+
const promptForOneTimePassword = createOneTimePasswordPrompt({
|
|
32
|
+
clock,
|
|
33
|
+
isInteractiveTerminal: () => {
|
|
34
|
+
return process.stdin.isTTY && process.stdout.isTTY;
|
|
35
|
+
},
|
|
36
|
+
stopSpinner: () => {
|
|
37
|
+
spinnerRenderer.stopAll();
|
|
38
|
+
},
|
|
39
|
+
createInterface: () => {
|
|
40
|
+
return readline.createInterface({
|
|
41
|
+
input: process.stdin,
|
|
42
|
+
output: process.stdout
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const { packageProcessor, progressBroadcaster, deadCodeEliminator } = buildPackageProcessorComposition({
|
|
47
|
+
promptForOneTimePassword,
|
|
48
|
+
ciEnvironment: readCiEnvironment(process.env)
|
|
49
|
+
});
|
|
50
|
+
const scheduler = createScheduler({
|
|
51
|
+
progressBroadcastProvider: progressBroadcaster.provider
|
|
52
|
+
});
|
|
53
|
+
const packtory = createPacktory({
|
|
54
|
+
scheduler,
|
|
55
|
+
packageProcessor,
|
|
56
|
+
deadCodeEliminator,
|
|
57
|
+
progressBroadcaster
|
|
58
|
+
});
|
|
18
59
|
const commandLinerInterfaceRunner = createCommandLineInterfaceRunner({
|
|
19
|
-
packtory
|
|
20
|
-
progressBroadcaster:
|
|
21
|
-
spinnerRenderer
|
|
60
|
+
packtory,
|
|
61
|
+
progressBroadcaster: progressBroadcaster.consumer,
|
|
62
|
+
spinnerRenderer,
|
|
22
63
|
configLoader: createConfigLoader({ currentWorkingDirectory: process.cwd(), importModule }),
|
|
64
|
+
writeReportFile: async (filePath, content) => {
|
|
65
|
+
await fs.writeFile(filePath, content);
|
|
66
|
+
},
|
|
67
|
+
pageOutput: async (content) => {
|
|
68
|
+
const didPage = await previewIo.pagePreviewOutput(content);
|
|
69
|
+
if (!didPage) {
|
|
70
|
+
console.log(content);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
openFile: previewIo.openPreviewFile,
|
|
74
|
+
createTemporaryFilePath: previewIo.createTemporaryPreviewHtmlPath,
|
|
23
75
|
log: console.log
|
|
24
76
|
});
|
|
77
|
+
function setExitCode(exitCode) {
|
|
78
|
+
process.exitCode = exitCode;
|
|
79
|
+
}
|
|
25
80
|
async function main() {
|
|
26
81
|
const exitCode = await commandLinerInterfaceRunner.run(process.argv);
|
|
27
|
-
|
|
28
|
-
process.exitCode = exitCode;
|
|
82
|
+
setExitCode(exitCode);
|
|
29
83
|
}
|
|
30
84
|
function crash(error) {
|
|
31
85
|
console.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-line-interface.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/command-line-interface/command-line-interface.entry-point.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"command-line-interface.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/command-line-interface/command-line-interface.entry-point.ts"],"names":[],"mappings":";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;IACjE,GAAG,EAAE,OAAO,CAAC,GAAG;CACnB,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,QAAgB;IACjC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAChC,CAAC;AAED,KAAK,UAAU,IAAI;IACf,MAAM,QAAQ,GAAG,MAAM,2BAA2B,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,KAAK,CAAC,KAAc;IACzB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC"}
|
package/readme.md
CHANGED
|
@@ -18,12 +18,44 @@ packtory <command> [options]
|
|
|
18
18
|
|
|
19
19
|
**Commands:**
|
|
20
20
|
|
|
21
|
+
- **preview:** Runs a fresh dry-run build with report collection enabled and shows a human-oriented preview of the emitted package contents, file statuses, and changed-file diffs.
|
|
21
22
|
- **publish:** Bundles and publishes npm packages based on the configuration in `packtory.config.js`.
|
|
22
23
|
|
|
23
24
|
**Options:**
|
|
24
25
|
|
|
25
26
|
- **--no-dry-run:** Disables dry-run mode (enabled by default), allowing actual publishing.
|
|
27
|
+
- **preview --open:** Generates the same fresh preview report as `packtory preview`, writes a temporary HTML file, and opens it with the platform opener.
|
|
28
|
+
- **publish --report-json:** Writes `packtory-report.json`, the machine-readable `BuildReport`.
|
|
29
|
+
- **publish --report-html:** Writes `packtory-report.html`, the rich HTML report used by `packtory preview --open`.
|
|
30
|
+
|
|
31
|
+
**Preview behavior:**
|
|
32
|
+
|
|
33
|
+
- `packtory preview` always performs a fresh dry-run build. It does not reuse prior report files.
|
|
34
|
+
- Previewable runs are shown through `$PAGER` when possible, otherwise `less -R`, otherwise standard output.
|
|
35
|
+
- Failure-only runs skip the pager and print diagnostics directly to standard output.
|
|
36
|
+
- The terminal preview always carries a visible dry-run label.
|
|
37
|
+
- `packtory preview` exits with code `0` on a clean run and `1` on config errors, check failures, or partial failures.
|
|
38
|
+
- `packtory preview --open` still exits successfully if report generation worked but opening the file failed; in that case it prints the temporary file path.
|
|
39
|
+
|
|
40
|
+
**Report outputs:**
|
|
41
|
+
|
|
42
|
+
- `--report-json` keeps the durable structured `BuildReport` contract.
|
|
43
|
+
- `--report-html` and `preview --open` render the same human-facing HTML document.
|
|
44
|
+
- The HTML report can still be written for failing runs when report data is available.
|
|
26
45
|
|
|
27
46
|
**Configuration:**
|
|
28
47
|
|
|
29
|
-
Create a `packtory.config.js` file in your project to define the configuration. Refer to the [full documentation](
|
|
48
|
+
Create a `packtory.config.js` file in your project to define the configuration. Refer to the [full documentation](../../../readme.md) for detailed configuration options.
|
|
49
|
+
Your root `package.json` must declare `"type": "module"`.
|
|
50
|
+
|
|
51
|
+
**One-time-password support:**
|
|
52
|
+
|
|
53
|
+
- If the registry challenges a publish with a one-time password, the CLI prompts for it when running in an interactive TTY.
|
|
54
|
+
- The prompt times out after 90 seconds.
|
|
55
|
+
- Non-interactive runs cannot answer a one-time-password challenge. For CI, prefer an auth method that does not require live one-time-password entry, such as npm trusted publishing / OIDC or a suitable registry token setup.
|
|
56
|
+
|
|
57
|
+
**Publish settings:**
|
|
58
|
+
|
|
59
|
+
Every package needs a `publishSettings` value, either set in `commonPackageSettings` as a default or on each package entry directly. If neither is set, the CLI exits with `publishSettings must be set in commonPackageSettings or in every package`. See the [main configuration docs](../../../readme.md) for the full shape and the access ↔ provenance constraint.
|
|
60
|
+
|
|
61
|
+
For the full list of publish-time errors and remediation, see [Supply Chain → CLI error reference](../../../documentation/supply-chain.md#cli-error-reference).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function collectChangedArtifacts(tree) {
|
|
2
|
+
return tree.flatMap((node) => {
|
|
3
|
+
if (node.type !== 'file') {
|
|
4
|
+
return [];
|
|
5
|
+
}
|
|
6
|
+
const { artifact } = node;
|
|
7
|
+
return artifact.diff === undefined ? [] : [{ ...artifact, diff: artifact.diff }];
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=changed-artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changed-artifacts.js","sourceRoot":"","sources":["../../../../source/report/changed-artifacts.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,uBAAuB,CAAC,IAAoC;IACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACvB,OAAO,EAAE,CAAC;QACd,CAAC;QACD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAC1B,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-escaping.js","sourceRoot":"","sources":["../../../../source/report/html-escaping.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,KAAa;IACpC,OAAO,KAAK;SACP,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC;SACzB,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAClC,CAAC"}
|