@applicaster/zapplicaster-cli 16.0.0-alpha.4416921324 → 16.0.0-alpha.4548770949
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/prepareWorkspace/__tests__/__snapshots__/configurator.test.js.snap +2 -0
- package/src/commands/prepareWorkspace/__tests__/buildPluginsCreator.test.js +99 -0
- package/src/commands/prepareWorkspace/appBootstrapper.js +9 -0
- package/src/commands/prepareWorkspace/buildPluginsCreator.js +61 -0
- package/src/commands/prepareWorkspace/configFilesRetriever.js +3 -0
- package/src/commands/prepareWorkspace/configurator.js +19 -0
- package/src/commands/publishPackage/index.js +1 -0
- package/src/commands/publishPlugin/README.md +205 -0
- package/src/commands/publishPlugin/__tests__/commitToGit.test.js +1 -1
- package/src/commands/publishPlugin/__tests__/configurator.test.js +2 -2
- package/src/commands/publishPlugin/__tests__/manifests/android.json +3 -1
- package/src/commands/publishPlugin/__tests__/manifests/android_for_quickbrick.json +6 -0
- package/src/commands/publishPlugin/__tests__/manifests/android_tv_for_quickbrick.json +6 -0
- package/src/commands/publishPlugin/__tests__/manifests/ios.json +3 -1
- package/src/commands/publishPlugin/__tests__/manifests/ios_for_quickbrick.json +6 -0
- package/src/commands/publishPlugin/__tests__/manifests/tvos_for_quickbrick.json +6 -0
- package/src/commands/publishPlugin/__tests__/zappApi.test.js +271 -0
- package/src/commands/publishPlugin/__tests__/zappifestPublish.test.js +109 -33
- package/src/commands/publishPlugin/commitToGit.js +1 -1
- package/src/commands/publishPlugin/configurator.js +1 -1
- package/src/commands/publishPlugin/index.js +1 -0
- package/src/commands/publishPlugin/updateCorePluginsIfNeeded.js +22 -12
- package/src/commands/publishPlugin/zappApi.js +283 -0
- package/src/commands/publishPlugin/zappifestPublish.js +123 -8
- package/src/commands/reloadConfig/__tests__/__snapshots__/reloadConfig.test.js.snap +58 -0
- package/src/commands/reloadConfig/__tests__/reloadConfig.test.js +86 -0
- package/src/commands/reloadConfig/index.js +6 -6
- package/src/commands/utils/__tests__/publishTiming.test.js +130 -0
- package/src/commands/utils/publishTiming.js +35 -0
- package/src/taskRunner/__tests__/taskRunner.test.js +82 -0
- package/src/taskRunner/index.js +20 -3
- package/src/commands/publishPlugin/__tests__/__snapshots__/zappifestPublish.test.js.snap +0 -5
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.4548770949",
|
|
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.4548770949",
|
|
32
|
+
"@applicaster/zapp-react-native-android-tv-cli-template": "16.0.0-alpha.4548770949",
|
|
33
|
+
"@applicaster/zapp-react-native-cli-template": "16.0.0-alpha.4548770949",
|
|
34
|
+
"@applicaster/zapp-react-native-tvos-cli-template": "16.0.0-alpha.4548770949",
|
|
35
35
|
"axios": "^0.28.0",
|
|
36
36
|
"camelize": "^1.0.0",
|
|
37
37
|
"chalk": "^2.3.2",
|
|
@@ -8,6 +8,7 @@ exports[`configurator builds the configuration object 1`] = `
|
|
|
8
8
|
"appVersionId": "APP_VERSION_ID",
|
|
9
9
|
"assets_url": "https://assets-secure.applicaster.com/zapp/accounts/5ae06cef8fba0f00084bd3c6/apps/com.quickbricktest/apple_store/1.8/styles/assets_styles.json",
|
|
10
10
|
"otherParam": "param",
|
|
11
|
+
"vidaa_client_partner_id": undefined,
|
|
11
12
|
},
|
|
12
13
|
"destinationPath": "development-app",
|
|
13
14
|
"deviceTarget": undefined,
|
|
@@ -32,6 +33,7 @@ exports[`configurator sets a null path if none is provided and the cli doesn't r
|
|
|
32
33
|
"appVersionId": "APP_VERSION_ID",
|
|
33
34
|
"assets_url": "https://assets-secure.applicaster.com/zapp/accounts/5ae06cef8fba0f00084bd3c6/apps/com.quickbricktest/apple_store/1.8/styles/assets_styles.json",
|
|
34
35
|
"otherParam": "param",
|
|
36
|
+
"vidaa_client_partner_id": undefined,
|
|
35
37
|
},
|
|
36
38
|
"destinationPath": null,
|
|
37
39
|
"deviceTarget": undefined,
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const os = require("os");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
jest.mock("../../../render", () => ({
|
|
6
|
+
saveConfigFile: jest.fn(),
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
jest.mock("../../../settings/paths", () => ({
|
|
10
|
+
getFileDestinationPath: jest.fn(),
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
jest.mock("../../../logger", () => ({
|
|
14
|
+
error: jest.fn(),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
const { saveConfigFile } = require("../../../render");
|
|
18
|
+
const { getFileDestinationPath } = require("../../../settings/paths");
|
|
19
|
+
const logger = require("../../../logger");
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
buildPluginsCreator,
|
|
23
|
+
getBuildPlugins,
|
|
24
|
+
} = require("../buildPluginsCreator");
|
|
25
|
+
|
|
26
|
+
const pluginConfigurations = [
|
|
27
|
+
{
|
|
28
|
+
plugin: {
|
|
29
|
+
identifier: "zeta",
|
|
30
|
+
name: "Zeta",
|
|
31
|
+
manifest_version: "2.0.0",
|
|
32
|
+
dependency_version: "1.0.0",
|
|
33
|
+
},
|
|
34
|
+
configuration_json: { key: "value" },
|
|
35
|
+
},
|
|
36
|
+
{ plugin: { identifier: "alpha", dependency_version: "3.1.0" } },
|
|
37
|
+
{ plugin: { name: "no identifier, skipped" } },
|
|
38
|
+
{ configuration_json: {} },
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
const expected = [
|
|
42
|
+
{ id: "alpha", name: null, version: "3.1.0" },
|
|
43
|
+
{ id: "zeta", name: "Zeta", version: "2.0.0" },
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
const configuration = { destinationPath: "path/to/workspace", platform: "ios" };
|
|
47
|
+
|
|
48
|
+
describe("getBuildPlugins", () => {
|
|
49
|
+
it("maps plugins to id, name, version sorted by id, preferring manifest_version", () => {
|
|
50
|
+
expect(getBuildPlugins(pluginConfigurations)).toEqual(expected);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe("buildPluginsCreator", () => {
|
|
55
|
+
const file = path.join(
|
|
56
|
+
os.tmpdir(),
|
|
57
|
+
`plugin_configurations_${process.pid}.json`
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
afterEach(() => {
|
|
61
|
+
jest.clearAllMocks();
|
|
62
|
+
fs.rmSync(file, { force: true });
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("writes build_plugins.json from the downloaded plugin_configurations.json", async () => {
|
|
66
|
+
fs.writeFileSync(file, JSON.stringify(pluginConfigurations));
|
|
67
|
+
getFileDestinationPath.mockReturnValue(file);
|
|
68
|
+
|
|
69
|
+
await buildPluginsCreator(configuration);
|
|
70
|
+
|
|
71
|
+
expect(getFileDestinationPath).toHaveBeenCalledWith({
|
|
72
|
+
...configuration,
|
|
73
|
+
folder: "config",
|
|
74
|
+
fileName: "plugin_configurations.json",
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
expect(saveConfigFile).toHaveBeenCalledWith(
|
|
78
|
+
configuration,
|
|
79
|
+
"build_plugins.json",
|
|
80
|
+
expected
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
expect(logger.error).not.toHaveBeenCalled();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("writes an empty list and logs an error when plugin_configurations.json is missing", async () => {
|
|
87
|
+
getFileDestinationPath.mockReturnValue(file);
|
|
88
|
+
|
|
89
|
+
await buildPluginsCreator(configuration);
|
|
90
|
+
|
|
91
|
+
expect(saveConfigFile).toHaveBeenCalledWith(
|
|
92
|
+
configuration,
|
|
93
|
+
"build_plugins.json",
|
|
94
|
+
[]
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
expect(logger.error).toHaveBeenCalled();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
@@ -193,6 +193,15 @@ async function appBootstrapper(configuration) {
|
|
|
193
193
|
.map(toDayJSLocaleMap)
|
|
194
194
|
.filter((v) => v !== "en");
|
|
195
195
|
|
|
196
|
+
if (
|
|
197
|
+
configuration.buildParams.device_target === "vidaa" &&
|
|
198
|
+
!configuration.buildParams.vidaa_client_partner_id
|
|
199
|
+
) {
|
|
200
|
+
logger.warn(
|
|
201
|
+
"In order to use the VIDAA SDK you will need to set vidaa_client_partner_id"
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
196
205
|
configuration.excludedNodeModules = getExcludedNodeModules(plugins);
|
|
197
206
|
const { filesToRender } = template.files;
|
|
198
207
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
|
|
3
|
+
const { saveConfigFile } = require("../../render");
|
|
4
|
+
const { getFileDestinationPath } = require("../../settings/paths");
|
|
5
|
+
const logger = require("../../logger");
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Plugins the app is built with, as [{ id, name, version }] sorted by id.
|
|
9
|
+
* version is manifest_version, falling back to dependency_version.
|
|
10
|
+
* @param {Array} pluginConfigurations content of plugin_configurations.json
|
|
11
|
+
*/
|
|
12
|
+
function getBuildPlugins(pluginConfigurations) {
|
|
13
|
+
return pluginConfigurations
|
|
14
|
+
.filter((entry) => typeof entry?.plugin?.identifier === "string")
|
|
15
|
+
.map(({ plugin }) => ({
|
|
16
|
+
id: plugin.identifier,
|
|
17
|
+
name: plugin.name ?? null,
|
|
18
|
+
version: plugin.manifest_version ?? plugin.dependency_version ?? null,
|
|
19
|
+
}))
|
|
20
|
+
.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Writes build_plugins.json next to the downloaded plugin_configurations.json.
|
|
25
|
+
* The app bundles it on every platform (plugin_configurations.json itself is only bundled in __DEV__),
|
|
26
|
+
* so tools like X-Ray can report what the build contains, not what Zapp serves now.
|
|
27
|
+
* @param {Object} configuration
|
|
28
|
+
* @param {String} configuration.destinationPath path of the workspace
|
|
29
|
+
* @param {String} configuration.platform platform of the app
|
|
30
|
+
*/
|
|
31
|
+
async function buildPluginsCreator(configuration) {
|
|
32
|
+
const { destinationPath, platform } = configuration;
|
|
33
|
+
|
|
34
|
+
let buildPlugins = [];
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const pluginConfigurations = JSON.parse(
|
|
38
|
+
fs.readFileSync(
|
|
39
|
+
getFileDestinationPath({
|
|
40
|
+
destinationPath,
|
|
41
|
+
platform,
|
|
42
|
+
folder: "config",
|
|
43
|
+
fileName: "plugin_configurations.json",
|
|
44
|
+
}),
|
|
45
|
+
"utf8"
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
buildPlugins = getBuildPlugins(pluginConfigurations);
|
|
50
|
+
} catch (e) {
|
|
51
|
+
logger.error(
|
|
52
|
+
`Could not read plugin_configurations.json, build_plugins.json will be empty: ${e.message}`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
await saveConfigFile(configuration, "build_plugins.json", buildPlugins);
|
|
57
|
+
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = { buildPluginsCreator, getBuildPlugins };
|
|
@@ -7,6 +7,7 @@ const {
|
|
|
7
7
|
} = require("../../download");
|
|
8
8
|
|
|
9
9
|
const { renderConfigFile } = require("../../render");
|
|
10
|
+
const { buildPluginsCreator } = require("./buildPluginsCreator");
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* @typedef configuration
|
|
@@ -45,6 +46,8 @@ async function configFilesRetriever(configuration) {
|
|
|
45
46
|
R.map(saveRemoteJsonToFile(configuration), configFilesUrls)
|
|
46
47
|
);
|
|
47
48
|
|
|
49
|
+
await buildPluginsCreator(configuration);
|
|
50
|
+
|
|
48
51
|
const { fonts_url, fonts, assets_url } = buildParams;
|
|
49
52
|
saveFontFiles(configuration, fonts_url, fonts);
|
|
50
53
|
saveAssets(configuration, assets_url);
|
|
@@ -9,6 +9,22 @@ const { getAppVersionParams } = require("../../zapp");
|
|
|
9
9
|
const { resolveAppTemplate } = require("../../templates");
|
|
10
10
|
const { isZappReactNativeRepo } = require("../../settings");
|
|
11
11
|
|
|
12
|
+
function resolveVidaaClientPartnerId(buildParams = {}) {
|
|
13
|
+
const fromBuildParams = buildParams.vidaa_client_partner_id;
|
|
14
|
+
|
|
15
|
+
if (typeof fromBuildParams === "string" && fromBuildParams.trim()) {
|
|
16
|
+
return fromBuildParams.trim();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const fromEnv = process.env.vidaa_client_partner_id;
|
|
20
|
+
|
|
21
|
+
if (typeof fromEnv === "string" && fromEnv.trim()) {
|
|
22
|
+
return fromEnv.trim();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
12
28
|
const store_map = {
|
|
13
29
|
amazon: "amazon",
|
|
14
30
|
google_play: "android",
|
|
@@ -78,6 +94,9 @@ async function configurator({ cliArgs, cliOptions }) {
|
|
|
78
94
|
|
|
79
95
|
const buildParams = await getAppVersionParams(appVersionId);
|
|
80
96
|
|
|
97
|
+
buildParams.vidaa_client_partner_id =
|
|
98
|
+
resolveVidaaClientPartnerId(buildParams);
|
|
99
|
+
|
|
81
100
|
delete buildParams.styles_url; // deprecated
|
|
82
101
|
|
|
83
102
|
const platform = resolvePlatform(buildParams.assets_url);
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# ⚡️ Zappifest Nano (Zappifest v2)
|
|
2
|
+
|
|
3
|
+
```text
|
|
4
|
+
███████╗ █████╗ ██████╗ ██████╗ ██╗███████╗███████╗███████╗████████╗ ███╗ ██╗ █████╗ ███╗ ██╗ ██████╗
|
|
5
|
+
╚══███╔╝██╔══██╗██╔══██╗██╔══██╗██║██╔════╝██╔════╝██╔════╝╚══██╔══╝ ████╗ ██║██╔══██╗████╗ ██║██╔═══██╗
|
|
6
|
+
███╔╝ ███████║██████╔╝██████╔╝██║█████╗ █████╗ ███████╗ ██║ ██╔██╗ ██║███████║██╔██╗ ██║██║ ██║
|
|
7
|
+
███╔╝ ██╔══██║██╔═══╝ ██╔═══╝ ██║██╔══╝ ██╔══╝ ╚════██║ ██║ ██║╚██╗██║██╔══██║██║╚██╗██║██║ ██║
|
|
8
|
+
███████╗██║ ██║██║ ██║ ██║██║ ███████╗███████║ ██║ ██║ ╚████║██║ ██║██║ ╚████║╚██████╔╝
|
|
9
|
+
╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝ ╚═╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝
|
|
10
|
+
[ Z A P P I F E S T v 2 . 0 ]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
> **The next-generation, high-performance, native TypeScript/Node engine for Zapp plugin and manifest publishing.**
|
|
14
|
+
>
|
|
15
|
+
> *Goodbye Ruby subprocesses. Hello blazing fast releases.*
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 🏎️ The Scoreboard
|
|
20
|
+
|
|
21
|
+
| Metric | 🐢 Legacy Zappifest (v1) | ⚡️ Zappifest Nano (v2) | Improvement |
|
|
22
|
+
| :--- | :--- | :--- | :--- |
|
|
23
|
+
| **Publish Pipeline Duration** | **~14 minutes** | **~4 minutes** | **⚡️ 3.5x Faster (71% time saved)** |
|
|
24
|
+
| **Runtime Dependency** | Ruby + RubyGems (Bundler) | **100% Native Node / TypeScript** | **Zero Ruby dependencies** |
|
|
25
|
+
| **Subprocess Forks / Manifest** | 1 per platform (~9 per plugin) | **0 (In-process async fetch)** | **100% elimination** |
|
|
26
|
+
| **Network Dispatch** | Sequential `zappifest publish` calls | **Parallel platform manifest uploads** | **Concurrent non-blocking** |
|
|
27
|
+
| **Batch Concurrency** | Single-threaded serial execution | **Topological Worker Pool (concurrency: 4)** | **4x Parallel pipeline** |
|
|
28
|
+
| **Workspace Integrity** | Truncating non-atomic writes | **Atomic write-and-rename (`.tmp` swap)** | **Zero lock contention / corruption** |
|
|
29
|
+
| **Plugin ID Lookup** | Slow full-database scans | **Direct `.json` lookup (~120ms)** | **Instantaneous** |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 💡 Why "Nano"?
|
|
34
|
+
|
|
35
|
+
For years, publishing a QuickBrick release required spawning hundreds of Ruby CLI subprocesses via the legacy `zappifest` gem. Each platform manifest (`ios_for_quickbrick`, `android_for_quickbrick`, `tvos_for_quickbrick`, `samsung_tv`, `lg_tv`, `vidaa`, etc.) meant:
|
|
36
|
+
1. Bootstrapping a fresh Ruby VM.
|
|
37
|
+
2. Loading Ruby gems and dependencies.
|
|
38
|
+
3. Authenticating against Accounts API.
|
|
39
|
+
4. Parsing local files and serializing multipart requests sequentially.
|
|
40
|
+
|
|
41
|
+
**Zappifest Nano** completely replaces this legacy pipeline with a tiny, zero-dependency, native async engine built directly into `@applicaster/zapplicaster-cli`.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🏗️ Architecture: Before vs After
|
|
46
|
+
|
|
47
|
+
### Legacy v1 Architecture (Slow & Fragile)
|
|
48
|
+
```mermaid
|
|
49
|
+
flowchart TD
|
|
50
|
+
subgraph Legacy [Legacy Zappifest v1]
|
|
51
|
+
A[Yarn Deploy Script] --> B[Plugin 1]
|
|
52
|
+
B --> C1[Fork: ruby zappifest iOS]
|
|
53
|
+
B --> C2[Fork: ruby zappifest Android]
|
|
54
|
+
B --> C3[Fork: ruby zappifest TVOS]
|
|
55
|
+
B --> C4[Fork: ruby zappifest Samsung]
|
|
56
|
+
B --> C5[Fork: ruby zappifest LG...]
|
|
57
|
+
C1 --> D1[Slow Boot & Auth]
|
|
58
|
+
C2 --> D2[Slow Boot & Auth]
|
|
59
|
+
C3 --> D3[Slow Boot & Auth]
|
|
60
|
+
C4 --> D4[Slow Boot & Auth]
|
|
61
|
+
C5 --> D5[Slow Boot & Auth]
|
|
62
|
+
D1 --> E[Total Time: ~14 Minutes]
|
|
63
|
+
end
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Zappifest Nano Architecture (Blazing Fast)
|
|
67
|
+
```mermaid
|
|
68
|
+
flowchart TD
|
|
69
|
+
subgraph Nano [Zappifest Nano v2]
|
|
70
|
+
P[Topological Batch Queue] --> W1[Worker 1]
|
|
71
|
+
P --> W2[Worker 2]
|
|
72
|
+
P --> W3[Worker 3]
|
|
73
|
+
P --> W4[Worker 4]
|
|
74
|
+
W1 --> L1[Direct .json Lookup ~120ms]
|
|
75
|
+
L1 --> U1[Promise.all: Upload All 9 Manifests in Parallel]
|
|
76
|
+
U1 --> R[Total Time: ~4 Minutes 🚀]
|
|
77
|
+
end
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 🛠️ Key Technical Superpowers
|
|
83
|
+
|
|
84
|
+
### 1. Parallel Platform Manifest Uploads
|
|
85
|
+
Instead of shelling out to publish 9 manifests one after another, Zappifest Nano reads all generated manifests in-memory and dispatches them directly via `Promise.all`:
|
|
86
|
+
```typescript
|
|
87
|
+
await Promise.all(
|
|
88
|
+
manifests.map(async (manifest) => {
|
|
89
|
+
await uploadPluginVersion({ pluginId: plugin.id, manifest });
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 2. Topological Dependency Batching with Worker Pools
|
|
95
|
+
Plugins and core framework packages form a Directed Acyclic Graph (DAG). Packages in the same dependency tier publish in parallel using a resilient 4-worker queue pool:
|
|
96
|
+
```typescript
|
|
97
|
+
const BATCH_CONCURRENCY = 4;
|
|
98
|
+
const workers = Array.from({ length: concurrency }, async () => {
|
|
99
|
+
while (currentIndex < batch.length) {
|
|
100
|
+
const index = currentIndex++;
|
|
101
|
+
await batch[index].publish(version);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
await Promise.all(workers);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 3. CloudFront WAF Compliance
|
|
108
|
+
Zapp's edge infrastructure protects the Admin API via CloudFront WAF rules. Zappifest Nano handles user agent negotiation and native multipart streaming seamlessly:
|
|
109
|
+
- **User-Agent**: Explicitly identifies with authorized `Zappifest/0.66.0` signature.
|
|
110
|
+
- **REST Endpoints**: Calls `/plugins/${slug}.json` directly, eliminating Rails 406 format errors.
|
|
111
|
+
|
|
112
|
+
### 4. Dynamic Target & Framework ID Mapping
|
|
113
|
+
Rails model validations on Zapp Admin require integer database IDs for targets and UI frameworks rather than raw manifest strings. Zappifest Nano automatically resolves and caches these mappings:
|
|
114
|
+
- `mobile` ➔ `[1]`
|
|
115
|
+
- `tv` ➔ `[2]`
|
|
116
|
+
- `quickbrick` ➔ `[2]`
|
|
117
|
+
|
|
118
|
+
### 5. Atomic Workspace File Writes
|
|
119
|
+
Under heavy concurrent publishing, npm CLI traverses parent directories to discover workspaces. Zappifest Nano guarantees zero-byte file read errors through atomic temporary file generation and filesystem renames:
|
|
120
|
+
```typescript
|
|
121
|
+
const tmpPath = `${targetPath}.tmp.${Date.now()}.${Math.random().toString(36).slice(2, 6)}`;
|
|
122
|
+
await fs.promises.writeFile(tmpPath, data, options);
|
|
123
|
+
await fs.promises.rename(tmpPath, targetPath);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 🛡️ Escape Hatch: Legacy Fallback
|
|
129
|
+
|
|
130
|
+
If for any troubleshooting reason you ever need to fall back to the legacy Ruby CLI, simply set the environment variable:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
export USE_LEGACY_ZAPPIFEST=true
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
*(Warning: doing so will bring back the 14-minute deploy time!)*
|
|
137
|
+
|
|
138
|
+
---
|
|
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
|
+
Deployment history fetching requests only the current branch and uses
|
|
172
|
+
`--filter=blob:none`, retaining full commit history, trees, and all tags for
|
|
173
|
+
existing release selection and stable changelog generation without downloading
|
|
174
|
+
historical file contents. The shallow checkout already contains the pipeline's
|
|
175
|
+
working files. Git can lazily fetch an older file's contents from the configured
|
|
176
|
+
promisor remote if a command actually needs them. Other remote branch tips are
|
|
177
|
+
not fetched. Tags can still bring in commit history from other branches; this is
|
|
178
|
+
not a bounded-depth fetch. The checkout remains at the pipeline commit even if
|
|
179
|
+
the remote branch has advanced. Compare the `Fetch Git History for Deploy` step
|
|
180
|
+
with the previous full-remote fetch baseline.
|
|
181
|
+
|
|
182
|
+
Plugin npm version/publish commands retain workspace discovery so npm loads the
|
|
183
|
+
repository-root `.npmrc`, including the `NPM_TOKEN` authentication configuration.
|
|
184
|
+
Do not pass `--workspaces=false` as a performance optimization: it changes npm's
|
|
185
|
+
project-root resolution and prevents that configuration from being loaded when
|
|
186
|
+
publishing from plugin directories. A dry-run publish does not validate registry
|
|
187
|
+
authentication. Framework package publishing still uses the explicit Yarn
|
|
188
|
+
workspace command. Publishing concurrency and executor resources are unchanged.
|
|
189
|
+
|
|
190
|
+
Stage durations overlap across concurrent packages and nested stages: do not sum
|
|
191
|
+
them as elapsed release time. Use release/batch durations for wall-clock timing
|
|
192
|
+
and group package stages by `packageName` and `version` to find bottlenecks.
|
|
193
|
+
Child-process output is buffered by the existing deploy wrapper, so use record
|
|
194
|
+
timestamps rather than console arrival order. Only compare actual publishes
|
|
195
|
+
with similar published/skipped counts, not dry runs or no-op releases.
|
|
196
|
+
|
|
197
|
+
Framework package versions are updated using the deploy script's atomic
|
|
198
|
+
write-and-rename helper rather than `npm version`. This prevents concurrent
|
|
199
|
+
workspace discovery from reading a temporarily empty `package.json`. Framework
|
|
200
|
+
packages have no version lifecycle scripts; standalone plugin CLI publishing
|
|
201
|
+
retains its existing npm version behavior.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
*Engineered with pride for the QuickBrick developer community.*
|
|
@@ -14,7 +14,7 @@ const getOptions = (opts = {}) => ({
|
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
jest.mock("simple-git
|
|
17
|
+
jest.mock("simple-git", () =>
|
|
18
18
|
jest.fn((path) => {
|
|
19
19
|
return {
|
|
20
20
|
status: function () {
|
|
@@ -87,7 +87,7 @@ jest.mock("fs", () => ({
|
|
|
87
87
|
}));
|
|
88
88
|
|
|
89
89
|
const logger = require("../../../logger");
|
|
90
|
-
const git = require("simple-git
|
|
90
|
+
const git = require("simple-git");
|
|
91
91
|
|
|
92
92
|
const { configurator } = require("../configurator");
|
|
93
93
|
|