@applicaster/zapplicaster-cli 16.0.0-alpha.2321416274 → 16.0.0-alpha.2342560386
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/package.json +5 -5
- package/src/commands/publishPackage/index.js +0 -1
- package/src/commands/publishPlugin/README.md +0 -46
- package/src/commands/publishPlugin/index.js +0 -1
- package/src/taskRunner/__tests__/taskRunner.test.js +0 -82
- package/src/taskRunner/index.js +3 -20
- package/src/commands/utils/__tests__/publishTiming.test.js +0 -130
- package/src/commands/utils/publishTiming.js +0 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapplicaster-cli",
|
|
3
|
-
"version": "16.0.0-alpha.
|
|
3
|
+
"version": "16.0.0-alpha.2342560386",
|
|
4
4
|
"description": "CLI Tool for the zapp app and Quick Brick project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/zapp-react-dom-cli-template": "16.0.0-alpha.
|
|
32
|
-
"@applicaster/zapp-react-native-android-tv-cli-template": "16.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-react-native-cli-template": "16.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-tvos-cli-template": "16.0.0-alpha.
|
|
31
|
+
"@applicaster/zapp-react-dom-cli-template": "16.0.0-alpha.2342560386",
|
|
32
|
+
"@applicaster/zapp-react-native-android-tv-cli-template": "16.0.0-alpha.2342560386",
|
|
33
|
+
"@applicaster/zapp-react-native-cli-template": "16.0.0-alpha.2342560386",
|
|
34
|
+
"@applicaster/zapp-react-native-tvos-cli-template": "16.0.0-alpha.2342560386",
|
|
35
35
|
"axios": "^0.28.0",
|
|
36
36
|
"camelize": "^1.0.0",
|
|
37
37
|
"chalk": "^2.3.2",
|
|
@@ -137,50 +137,4 @@ export USE_LEGACY_ZAPPIFEST=true
|
|
|
137
137
|
|
|
138
138
|
---
|
|
139
139
|
|
|
140
|
-
## Release timing measurements
|
|
141
|
-
|
|
142
|
-
CircleCI enables `QB_PUBLISH_TIMINGS=true` in the RC, canary, and stable
|
|
143
|
-
deployment jobs. This adds `[publish-timing]` JSON records without changing
|
|
144
|
-
package selection, the four-worker concurrency limit, publishing order, or retry
|
|
145
|
-
behavior. To enable the same measurements locally, set that environment variable
|
|
146
|
-
before an existing publish command.
|
|
147
|
-
|
|
148
|
-
Each record contains `stage`, `status` (`started`, `succeeded`, or `failed`),
|
|
149
|
-
`startedAt` (UTC), and `durationMs` measured with a monotonic clock. Package
|
|
150
|
-
records include `packageName` and `version`; batch records include `batch`,
|
|
151
|
-
`packages`, and `concurrency`. No commands, credentials, or error response bodies
|
|
152
|
-
are included in the timing records.
|
|
153
|
-
|
|
154
|
-
The deploy script measures the release, each dependency batch and package,
|
|
155
|
-
publish selection, package metadata/dependency updates, command preparation
|
|
156
|
-
(including framework package version updates), the child publish command, and
|
|
157
|
-
the final RC/stable lockfile refresh. Canary publishing does not run that final
|
|
158
|
-
lockfile refresh. The CLI measures Apple templates, manifest generation, npm
|
|
159
|
-
publishing, Zapp uploads, core-plugin updates, and Git handling separately.
|
|
160
|
-
`publish-command` includes child-process/CLI startup, so compare it with its
|
|
161
|
-
child's CLI stage durations to identify uninstrumented startup overhead.
|
|
162
|
-
|
|
163
|
-
For a measurement-only canary, use this branch's normal `hold_deploy_canary`
|
|
164
|
-
approval after its build completes. Compare time spent building before approval
|
|
165
|
-
and deployment after approval; do not include time waiting for approval.
|
|
166
|
-
Checkout, dependency restoration, Git history fetch, and workspace attachment
|
|
167
|
-
remain separate CircleCI steps. The canary still publishes real npm packages and
|
|
168
|
-
Zapp manifests, so it must be explicitly approved; instrumentation alone does not
|
|
169
|
-
trigger a release.
|
|
170
|
-
|
|
171
|
-
Stage durations overlap across concurrent packages and nested stages: do not sum
|
|
172
|
-
them as elapsed release time. Use release/batch durations for wall-clock timing
|
|
173
|
-
and group package stages by `packageName` and `version` to find bottlenecks.
|
|
174
|
-
Child-process output is buffered by the existing deploy wrapper, so use record
|
|
175
|
-
timestamps rather than console arrival order. Only compare actual publishes
|
|
176
|
-
with similar published/skipped counts, not dry runs or no-op releases.
|
|
177
|
-
|
|
178
|
-
Framework package versions are updated using the deploy script's atomic
|
|
179
|
-
write-and-rename helper rather than `npm version`. This prevents concurrent
|
|
180
|
-
workspace discovery from reading a temporarily empty `package.json`. Framework
|
|
181
|
-
packages have no version lifecycle scripts; standalone plugin CLI publishing
|
|
182
|
-
retains its existing npm version behavior.
|
|
183
|
-
|
|
184
|
-
---
|
|
185
|
-
|
|
186
140
|
*Engineered with pride for the QuickBrick developer community.*
|
|
@@ -260,86 +260,4 @@ describe("taskRunner", () => {
|
|
|
260
260
|
);
|
|
261
261
|
});
|
|
262
262
|
});
|
|
263
|
-
|
|
264
|
-
describe("publish timing", () => {
|
|
265
|
-
const originalTimingFlag = process.env.QB_PUBLISH_TIMINGS;
|
|
266
|
-
|
|
267
|
-
beforeEach(() => {
|
|
268
|
-
process.env.QB_PUBLISH_TIMINGS = "true";
|
|
269
|
-
logSpy.mockClear();
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
afterEach(() => {
|
|
273
|
-
if (originalTimingFlag === undefined) {
|
|
274
|
-
delete process.env.QB_PUBLISH_TIMINGS;
|
|
275
|
-
} else {
|
|
276
|
-
process.env.QB_PUBLISH_TIMINGS = originalTimingFlag;
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
it.each([
|
|
281
|
-
{ pluginPackageJson: { name: "plugin" }, version: "1.0.0-alpha.1" },
|
|
282
|
-
{ packageName: "package", version: "1.0.0-rc.1" },
|
|
283
|
-
])("identifies each timed publish stage for %j", async (configuration) => {
|
|
284
|
-
await taskRunner({
|
|
285
|
-
...task,
|
|
286
|
-
logTimings: true,
|
|
287
|
-
configurator: async () => configuration,
|
|
288
|
-
steps: [steps[0]],
|
|
289
|
-
cleanUp: undefined,
|
|
290
|
-
})({});
|
|
291
|
-
|
|
292
|
-
const timingRecords = logSpy.mock.calls
|
|
293
|
-
.filter(([line]) => line.startsWith("[publish-timing] "))
|
|
294
|
-
.map(([line]) => JSON.parse(line.slice("[publish-timing] ".length)));
|
|
295
|
-
|
|
296
|
-
expect(timingRecords).toEqual([
|
|
297
|
-
expect.objectContaining({
|
|
298
|
-
task: name,
|
|
299
|
-
packageName:
|
|
300
|
-
configuration.pluginPackageJson?.name || configuration.packageName,
|
|
301
|
-
version: configuration.version,
|
|
302
|
-
stage: step1Sstart,
|
|
303
|
-
status: "started",
|
|
304
|
-
}),
|
|
305
|
-
expect.objectContaining({ status: "succeeded" }),
|
|
306
|
-
]);
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
it("leaves non-publish tasks uninstrumented", async () => {
|
|
310
|
-
await taskRunner({ ...task, cleanUp: undefined })({});
|
|
311
|
-
|
|
312
|
-
expect(logSpy).not.toHaveBeenCalled();
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
it("records the failed stage before the existing error handler", async () => {
|
|
316
|
-
await taskRunner({
|
|
317
|
-
...task,
|
|
318
|
-
logTimings: true,
|
|
319
|
-
configurator: async () => ({
|
|
320
|
-
packageName: "package",
|
|
321
|
-
version: "1.0.0",
|
|
322
|
-
}),
|
|
323
|
-
steps: [failing_step],
|
|
324
|
-
cleanUp: undefined,
|
|
325
|
-
})({});
|
|
326
|
-
|
|
327
|
-
const lastRecord = JSON.parse(
|
|
328
|
-
logSpy.mock.calls[1][0].slice("[publish-timing] ".length)
|
|
329
|
-
);
|
|
330
|
-
|
|
331
|
-
expect(lastRecord).toEqual(
|
|
332
|
-
expect.objectContaining({ stage: "failing step", status: "failed" })
|
|
333
|
-
);
|
|
334
|
-
|
|
335
|
-
expect(errorSpy).toHaveBeenCalledWith(
|
|
336
|
-
failing_step.error,
|
|
337
|
-
FAILING_STEP_ERROR
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
expect(logSpy.mock.invocationCallOrder[1]).toBeLessThan(
|
|
341
|
-
errorSpy.mock.invocationCallOrder[0]
|
|
342
|
-
);
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
263
|
});
|
package/src/taskRunner/index.js
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
const R = require("ramda");
|
|
8
8
|
const logger = require("../logger");
|
|
9
|
-
const { measurePublishStep } = require("../commands/utils/publishTiming");
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* @typedef step
|
|
@@ -28,7 +27,6 @@ const { measurePublishStep } = require("../commands/utils/publishTiming");
|
|
|
28
27
|
* for the task. invoked with { cliArgs, cliOptions }
|
|
29
28
|
* @property {step[]} task.steps: array of steps to perform
|
|
30
29
|
* @property {Function?} task.cleanup: Optional cleanup function to run after the task is finished
|
|
31
|
-
* @property {Boolean?} task.logTimings: Enable publish timing when QB_PUBLISH_TIMINGS is true
|
|
32
30
|
*/
|
|
33
31
|
|
|
34
32
|
/**
|
|
@@ -87,27 +85,13 @@ async function gatherConfiguration(configurator, { cliArgs, cliOptions }) {
|
|
|
87
85
|
* Runs a step within a given task
|
|
88
86
|
* @param {Object} configuration object built from the configurator function above
|
|
89
87
|
* @param {step} step within a task - see typedef above
|
|
90
|
-
* @param {String?} taskName: Task name for publish timing records
|
|
91
88
|
* @returns {Void} returns void to make sure async steps run sequentially
|
|
92
89
|
*/
|
|
93
|
-
async function runStep(configuration, step
|
|
90
|
+
async function runStep(configuration, step) {
|
|
94
91
|
logger.startStep(step.start);
|
|
95
92
|
|
|
96
93
|
try {
|
|
97
|
-
|
|
98
|
-
await measurePublishStep(
|
|
99
|
-
step.start,
|
|
100
|
-
{
|
|
101
|
-
task: taskName,
|
|
102
|
-
packageName:
|
|
103
|
-
configuration.pluginPackageJson?.name || configuration.packageName,
|
|
104
|
-
version: configuration.version,
|
|
105
|
-
},
|
|
106
|
-
() => step.run(configuration)
|
|
107
|
-
);
|
|
108
|
-
} else {
|
|
109
|
-
await step.run(configuration);
|
|
110
|
-
}
|
|
94
|
+
await step.run(configuration);
|
|
111
95
|
} catch (e) {
|
|
112
96
|
logger.error(step.error || e.message, e);
|
|
113
97
|
}
|
|
@@ -129,7 +113,6 @@ function taskRunner(task) {
|
|
|
129
113
|
configurator = function () {},
|
|
130
114
|
steps,
|
|
131
115
|
cleanUp,
|
|
132
|
-
logTimings = false,
|
|
133
116
|
} = task;
|
|
134
117
|
|
|
135
118
|
return async function (...args) {
|
|
@@ -160,7 +143,7 @@ function taskRunner(task) {
|
|
|
160
143
|
logger.endStep("configuration retrieved");
|
|
161
144
|
|
|
162
145
|
for (const step of steps) {
|
|
163
|
-
await runStep(configuration, step
|
|
146
|
+
await runStep(configuration, step);
|
|
164
147
|
}
|
|
165
148
|
|
|
166
149
|
if (cleanUp) {
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
jest.mock("../../../logger", () => ({
|
|
2
|
-
log: jest.fn(),
|
|
3
|
-
}));
|
|
4
|
-
|
|
5
|
-
const logger = require("../../../logger");
|
|
6
|
-
const { measurePublishStep } = require("../publishTiming");
|
|
7
|
-
|
|
8
|
-
const originalTimingFlag = process.env.QB_PUBLISH_TIMINGS;
|
|
9
|
-
|
|
10
|
-
const details = {
|
|
11
|
-
packageName: "@applicaster/example",
|
|
12
|
-
version: "16.0.0-alpha.123",
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const records = () =>
|
|
16
|
-
logger.log.mock.calls.map(([line]) =>
|
|
17
|
-
JSON.parse(line.slice("[publish-timing] ".length))
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
describe("publish timing", () => {
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
logger.log.mockClear();
|
|
23
|
-
delete process.env.QB_PUBLISH_TIMINGS;
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
afterEach(() => {
|
|
27
|
-
jest.restoreAllMocks();
|
|
28
|
-
|
|
29
|
-
if (originalTimingFlag === undefined) {
|
|
30
|
-
delete process.env.QB_PUBLISH_TIMINGS;
|
|
31
|
-
} else {
|
|
32
|
-
process.env.QB_PUBLISH_TIMINGS = originalTimingFlag;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("does not log unless explicitly enabled and preserves the result", async () => {
|
|
37
|
-
const operation = jest.fn(async () => "published");
|
|
38
|
-
|
|
39
|
-
await expect(measurePublishStep("npm", details, operation)).resolves.toBe(
|
|
40
|
-
"published"
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
expect(operation).toHaveBeenCalledTimes(1);
|
|
44
|
-
expect(logger.log).not.toHaveBeenCalled();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("preserves failures when timing is disabled", async () => {
|
|
48
|
-
const error = new Error("publish failed");
|
|
49
|
-
|
|
50
|
-
await expect(
|
|
51
|
-
measurePublishStep("npm", details, async () => {
|
|
52
|
-
throw error;
|
|
53
|
-
})
|
|
54
|
-
).rejects.toBe(error);
|
|
55
|
-
|
|
56
|
-
expect(logger.log).not.toHaveBeenCalled();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("logs correlated start/end records with monotonic milliseconds", async () => {
|
|
60
|
-
process.env.QB_PUBLISH_TIMINGS = "true";
|
|
61
|
-
|
|
62
|
-
jest
|
|
63
|
-
.spyOn(process.hrtime, "bigint")
|
|
64
|
-
.mockReturnValueOnce(1000000000n)
|
|
65
|
-
.mockReturnValueOnce(1000000000n)
|
|
66
|
-
.mockReturnValueOnce(1250500000n);
|
|
67
|
-
|
|
68
|
-
const result = { published: true };
|
|
69
|
-
const operation = jest.fn(async () => result);
|
|
70
|
-
|
|
71
|
-
await expect(measurePublishStep("npm", details, operation)).resolves.toBe(
|
|
72
|
-
result
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
expect(operation).toHaveBeenCalledTimes(1);
|
|
76
|
-
|
|
77
|
-
expect(records()).toEqual([
|
|
78
|
-
{
|
|
79
|
-
...details,
|
|
80
|
-
stage: "npm",
|
|
81
|
-
startedAt: expect.any(String),
|
|
82
|
-
status: "started",
|
|
83
|
-
durationMs: 0,
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
...details,
|
|
87
|
-
stage: "npm",
|
|
88
|
-
startedAt: records()[0].startedAt,
|
|
89
|
-
status: "succeeded",
|
|
90
|
-
durationMs: 250.5,
|
|
91
|
-
},
|
|
92
|
-
]);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it("records failures without swallowing them or logging error contents", async () => {
|
|
96
|
-
process.env.QB_PUBLISH_TIMINGS = "true";
|
|
97
|
-
const error = new Error("sensitive registry response");
|
|
98
|
-
|
|
99
|
-
await expect(
|
|
100
|
-
measurePublishStep("npm", details, async () => {
|
|
101
|
-
throw error;
|
|
102
|
-
})
|
|
103
|
-
).rejects.toBe(error);
|
|
104
|
-
|
|
105
|
-
expect(records().map(({ status }) => status)).toEqual([
|
|
106
|
-
"started",
|
|
107
|
-
"failed",
|
|
108
|
-
]);
|
|
109
|
-
|
|
110
|
-
expect(logger.log.mock.calls.flat().join("")).not.toContain(error.message);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it("keeps overlapping packages identifiable", async () => {
|
|
114
|
-
process.env.QB_PUBLISH_TIMINGS = "true";
|
|
115
|
-
|
|
116
|
-
await Promise.all(
|
|
117
|
-
["first", "second"].map((packageName) =>
|
|
118
|
-
measurePublishStep("npm", { ...details, packageName }, async () => true)
|
|
119
|
-
)
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
for (const packageName of ["first", "second"]) {
|
|
123
|
-
expect(
|
|
124
|
-
records()
|
|
125
|
-
.filter((record) => record.packageName === packageName)
|
|
126
|
-
.map(({ status }) => status)
|
|
127
|
-
).toEqual(["started", "succeeded"]);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const logger = require("../../logger");
|
|
2
|
-
|
|
3
|
-
async function measurePublishStep(stage, details, operation) {
|
|
4
|
-
if (process.env.QB_PUBLISH_TIMINGS !== "true") {
|
|
5
|
-
return operation();
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const startedAt = new Date().toISOString();
|
|
9
|
-
const start = process.hrtime.bigint();
|
|
10
|
-
const context = { ...details, stage, startedAt };
|
|
11
|
-
|
|
12
|
-
const report = (status) => {
|
|
13
|
-
logger.log(
|
|
14
|
-
`[publish-timing] ${JSON.stringify({
|
|
15
|
-
...context,
|
|
16
|
-
status,
|
|
17
|
-
durationMs: Number(process.hrtime.bigint() - start) / 1e6,
|
|
18
|
-
})}`
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
report("started");
|
|
23
|
-
|
|
24
|
-
try {
|
|
25
|
-
const result = await operation();
|
|
26
|
-
report("succeeded");
|
|
27
|
-
|
|
28
|
-
return result;
|
|
29
|
-
} catch (error) {
|
|
30
|
-
report("failed");
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
module.exports = { measurePublishStep };
|