@mondaydotcomorg/z2h-cli 0.15.2 → 0.16.0
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/dist/commands/__tests__/deploy.test.d.ts +2 -0
- package/dist/commands/__tests__/deploy.test.d.ts.map +1 -0
- package/dist/commands/build.d.ts +8 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +12 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +1 -12
- package/dist/commands/deploy.d.ts +3 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +69 -72
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +1 -11
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +10 -5
- package/dist/esm/commands/__tests__/deploy.test.d.ts +2 -0
- package/dist/esm/commands/__tests__/deploy.test.d.ts.map +1 -0
- package/dist/esm/commands/build.d.ts +8 -1
- package/dist/esm/commands/build.d.ts.map +1 -1
- package/dist/esm/commands/build.mjs +9 -1
- package/dist/esm/commands/create.d.ts.map +1 -1
- package/dist/esm/commands/create.mjs +2 -13
- package/dist/esm/commands/deploy.d.ts +3 -0
- package/dist/esm/commands/deploy.d.ts.map +1 -1
- package/dist/esm/commands/deploy.mjs +72 -74
- package/dist/esm/commands/doctor.d.ts.map +1 -1
- package/dist/esm/commands/doctor.mjs +1 -11
- package/dist/esm/constants.d.ts +2 -0
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/constants.mjs +9 -6
- package/dist/esm/index.mjs +9 -15
- package/dist/esm/migrations/006-remove-start-script.d.ts +3 -0
- package/dist/esm/migrations/006-remove-start-script.d.ts.map +1 -0
- package/dist/esm/migrations/006-remove-start-script.mjs +22 -0
- package/dist/esm/util/__tests__/app-name.test.d.ts +2 -0
- package/dist/esm/util/__tests__/app-name.test.d.ts.map +1 -0
- package/dist/esm/util/app-name.d.ts +17 -0
- package/dist/esm/util/app-name.d.ts.map +1 -1
- package/dist/esm/util/app-name.mjs +45 -1
- package/dist/esm/util/auth/broker-credential-provider.d.ts +7 -5
- package/dist/esm/util/auth/broker-credential-provider.d.ts.map +1 -1
- package/dist/esm/util/auth/broker-credential-provider.mjs +28 -16
- package/dist/esm/util/broker/__tests__/app.test.d.ts +2 -0
- package/dist/esm/util/broker/__tests__/app.test.d.ts.map +1 -0
- package/dist/esm/util/broker/app.d.ts +15 -0
- package/dist/esm/util/broker/app.d.ts.map +1 -1
- package/dist/esm/util/broker/app.mjs +44 -1
- package/dist/esm/util/prompt-visibility.d.ts +2 -0
- package/dist/esm/util/prompt-visibility.d.ts.map +1 -0
- package/dist/esm/util/prompt-visibility.mjs +19 -0
- package/dist/index.js +9 -15
- package/dist/migrations/006-remove-start-script.d.ts +3 -0
- package/dist/migrations/006-remove-start-script.d.ts.map +1 -0
- package/dist/migrations/006-remove-start-script.js +24 -0
- package/dist/util/__tests__/app-name.test.d.ts +2 -0
- package/dist/util/__tests__/app-name.test.d.ts.map +1 -0
- package/dist/util/app-name.d.ts +17 -0
- package/dist/util/app-name.d.ts.map +1 -1
- package/dist/util/app-name.js +49 -2
- package/dist/util/auth/broker-credential-provider.d.ts +7 -5
- package/dist/util/auth/broker-credential-provider.d.ts.map +1 -1
- package/dist/util/auth/broker-credential-provider.js +28 -16
- package/dist/util/broker/__tests__/app.test.d.ts +2 -0
- package/dist/util/broker/__tests__/app.test.d.ts.map +1 -0
- package/dist/util/broker/app.d.ts +15 -0
- package/dist/util/broker/app.d.ts.map +1 -1
- package/dist/util/broker/app.js +44 -0
- package/dist/util/prompt-visibility.d.ts +2 -0
- package/dist/util/prompt-visibility.d.ts.map +1 -0
- package/dist/util/prompt-visibility.js +21 -0
- package/migrations.json +5 -0
- package/package.json +1 -1
- package/src/commands/__tests__/create.test.ts +5 -0
- package/src/commands/__tests__/deploy.test.ts +215 -0
- package/src/commands/__tests__/doctor.test.ts +0 -12
- package/src/commands/build.ts +20 -2
- package/src/commands/create.ts +2 -18
- package/src/commands/deploy.ts +113 -93
- package/src/commands/doctor.ts +1 -20
- package/src/constants.ts +10 -5
- package/src/index.ts +31 -25
- package/src/migrations/006-remove-start-script.ts +24 -0
- package/src/shadow/__tests__/merge-package-json.test.ts +0 -1
- package/src/templates/app/CLAUDE.md +3 -3
- package/src/templates/app/package.json.tmpl +0 -1
- package/src/templates/workspace/README.md +2 -2
- package/src/util/__tests__/app-name.test.ts +78 -0
- package/src/util/app-name.ts +55 -0
- package/src/util/auth/__tests__/broker-credential-provider.test.ts +53 -1
- package/src/util/auth/broker-credential-provider.ts +41 -16
- package/src/util/broker/__tests__/app.test.ts +104 -0
- package/src/util/broker/app.ts +68 -0
- package/src/util/prompt-visibility.ts +18 -0
- package/dist/commands/dev.d.ts +0 -5
- package/dist/commands/dev.d.ts.map +0 -1
- package/dist/commands/dev.js +0 -92
- package/dist/esm/commands/dev.d.ts +0 -5
- package/dist/esm/commands/dev.d.ts.map +0 -1
- package/dist/esm/commands/dev.mjs +0 -85
- package/src/commands/dev.ts +0 -93
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.test.d.ts","sourceRoot":"","sources":["../../../src/commands/__tests__/deploy.test.ts"],"names":[],"mappings":""}
|
package/dist/commands/build.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import type { AssetManifestFile } from '../util/manifest';
|
|
1
2
|
export interface BuildOptions {
|
|
2
3
|
publicUrl?: string;
|
|
3
4
|
}
|
|
4
|
-
export
|
|
5
|
+
export interface BuildResult {
|
|
6
|
+
appName: string;
|
|
7
|
+
port: number;
|
|
8
|
+
buildDir: string;
|
|
9
|
+
assetManifest: AssetManifestFile;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildCommand(opts?: BuildOptions): Promise<BuildResult>;
|
|
5
12
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,wBAAsB,YAAY,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,iBAAiB,CAAC;CAClC;AAGD,wBAAsB,YAAY,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAyChF"}
|
package/dist/commands/build.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
+
const path = require('node:path');
|
|
3
4
|
const fs = require('fs-extra');
|
|
4
5
|
const execa = require('execa');
|
|
5
6
|
const util_logger = require('../util/logger.js');
|
|
6
7
|
const shadow_prepare = require('../shadow/prepare.js');
|
|
7
8
|
|
|
9
|
+
const _interopDefault = e => e && e.__esModule ? e : { default: e };
|
|
10
|
+
|
|
11
|
+
const path__default = /*#__PURE__*/_interopDefault(path);
|
|
12
|
+
|
|
8
13
|
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
9
14
|
async function buildCommand(opts = {}) {
|
|
10
15
|
const ctx = await shadow_prepare.prepareShadow();
|
|
@@ -28,12 +33,19 @@ async function buildCommand(opts = {}) {
|
|
|
28
33
|
if (!(await fs.pathExists(ctx.paths.shadowBuild))) {
|
|
29
34
|
throw new Error(`Expected build output at ${ctx.paths.shadowBuild} — not found.`);
|
|
30
35
|
}
|
|
36
|
+
// Trident emits the canonical per-MF manifest at build/asset-manifest.json.
|
|
37
|
+
const assetManifestPath = path__default.default.join(ctx.paths.shadowBuild, 'asset-manifest.json');
|
|
38
|
+
if (!(await fs.pathExists(assetManifestPath))) {
|
|
39
|
+
throw new Error(`Missing asset-manifest.json at ${assetManifestPath}.`);
|
|
40
|
+
}
|
|
41
|
+
const assetManifest = (await fs.readJson(assetManifestPath));
|
|
31
42
|
util_logger.output(`[z2h-cli] build complete — artifacts at ${ctx.paths.shadowBuild}`, {
|
|
32
43
|
ok: true,
|
|
33
44
|
appName: ctx.appName,
|
|
34
45
|
port: ctx.port,
|
|
35
46
|
buildDir: ctx.paths.shadowBuild,
|
|
36
47
|
});
|
|
48
|
+
return { appName: ctx.appName, port: ctx.port, buildDir: ctx.paths.shadowBuild, assetManifest };
|
|
37
49
|
}
|
|
38
50
|
|
|
39
51
|
exports.buildCommand = buildCommand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAA2C,MAAM,4BAA4B,CAAC;AAKpH,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAwBD,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoF5F"}
|
package/dist/commands/create.js
CHANGED
|
@@ -6,7 +6,6 @@ const fs = require('fs-extra');
|
|
|
6
6
|
const util_logger = require('../util/logger.js');
|
|
7
7
|
const util_workspace = require('../util/workspace.js');
|
|
8
8
|
const util_templates = require('../util/templates.js');
|
|
9
|
-
const constants = require('../constants.js');
|
|
10
9
|
const util_npm_install = require('../util/npm/install.js');
|
|
11
10
|
const util_git_repo = require('../util/git/repo.js');
|
|
12
11
|
const util_git_remoteOptions = require('../util/git/remote-options.js');
|
|
@@ -18,10 +17,6 @@ const _interopDefault = e => e && e.__esModule ? e : { default: e };
|
|
|
18
17
|
|
|
19
18
|
const path__default = /*#__PURE__*/_interopDefault(path);
|
|
20
19
|
|
|
21
|
-
// Names reserved by the host MF (mf-bigbrain-zth) for platform pages under
|
|
22
|
-
// /bigbrain-vibe/<name>. Creating an app with one of these would shadow the
|
|
23
|
-
// platform page in the URL, so we refuse upfront.
|
|
24
|
-
const RESERVED_APP_NAMES = new Set(['generate-z2h-token']);
|
|
25
20
|
/**
|
|
26
21
|
* Convert kebab-case to PascalCase. `demo-app` → `DemoApp`.
|
|
27
22
|
*/
|
|
@@ -46,13 +41,7 @@ async function createCommand(appName, opts = {}) {
|
|
|
46
41
|
// Validate workspace.
|
|
47
42
|
const workspace = await util_workspace.assertWorkspace();
|
|
48
43
|
// Validate app name.
|
|
49
|
-
|
|
50
|
-
throw new Error(`App name "${appName}" is reserved by the Z2H host for a platform page under /bigbrain-vibe/${appName}. Pick a different name.`);
|
|
51
|
-
}
|
|
52
|
-
if (!constants.APP_NAME_PATTERN.test(appName)) {
|
|
53
|
-
throw new Error(`App name "${appName}" is invalid. Use lowercase kebab-case (a-z, 0-9, -), ` +
|
|
54
|
-
`2-50 chars, starting with a letter.`);
|
|
55
|
-
}
|
|
44
|
+
util_appName.validateAppName(appName);
|
|
56
45
|
// Validate --remote up front before any file I/O.
|
|
57
46
|
util_git_remoteOptions.validateRemoteOptions(opts, true);
|
|
58
47
|
// Resolve template.
|
|
@@ -3,6 +3,9 @@ export interface DeployOptions {
|
|
|
3
3
|
dryRun?: boolean;
|
|
4
4
|
remote?: RemoteType;
|
|
5
5
|
repoUrl?: string;
|
|
6
|
+
preview?: boolean;
|
|
7
|
+
previewId?: string;
|
|
8
|
+
open?: boolean;
|
|
6
9
|
}
|
|
7
10
|
export declare function deployCommand(opts?: DeployOptions): Promise<void>;
|
|
8
11
|
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,UAAU,EAA2C,MAAM,4BAA4B,CAAC;AAUtG,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAWD,wBAAsB,aAAa,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB3E"}
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const path = require('node:path');
|
|
4
3
|
const os = require('node:os');
|
|
5
|
-
const
|
|
4
|
+
const crypto = require('node:crypto');
|
|
6
5
|
const fs = require('fs-extra');
|
|
7
6
|
const util_logger = require('../util/logger.js');
|
|
8
7
|
const shadow_paths = require('../shadow/paths.js');
|
|
@@ -12,17 +11,18 @@ const constants = require('../constants.js');
|
|
|
12
11
|
const util_auth_brokerCredentialProvider = require('../util/auth/broker-credential-provider.js');
|
|
13
12
|
const util_auth_authStore = require('../util/auth/auth-store.js');
|
|
14
13
|
const util_appName = require('../util/app-name.js');
|
|
15
|
-
const util_machineIdentity = require('../util/machine-identity.js');
|
|
16
14
|
const util_git_repo = require('../util/git/repo.js');
|
|
17
15
|
const util_git_gitEnv = require('../util/git/git-env.js');
|
|
18
16
|
const util_git_remoteOptions = require('../util/git/remote-options.js');
|
|
19
17
|
const util_s3_client = require('../util/s3/client.js');
|
|
20
|
-
const
|
|
18
|
+
const util_machineIdentity = require('../util/machine-identity.js');
|
|
19
|
+
const util_broker_app = require('../util/broker/app.js');
|
|
20
|
+
const util_openBrowser = require('../util/open-browser.js');
|
|
21
21
|
const commands_build = require('./build.js');
|
|
22
|
+
const commands_tag = require('./tag.js');
|
|
22
23
|
|
|
23
24
|
const _interopDefault = e => e && e.__esModule ? e : { default: e };
|
|
24
25
|
|
|
25
|
-
const path__default = /*#__PURE__*/_interopDefault(path);
|
|
26
26
|
const os__default = /*#__PURE__*/_interopDefault(os);
|
|
27
27
|
|
|
28
28
|
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
@@ -32,10 +32,68 @@ async function deployCommand(opts = {}) {
|
|
|
32
32
|
if (!consumerPkg.name) {
|
|
33
33
|
throw new Error('Consumer package.json must have a "name" field');
|
|
34
34
|
}
|
|
35
|
+
util_appName.validateAppName(util_appName.cleanAppName(consumerPkg.name));
|
|
35
36
|
const appName = util_appName.mfAppName(consumerPkg.name);
|
|
36
37
|
// Validate the user's deploy token is on disk before doing any expensive
|
|
37
38
|
// work. Throws Z2hAuthMissingError with a remediation hint if not.
|
|
38
39
|
const { token } = await util_auth_authStore.readZthAuth();
|
|
40
|
+
const ctx = { paths, consumerName: consumerPkg.name, appName, token, opts };
|
|
41
|
+
if (opts.preview) {
|
|
42
|
+
await deployPreview(ctx);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
await deployLive(ctx);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Runs the build step and turns its output into a ManifestEntry ready to
|
|
50
|
+
* register/update — the one step a real deploy and a preview both need
|
|
51
|
+
* identically: build, then stamp version/url/deployedBy/gitRemote onto the
|
|
52
|
+
* asset manifest Trident emitted.
|
|
53
|
+
*/
|
|
54
|
+
async function buildAndStamp(opts) {
|
|
55
|
+
const { assetManifest } = await commands_build.buildCommand({ publicUrl: opts.publicUrl });
|
|
56
|
+
const deployedBy = util_machineIdentity.getMachineAppName() ?? os__default.default.userInfo().username;
|
|
57
|
+
return {
|
|
58
|
+
...assetManifest,
|
|
59
|
+
version: opts.nextVersion,
|
|
60
|
+
url: opts.publicUrl,
|
|
61
|
+
deployedBy,
|
|
62
|
+
gitRemote: opts.gitRemote,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
async function deployPreview({ paths, consumerName, appName, token, opts }) {
|
|
66
|
+
const previewId = opts.previewId ?? crypto.randomUUID();
|
|
67
|
+
const previewSlug = util_appName.buildPreviewSlug(consumerName, previewId);
|
|
68
|
+
const previewAppName = util_appName.mfAppName(previewSlug);
|
|
69
|
+
const keyPrefix = `${constants.S3_PREVIEWS_FOLDER}/${appName}/${previewId}/MF`;
|
|
70
|
+
// Full CDN URL, not a relative path — trident-skeleton uses a manifest
|
|
71
|
+
// entry's `url` verbatim as the asset base, never joined with its own mfUrl.
|
|
72
|
+
const url = `${constants.BUCKET_READ_DNS_URL}/${keyPrefix}`;
|
|
73
|
+
const nextVersion = (await util_auth_brokerCredentialProvider.fetchDeployVersion(previewAppName)) + 1;
|
|
74
|
+
util_logger.info('building');
|
|
75
|
+
const entry = await buildAndStamp({ paths, publicUrl: url, nextVersion, gitRemote: '' });
|
|
76
|
+
const creds = await util_auth_brokerCredentialProvider.brokerCredentialProvider({ appName, previewId })();
|
|
77
|
+
util_s3_client.setupS3Client(creds);
|
|
78
|
+
util_logger.info(`uploading preview build → s3://${constants.BUCKET_WRITE_NAME}/${keyPrefix}/`);
|
|
79
|
+
await util_s3_upload.uploadDir(paths.shadowBuild, keyPrefix);
|
|
80
|
+
await util_broker_app.registerOrUpdateApp({ appName: previewAppName, token, nextVersion, entry, gitRemote: '' });
|
|
81
|
+
const previewUrl = `https://bigbrain.me/bigbrain-vibe/${previewSlug}`;
|
|
82
|
+
util_logger.output(`[z2h-cli] preview ready ✅\n app: ${appName}\n previewAppName: ${previewAppName}\n open: ${previewUrl}`, {
|
|
83
|
+
ok: true,
|
|
84
|
+
appName,
|
|
85
|
+
previewId,
|
|
86
|
+
previewAppName,
|
|
87
|
+
bucket: constants.BUCKET_WRITE_NAME,
|
|
88
|
+
keyPrefix,
|
|
89
|
+
url,
|
|
90
|
+
previewUrl,
|
|
91
|
+
});
|
|
92
|
+
if (opts.open) {
|
|
93
|
+
void util_openBrowser.openInBrowser(previewUrl);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async function deployLive({ paths, consumerName, appName, token, opts }) {
|
|
39
97
|
let gitRemote = await util_git_repo.getRemoteUrl(process.cwd());
|
|
40
98
|
if (gitRemote) {
|
|
41
99
|
if (opts.remote || opts.repoUrl) {
|
|
@@ -54,7 +112,7 @@ async function deployCommand(opts = {}) {
|
|
|
54
112
|
util_git_remoteOptions.validateRemoteOptions(opts);
|
|
55
113
|
// Pass the raw consumer name (not the mf-prefixed appName) so defaultS3Remote
|
|
56
114
|
// produces the correct s3://bucket/mf-<name>/git path without double prefix.
|
|
57
|
-
const remote = util_git_remoteOptions.resolveRemoteUrl(opts.remote,
|
|
115
|
+
const remote = util_git_remoteOptions.resolveRemoteUrl(opts.remote, consumerName, opts.repoUrl);
|
|
58
116
|
util_logger.info(`initializing git repo with ${opts.remote} remote...`);
|
|
59
117
|
await util_git_repo.initRepo(process.cwd(), remote);
|
|
60
118
|
gitRemote = remote;
|
|
@@ -74,24 +132,7 @@ async function deployCommand(opts = {}) {
|
|
|
74
132
|
const keyPrefix = `${appName}/${nextVersion}`;
|
|
75
133
|
const url = `${constants.BUCKET_READ_DNS_URL}/${keyPrefix}`;
|
|
76
134
|
util_logger.info('building');
|
|
77
|
-
await
|
|
78
|
-
if (!(await fs.pathExists(paths.shadowBuild))) {
|
|
79
|
-
throw new Error(`No build output at ${paths.shadowBuild} after build step.`);
|
|
80
|
-
}
|
|
81
|
-
// Trident emits the canonical per-MF manifest at build/asset-manifest.json.
|
|
82
|
-
const assetManifestPath = path__default.default.join(paths.shadowBuild, 'asset-manifest.json');
|
|
83
|
-
if (!(await fs.pathExists(assetManifestPath))) {
|
|
84
|
-
throw new Error(`Missing asset-manifest.json at ${assetManifestPath}.`);
|
|
85
|
-
}
|
|
86
|
-
const assetManifest = (await fs.readJson(assetManifestPath));
|
|
87
|
-
const deployedBy = util_machineIdentity.getMachineAppName() ?? os__default.default.userInfo().username;
|
|
88
|
-
const entry = {
|
|
89
|
-
...assetManifest,
|
|
90
|
-
version: nextVersion,
|
|
91
|
-
url,
|
|
92
|
-
deployedBy,
|
|
93
|
-
gitRemote,
|
|
94
|
-
};
|
|
135
|
+
const entry = await buildAndStamp({ paths, publicUrl: url, nextVersion, gitRemote });
|
|
95
136
|
if (opts.dryRun) {
|
|
96
137
|
util_logger.output(`[z2h-cli] dry-run: would upload to s3://${constants.BUCKET_WRITE_NAME}/${keyPrefix}/ as v${version}`, {
|
|
97
138
|
ok: true,
|
|
@@ -121,18 +162,7 @@ async function deployCommand(opts = {}) {
|
|
|
121
162
|
}
|
|
122
163
|
util_logger.info(`uploading build → s3://${constants.BUCKET_WRITE_NAME}/${keyPrefix}/`);
|
|
123
164
|
await util_s3_upload.uploadDir(paths.shadowBuild, keyPrefix);
|
|
124
|
-
|
|
125
|
-
// The two are separate endpoints, so the CLI picks based on the version it
|
|
126
|
-
// was handed.
|
|
127
|
-
if (nextVersion === 1) {
|
|
128
|
-
const visibility = await resolveFirstDeployVisibility(appName);
|
|
129
|
-
util_logger.info(`registering app "${appName}" → v${nextVersion} (${visibility})`);
|
|
130
|
-
await registerApp(appName, token, nextVersion, entry, visibility, gitRemote);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
util_logger.info(`releasing "${appName}" → v${nextVersion}`);
|
|
134
|
-
await updateApp(appName, token, nextVersion, entry, gitRemote);
|
|
135
|
-
}
|
|
165
|
+
await util_broker_app.registerOrUpdateApp({ appName, token, nextVersion, entry, gitRemote });
|
|
136
166
|
}
|
|
137
167
|
finally {
|
|
138
168
|
await releaseLockBestEffort(appName, token);
|
|
@@ -143,7 +173,7 @@ async function deployCommand(opts = {}) {
|
|
|
143
173
|
// The host MF parses the app name from the URL and prepends `mf-` itself
|
|
144
174
|
// before looking it up in the manifest. So the user-facing URL must use
|
|
145
175
|
// the consumer's de-scoped package name (no `mf-` prefix, no `@scope/`).
|
|
146
|
-
const liveUrl = `https://bigbrain.me/bigbrain-vibe/${util_appName.cleanAppName(
|
|
176
|
+
const liveUrl = `https://bigbrain.me/bigbrain-vibe/${util_appName.cleanAppName(consumerName)}`;
|
|
147
177
|
util_logger.output(`[z2h-cli] deployed ✅\n app: ${appName}\n version: ${nextVersion}\n open: ${liveUrl}`, {
|
|
148
178
|
ok: true,
|
|
149
179
|
appName,
|
|
@@ -154,16 +184,8 @@ async function deployCommand(opts = {}) {
|
|
|
154
184
|
liveUrl,
|
|
155
185
|
entry,
|
|
156
186
|
});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const res = await fetch(`${constants.brokerBaseUrl()}/z2h-cli/apps/register`, {
|
|
160
|
-
method: 'POST',
|
|
161
|
-
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json', ...constants.routingHeaders() },
|
|
162
|
-
body: JSON.stringify({ appName, version, entry, visibility, gitRemote }),
|
|
163
|
-
});
|
|
164
|
-
if (!res.ok) {
|
|
165
|
-
const text = await res.text();
|
|
166
|
-
throw new Error(`App registration failed (${res.status}): ${text.slice(0, 1024)}`);
|
|
187
|
+
if (opts.open) {
|
|
188
|
+
void util_openBrowser.openInBrowser(liveUrl);
|
|
167
189
|
}
|
|
168
190
|
}
|
|
169
191
|
const TAG_NUDGE = "run 'z2h-cli tag' to categorize this app (app type & team)";
|
|
@@ -204,31 +226,6 @@ async function acquireDeployLock(appName, token) {
|
|
|
204
226
|
}
|
|
205
227
|
util_logger.info(`deploy lock acquired for ${appName}`);
|
|
206
228
|
}
|
|
207
|
-
async function updateApp(appName, token, version, entry, gitRemote) {
|
|
208
|
-
const res = await fetch(`${constants.brokerBaseUrl()}/z2h-cli/apps/update`, {
|
|
209
|
-
method: 'POST',
|
|
210
|
-
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json', ...constants.routingHeaders() },
|
|
211
|
-
body: JSON.stringify({ appName, version, entry, gitRemote }),
|
|
212
|
-
});
|
|
213
|
-
if (!res.ok) {
|
|
214
|
-
const text = await res.text();
|
|
215
|
-
throw new Error(`App update failed (${res.status}): ${text.slice(0, 1024)}`);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
// First deploy only: decide whether the app is born public or private. The
|
|
219
|
-
// choice is passed to the register endpoint (default private). Non-interactive
|
|
220
|
-
// runs (--json or no TTY) always default to private.
|
|
221
|
-
async function resolveFirstDeployVisibility(appName) {
|
|
222
|
-
if (util_logger.getOutputMode() === 'json' || !process.stdout.isTTY) {
|
|
223
|
-
return 'private';
|
|
224
|
-
}
|
|
225
|
-
const rl = node_readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
226
|
-
const answer = await new Promise(resolve => {
|
|
227
|
-
rl.question(`Make "${appName}" public to all monday.com employees? (y/N) `, resolve);
|
|
228
|
-
});
|
|
229
|
-
rl.close();
|
|
230
|
-
return answer.trim().toLowerCase() === 'y' ? 'public' : 'private';
|
|
231
|
-
}
|
|
232
229
|
// best-effort — the 2-min TTL backstop handles failures
|
|
233
230
|
async function releaseLockBestEffort(appName, token) {
|
|
234
231
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAwSA,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAqEnD"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -26,7 +26,6 @@ const Z2H_REPO_ROOT = path__default.default.join(HOME, 'Development', 'bigbrain-
|
|
|
26
26
|
const BOOTSTRAP_CMD = `bash ${path__default.default.join(Z2H_REPO_ROOT, 'z2h/setup/bootstrap.sh')}`;
|
|
27
27
|
const UPDATE_CMD = `bash ${path__default.default.join(Z2H_REPO_ROOT, 'z2h/setup/update.sh')}`;
|
|
28
28
|
const CLAUDE_PLUGINS_JSON = path__default.default.join(HOME, '.claude', 'plugins', 'installed_plugins.json');
|
|
29
|
-
const SSL_CERT_PATH = path__default.default.join(HOME, 'Library', 'Application Support', 'devcert', 'domains', 'webpack.llama.fan', 'certificate.crt');
|
|
30
29
|
// ── helpers ───────────────────────────────────────────────────────────────────
|
|
31
30
|
async function checkTool(label, opts) {
|
|
32
31
|
const { cmd, args, failStatus = 'fail', getVersion, fix } = opts;
|
|
@@ -220,15 +219,6 @@ async function checkReactVersion() {
|
|
|
220
219
|
detail: reactVersion,
|
|
221
220
|
};
|
|
222
221
|
}
|
|
223
|
-
async function checkSslCert() {
|
|
224
|
-
const ok = await fs.pathExists(SSL_CERT_PATH);
|
|
225
|
-
return {
|
|
226
|
-
label: 'SSL cert',
|
|
227
|
-
status: ok ? 'ok' : 'warn',
|
|
228
|
-
detail: ok ? 'webpack.llama.fan' : 'not found — auto-installs on first z2h-cli dev',
|
|
229
|
-
fix: ok ? undefined : 'z2h-cli dev',
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
222
|
async function checkPlugin(pluginKey, label, isMandatory, pluginsJson) {
|
|
233
223
|
const missingStatus = isMandatory ? 'fail' : 'warn';
|
|
234
224
|
if (!pluginsJson) {
|
|
@@ -275,7 +265,7 @@ async function doctorCommand() {
|
|
|
275
265
|
}
|
|
276
266
|
const systemChecks = await Promise.all([checkNvm(), checkNode(), checkYarn(), checkAws(), checkGitRemoteS3()]);
|
|
277
267
|
const cliChecks = await Promise.all([checkZ2hCli(), checkAuthToken(), checkNpmTokenInProfile()]);
|
|
278
|
-
const workspaceChecks = await Promise.all([checkWorkspace(), checkReactVersion()
|
|
268
|
+
const workspaceChecks = await Promise.all([checkWorkspace(), checkReactVersion()]);
|
|
279
269
|
const pluginChecks = await Promise.all([
|
|
280
270
|
checkPlugin('z2h@bigbrain-z2h', 'z2h plugin', true, pluginsJson),
|
|
281
271
|
checkPlugin('cf-external-claude-plugin@client-foundations-ai-tools', 'cf-external plugin', false, pluginsJson),
|
package/dist/constants.d.ts
CHANGED
|
@@ -13,9 +13,11 @@ export declare const REGION = "us-east-1";
|
|
|
13
13
|
export declare const BUCKET_WRITE_URL = "https://prod-use1-bigbrain-zth-mf-assets.s3.us-east-1.amazonaws.com";
|
|
14
14
|
export declare const BUCKET_READ_DNS_NAME = "bigbrain-zth-mf-assets";
|
|
15
15
|
export declare const BUCKET_READ_DNS_URL = "https://bigbrain-zth-mf-assets.bigbrain.me";
|
|
16
|
+
export declare const S3_PREVIEWS_FOLDER = "previews";
|
|
16
17
|
export declare const MANIFEST_KEY = "mf-assets";
|
|
17
18
|
export declare const MANIFEST_READ_URL = "https://bigbrain-zth-mf-assets.bigbrain.me/mf-assets";
|
|
18
19
|
export declare const APP_NAME_PATTERN: RegExp;
|
|
20
|
+
export declare const PREVIEW_APP_NAME_PREFIX = "zth-preview-";
|
|
19
21
|
export declare const DEFAULT_BROKER_BASE_URL = "https://bigbrain-zth.bigbrain.me";
|
|
20
22
|
/**
|
|
21
23
|
* Resolves the broker origin (no trailing slash). Honors
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,eAAO,MAAM,eAAe,SAAS,CAAC;AAGtC,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,eAAO,MAAM,eAAe,SAAS,CAAC;AAGtC,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAEjD,CAAC;AAKF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAElD,CAAC;AAMF,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAC9B,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAG9B,eAAO,MAAM,iBAAiB,UAAY,CAAC;AAQ3C,eAAO,MAAM,iBAAiB,qCAAqC,CAAC;AACpE,eAAO,MAAM,MAAM,cAAc,CAAC;AAClC,eAAO,MAAM,gBAAgB,wEAA4D,CAAC;AAE1F,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAC7D,eAAO,MAAM,mBAAmB,+CAAgD,CAAC;AAIjF,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAK7C,eAAO,MAAM,YAAY,cAAc,CAAC;AACxC,eAAO,MAAM,iBAAiB,yDAA2C,CAAC;AAM1E,eAAO,MAAM,gBAAgB,QAA2B,CAAC;AAEzD,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAKtD,eAAO,MAAM,uBAAuB,qCAAqC,CAAC;AAE1E;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAID,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGvD;AAKD,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAG9C,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAGnD,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AAMrE,eAAO,MAAM,iBAAiB,EAAG,eAAwB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
|
package/dist/constants.js
CHANGED
|
@@ -8,7 +8,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
8
8
|
const SHADOW_DIR_NAME = '.zth';
|
|
9
9
|
// ─────────── Shadow scripts ───────
|
|
10
10
|
const SHADOW_SCRIPTS = {
|
|
11
|
-
start: 'trident start',
|
|
12
11
|
build: 'trident build',
|
|
13
12
|
};
|
|
14
13
|
// ─────────── Shadow dev deps ───────
|
|
@@ -17,10 +16,10 @@ const SHADOW_SCRIPTS = {
|
|
|
17
16
|
const SHADOW_DEV_DEPS = {
|
|
18
17
|
'@mondaydotcomorg/trident-toolkit': '^2.9.25',
|
|
19
18
|
};
|
|
20
|
-
// ─────────── Auto-allocated
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
19
|
+
// ─────────── Auto-allocated shadow port range ────
|
|
20
|
+
// Baked into every shadow's .tridentrc.js regardless of whether a dev server
|
|
21
|
+
// ever binds it. High enough to dodge common dev defaults (3000 Next, 5173
|
|
22
|
+
// Vite, 8080). Collisions within the 7k-port pool are rare for POC.
|
|
24
23
|
const MIN_PORT = 13000;
|
|
25
24
|
const MAX_PORT = 19999;
|
|
26
25
|
// ─────────── Gitignore entries auto-appended to the consumer's file ────
|
|
@@ -35,6 +34,9 @@ const REGION = 'us-east-1';
|
|
|
35
34
|
const BUCKET_WRITE_URL = `https://${BUCKET_WRITE_NAME}.s3.${REGION}.amazonaws.com`;
|
|
36
35
|
const BUCKET_READ_DNS_NAME = 'bigbrain-zth-mf-assets';
|
|
37
36
|
const BUCKET_READ_DNS_URL = `https://${BUCKET_READ_DNS_NAME}.bigbrain.me`;
|
|
37
|
+
// Root prefix for ephemeral preview uploads: `previews/<appName>/<previewId>/MF/...`.
|
|
38
|
+
// Shared by the CLI (upload path) and bigbrain-zth (STS policy + manifest overlay).
|
|
39
|
+
const S3_PREVIEWS_FOLDER = 'previews';
|
|
38
40
|
// No `.json` extension — TridentSkeleton's `mfUrl` API appends `/mf-assets`
|
|
39
41
|
// to the bucket base when fetching, so the manifest must live at this exact
|
|
40
42
|
// key. See microfrontends/mf-bigbrain-zth/.../ZeroToHeroHost.tsx.
|
|
@@ -45,6 +47,7 @@ const MANIFEST_READ_URL = `${BUCKET_READ_DNS_URL}/${MANIFEST_KEY}`;
|
|
|
45
47
|
// backend STS broker rejects anything else with 400; the CLI can validate
|
|
46
48
|
// upfront for friendlier errors.
|
|
47
49
|
const APP_NAME_PATTERN = /^[a-z][a-z0-9-]{1,49}$/;
|
|
50
|
+
const PREVIEW_APP_NAME_PREFIX = 'zth-preview-';
|
|
48
51
|
// ─────────── Broker origin + npm registry (shared §3 contract) ─────
|
|
49
52
|
// The bigbrain-zth broker fronts both the STS credential route and the npm
|
|
50
53
|
// proxy. `Z2H_BROKER_BASE_URL` overrides the origin for tests/staging.
|
|
@@ -99,8 +102,10 @@ exports.MANIFEST_READ_URL = MANIFEST_READ_URL;
|
|
|
99
102
|
exports.MAX_PORT = MAX_PORT;
|
|
100
103
|
exports.MIN_PORT = MIN_PORT;
|
|
101
104
|
exports.NPM_BROKER_PATH = NPM_BROKER_PATH;
|
|
105
|
+
exports.PREVIEW_APP_NAME_PREFIX = PREVIEW_APP_NAME_PREFIX;
|
|
102
106
|
exports.PUBLIC_NPM_REGISTRY_URL = PUBLIC_NPM_REGISTRY_URL;
|
|
103
107
|
exports.REGION = REGION;
|
|
108
|
+
exports.S3_PREVIEWS_FOLDER = S3_PREVIEWS_FOLDER;
|
|
104
109
|
exports.SHADOW_DEV_DEPS = SHADOW_DEV_DEPS;
|
|
105
110
|
exports.SHADOW_DIR_NAME = SHADOW_DIR_NAME;
|
|
106
111
|
exports.SHADOW_SCRIPTS = SHADOW_SCRIPTS;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.test.d.ts","sourceRoot":"","sources":["../../../../src/commands/__tests__/deploy.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import type { AssetManifestFile } from '../util/manifest';
|
|
1
2
|
export interface BuildOptions {
|
|
2
3
|
publicUrl?: string;
|
|
3
4
|
}
|
|
4
|
-
export
|
|
5
|
+
export interface BuildResult {
|
|
6
|
+
appName: string;
|
|
7
|
+
port: number;
|
|
8
|
+
buildDir: string;
|
|
9
|
+
assetManifest: AssetManifestFile;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildCommand(opts?: BuildOptions): Promise<BuildResult>;
|
|
5
12
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,wBAAsB,YAAY,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,iBAAiB,CAAC;CAClC;AAGD,wBAAsB,YAAY,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAyChF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { pathExists, readJson } from 'fs-extra';
|
|
2
3
|
import { execa } from 'execa';
|
|
3
4
|
import { info, output } from '../util/logger.mjs';
|
|
4
5
|
import { prepareShadow } from '../shadow/prepare.mjs';
|
|
@@ -26,12 +27,19 @@ async function buildCommand(opts = {}) {
|
|
|
26
27
|
if (!(await pathExists(ctx.paths.shadowBuild))) {
|
|
27
28
|
throw new Error(`Expected build output at ${ctx.paths.shadowBuild} — not found.`);
|
|
28
29
|
}
|
|
30
|
+
// Trident emits the canonical per-MF manifest at build/asset-manifest.json.
|
|
31
|
+
const assetManifestPath = path.join(ctx.paths.shadowBuild, 'asset-manifest.json');
|
|
32
|
+
if (!(await pathExists(assetManifestPath))) {
|
|
33
|
+
throw new Error(`Missing asset-manifest.json at ${assetManifestPath}.`);
|
|
34
|
+
}
|
|
35
|
+
const assetManifest = (await readJson(assetManifestPath));
|
|
29
36
|
output(`[z2h-cli] build complete — artifacts at ${ctx.paths.shadowBuild}`, {
|
|
30
37
|
ok: true,
|
|
31
38
|
appName: ctx.appName,
|
|
32
39
|
port: ctx.port,
|
|
33
40
|
buildDir: ctx.paths.shadowBuild,
|
|
34
41
|
});
|
|
42
|
+
return { appName: ctx.appName, port: ctx.port, buildDir: ctx.paths.shadowBuild, assetManifest };
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
export { buildCommand };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/create.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAA2C,MAAM,4BAA4B,CAAC;AAKpH,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAwBD,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoF5F"}
|
|
@@ -4,19 +4,14 @@ import { pathExists, ensureDir, writeFile, copy, readdir } from 'fs-extra';
|
|
|
4
4
|
import { info, warn, output } from '../util/logger.mjs';
|
|
5
5
|
import { assertWorkspace } from '../util/workspace.mjs';
|
|
6
6
|
import { APP_TEMPLATES, getTemplatesDir, renderTemplate } from '../util/templates.mjs';
|
|
7
|
-
import { APP_NAME_PATTERN } from '../constants.mjs';
|
|
8
7
|
import { runYarnInstall } from '../util/npm/install.mjs';
|
|
9
8
|
import { initRepo } from '../util/git/repo.mjs';
|
|
10
9
|
import { validateRemoteOptions, resolveRemoteUrl } from '../util/git/remote-options.mjs';
|
|
11
10
|
export { REMOTE_TYPES } from '../util/git/remote-options.mjs';
|
|
12
11
|
import { fetchApp } from '../util/broker/app.mjs';
|
|
13
|
-
import { mfAppName } from '../util/app-name.mjs';
|
|
12
|
+
import { validateAppName, mfAppName } from '../util/app-name.mjs';
|
|
14
13
|
import { prepareShadow } from '../shadow/prepare.mjs';
|
|
15
14
|
|
|
16
|
-
// Names reserved by the host MF (mf-bigbrain-zth) for platform pages under
|
|
17
|
-
// /bigbrain-vibe/<name>. Creating an app with one of these would shadow the
|
|
18
|
-
// platform page in the URL, so we refuse upfront.
|
|
19
|
-
const RESERVED_APP_NAMES = new Set(['generate-z2h-token']);
|
|
20
15
|
/**
|
|
21
16
|
* Convert kebab-case to PascalCase. `demo-app` → `DemoApp`.
|
|
22
17
|
*/
|
|
@@ -41,13 +36,7 @@ async function createCommand(appName, opts = {}) {
|
|
|
41
36
|
// Validate workspace.
|
|
42
37
|
const workspace = await assertWorkspace();
|
|
43
38
|
// Validate app name.
|
|
44
|
-
|
|
45
|
-
throw new Error(`App name "${appName}" is reserved by the Z2H host for a platform page under /bigbrain-vibe/${appName}. Pick a different name.`);
|
|
46
|
-
}
|
|
47
|
-
if (!APP_NAME_PATTERN.test(appName)) {
|
|
48
|
-
throw new Error(`App name "${appName}" is invalid. Use lowercase kebab-case (a-z, 0-9, -), ` +
|
|
49
|
-
`2-50 chars, starting with a letter.`);
|
|
50
|
-
}
|
|
39
|
+
validateAppName(appName);
|
|
51
40
|
// Validate --remote up front before any file I/O.
|
|
52
41
|
validateRemoteOptions(opts, true);
|
|
53
42
|
// Resolve template.
|
|
@@ -3,6 +3,9 @@ export interface DeployOptions {
|
|
|
3
3
|
dryRun?: boolean;
|
|
4
4
|
remote?: RemoteType;
|
|
5
5
|
repoUrl?: string;
|
|
6
|
+
preview?: boolean;
|
|
7
|
+
previewId?: string;
|
|
8
|
+
open?: boolean;
|
|
6
9
|
}
|
|
7
10
|
export declare function deployCommand(opts?: DeployOptions): Promise<void>;
|
|
8
11
|
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,UAAU,EAA2C,MAAM,4BAA4B,CAAC;AAUtG,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAWD,wBAAsB,aAAa,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB3E"}
|