@mondaydotcomorg/z2h-cli 0.7.1 → 0.7.2-feat-arielle-build-after-create-and-improve-setup-script-c31a761
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/build.d.ts.map +1 -1
- package/dist/commands/build.js +1 -0
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +1 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +5 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +1 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +3 -0
- package/dist/esm/commands/build.d.ts.map +1 -1
- package/dist/esm/commands/build.mjs +1 -0
- package/dist/esm/commands/clean.d.ts.map +1 -1
- package/dist/esm/commands/clean.mjs +1 -0
- package/dist/esm/commands/create.d.ts.map +1 -1
- package/dist/esm/commands/create.mjs +5 -0
- package/dist/esm/commands/deploy.d.ts.map +1 -1
- package/dist/esm/commands/deploy.mjs +1 -0
- package/dist/esm/commands/dev.d.ts.map +1 -1
- package/dist/esm/commands/dev.mjs +3 -0
- package/dist/esm/index.mjs +4 -1
- package/dist/esm/migrations/auto-migrate.mjs +3 -3
- package/dist/esm/shadow/scaffold.d.ts.map +1 -1
- package/dist/esm/shadow/scaffold.mjs +2 -1
- package/dist/esm/templates/app/claude-settings.mjs +1 -1
- package/dist/index.js +4 -1
- package/dist/migrations/auto-migrate.js +3 -3
- package/dist/shadow/scaffold.d.ts.map +1 -1
- package/dist/shadow/scaffold.js +2 -1
- package/dist/templates/app/claude-settings.js +1 -1
- package/package.json +1 -1
- package/src/commands/__tests__/create.test.ts +7 -0
- package/src/commands/build.ts +1 -0
- package/src/commands/clean.ts +1 -0
- package/src/commands/create.ts +6 -0
- package/src/commands/deploy.ts +1 -0
- package/src/commands/dev.ts +3 -0
- package/src/index.ts +4 -1
- package/src/migrations/auto-migrate.ts +4 -4
- package/src/shadow/scaffold.ts +2 -1
- package/src/templates/app/CLAUDE.md +3 -1
- package/src/templates/app/claude-settings.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCpE"}
|
package/dist/commands/build.js
CHANGED
|
@@ -5,6 +5,7 @@ const execa = require('execa');
|
|
|
5
5
|
const util_logger = require('../util/logger.js');
|
|
6
6
|
const shadow_prepare = require('../shadow/prepare.js');
|
|
7
7
|
|
|
8
|
+
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
8
9
|
async function buildCommand(opts) {
|
|
9
10
|
if (opts.json) {
|
|
10
11
|
util_logger.setOutputMode('json');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/commands/clean.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/commands/clean.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAGD,wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBpE"}
|
package/dist/commands/clean.js
CHANGED
|
@@ -4,6 +4,7 @@ const fsExtra = require('fs-extra');
|
|
|
4
4
|
const util_logger = require('../util/logger.js');
|
|
5
5
|
const shadow_paths = require('../shadow/paths.js');
|
|
6
6
|
|
|
7
|
+
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
7
8
|
async function cleanCommand(opts) {
|
|
8
9
|
if (opts.json) {
|
|
9
10
|
util_logger.setOutputMode('json');
|
|
@@ -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":"AAYA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AA6BD,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAuFvF"}
|
package/dist/commands/create.js
CHANGED
|
@@ -10,6 +10,7 @@ const util_manifest = require('../util/manifest.js');
|
|
|
10
10
|
const util_appName = require('../util/app-name.js');
|
|
11
11
|
const constants = require('../constants.js');
|
|
12
12
|
const util_npm_install = require('../util/npm/install.js');
|
|
13
|
+
const commands_build = require('./build.js');
|
|
13
14
|
|
|
14
15
|
const _interopDefault = e => e && e.__esModule ? e : { default: e };
|
|
15
16
|
|
|
@@ -97,6 +98,10 @@ async function createCommand(appName, opts) {
|
|
|
97
98
|
}
|
|
98
99
|
util_logger.info(`installing dependencies for ${appName}...`);
|
|
99
100
|
await util_npm_install.runYarnInstall({ cwd: workspace });
|
|
101
|
+
// build/dev/deploy all locate the consumer via process.cwd() — chdir before calling them.
|
|
102
|
+
util_logger.info(`pre-building ${appName}`);
|
|
103
|
+
process.chdir(appDir);
|
|
104
|
+
await commands_build.buildCommand({});
|
|
100
105
|
util_logger.output(`[z2h-cli] app ready at ${appDir}`, {
|
|
101
106
|
ok: true,
|
|
102
107
|
appDir,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAGD,wBAAsB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA+EtE"}
|
package/dist/commands/deploy.js
CHANGED
|
@@ -18,6 +18,7 @@ const _interopDefault = e => e && e.__esModule ? e : { default: e };
|
|
|
18
18
|
const path__default = /*#__PURE__*/_interopDefault(path);
|
|
19
19
|
const os__default = /*#__PURE__*/_interopDefault(os);
|
|
20
20
|
|
|
21
|
+
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
21
22
|
async function deployCommand(opts) {
|
|
22
23
|
if (opts.json) {
|
|
23
24
|
util_logger.setOutputMode('json');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAKD,wBAAsB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAyEhE"}
|
package/dist/commands/dev.js
CHANGED
|
@@ -16,6 +16,7 @@ const path__default = /*#__PURE__*/_interopDefault(path);
|
|
|
16
16
|
const fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
17
17
|
|
|
18
18
|
const TRIDENT_READY_PATTERN = /Server started at/i;
|
|
19
|
+
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
19
20
|
async function devCommand(opts) {
|
|
20
21
|
if (opts.json) {
|
|
21
22
|
util_logger.setOutputMode('json');
|
|
@@ -30,6 +31,8 @@ async function devCommand(opts) {
|
|
|
30
31
|
const server = execa.execa('yarn', ['start'], {
|
|
31
32
|
cwd: ctx.paths.shadowDir,
|
|
32
33
|
stdio: ['inherit', 'pipe', 'inherit'],
|
|
34
|
+
// Trident requires NPM_TOKEN to be set or it refuses to start; 'FAKE_TOKEN' satisfies the check without real credentials.
|
|
35
|
+
env: { ...process.env, NPM_TOKEN: process.env.NPM_TOKEN ?? 'FAKE_TOKEN' },
|
|
33
36
|
});
|
|
34
37
|
const pidFile = path__default.default.join(ctx.paths.shadowDir, 'dev.pid');
|
|
35
38
|
if (server.pid) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCpE"}
|
|
@@ -3,6 +3,7 @@ import { execa } from 'execa';
|
|
|
3
3
|
import { setOutputMode, info, output } from '../util/logger.mjs';
|
|
4
4
|
import { prepareShadow } from '../shadow/prepare.mjs';
|
|
5
5
|
|
|
6
|
+
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
6
7
|
async function buildCommand(opts) {
|
|
7
8
|
if (opts.json) {
|
|
8
9
|
setOutputMode('json');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/commands/clean.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/commands/clean.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAGD,wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBpE"}
|
|
@@ -2,6 +2,7 @@ import { pathExists, remove } from 'fs-extra';
|
|
|
2
2
|
import { setOutputMode, info, output } from '../util/logger.mjs';
|
|
3
3
|
import { resolveConsumerPaths } from '../shadow/paths.mjs';
|
|
4
4
|
|
|
5
|
+
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
5
6
|
async function cleanCommand(opts) {
|
|
6
7
|
if (opts.json) {
|
|
7
8
|
setOutputMode('json');
|
|
@@ -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":"AAYA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AA6BD,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAuFvF"}
|
|
@@ -8,6 +8,7 @@ import { readManifest } from '../util/manifest.mjs';
|
|
|
8
8
|
import { mfAppName } from '../util/app-name.mjs';
|
|
9
9
|
import { APP_NAME_PATTERN } from '../constants.mjs';
|
|
10
10
|
import { runYarnInstall } from '../util/npm/install.mjs';
|
|
11
|
+
import { buildCommand } from './build.mjs';
|
|
11
12
|
|
|
12
13
|
// Names reserved by the host MF (mf-bigbrain-zth) for platform pages under
|
|
13
14
|
// /bigbrain-vibe/<name>. Creating an app with one of these would shadow the
|
|
@@ -91,6 +92,10 @@ async function createCommand(appName, opts) {
|
|
|
91
92
|
}
|
|
92
93
|
info(`installing dependencies for ${appName}...`);
|
|
93
94
|
await runYarnInstall({ cwd: workspace });
|
|
95
|
+
// build/dev/deploy all locate the consumer via process.cwd() — chdir before calling them.
|
|
96
|
+
info(`pre-building ${appName}`);
|
|
97
|
+
process.chdir(appDir);
|
|
98
|
+
await buildCommand({});
|
|
94
99
|
output(`[z2h-cli] app ready at ${appDir}`, {
|
|
95
100
|
ok: true,
|
|
96
101
|
appDir,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAGD,wBAAsB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA+EtE"}
|
|
@@ -11,6 +11,7 @@ import { readZthAuth } from '../util/auth/auth-store.mjs';
|
|
|
11
11
|
import { mfAppName, cleanAppName } from '../util/app-name.mjs';
|
|
12
12
|
import { buildCommand } from './build.mjs';
|
|
13
13
|
|
|
14
|
+
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
14
15
|
async function deployCommand(opts) {
|
|
15
16
|
if (opts.json) {
|
|
16
17
|
setOutputMode('json');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/commands/dev.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/commands/dev.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAKD,wBAAsB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAyEhE"}
|
|
@@ -9,6 +9,7 @@ import { ensureConsumerPkg } from '../shadow/consumer-pkg.mjs';
|
|
|
9
9
|
import { syncShadow } from '../shadow/sync.mjs';
|
|
10
10
|
|
|
11
11
|
const TRIDENT_READY_PATTERN = /Server started at/i;
|
|
12
|
+
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
12
13
|
async function devCommand(opts) {
|
|
13
14
|
if (opts.json) {
|
|
14
15
|
setOutputMode('json');
|
|
@@ -23,6 +24,8 @@ async function devCommand(opts) {
|
|
|
23
24
|
const server = execa('yarn', ['start'], {
|
|
24
25
|
cwd: ctx.paths.shadowDir,
|
|
25
26
|
stdio: ['inherit', 'pipe', 'inherit'],
|
|
27
|
+
// Trident requires NPM_TOKEN to be set or it refuses to start; 'FAKE_TOKEN' satisfies the check without real credentials.
|
|
28
|
+
env: { ...process.env, NPM_TOKEN: process.env.NPM_TOKEN ?? 'FAKE_TOKEN' },
|
|
26
29
|
});
|
|
27
30
|
const pidFile = path.join(ctx.paths.shadowDir, 'dev.pid');
|
|
28
31
|
if (server.pid) {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -19,7 +19,10 @@ const { version } = createRequire(import.meta.url)('../package.json');
|
|
|
19
19
|
const UPDATE_SCRIPT = path.join(os.homedir(), 'Development', 'bigbrain-z2h', 'z2h', 'setup', 'update.sh');
|
|
20
20
|
function selfUpdate() {
|
|
21
21
|
try {
|
|
22
|
-
execa('bash', [UPDATE_SCRIPT], {
|
|
22
|
+
execa('bash', [UPDATE_SCRIPT], {
|
|
23
|
+
detached: true,
|
|
24
|
+
stdio: 'ignore',
|
|
25
|
+
}).unref();
|
|
23
26
|
}
|
|
24
27
|
catch (err) {
|
|
25
28
|
errorLog(`Z2H auto-update failed to start: ${err.message}`);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
import { pathExists, readJson, writeJson, writeFile } from 'fs-extra';
|
|
2
3
|
import { createRequire } from 'node:module';
|
|
4
|
+
import path from 'node:path';
|
|
3
5
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { pathExists, readJson, writeJson, writeFile } from 'fs-extra';
|
|
5
|
-
import { execa } from 'execa';
|
|
6
6
|
import semver from 'semver';
|
|
7
7
|
import { warn, info, errorLog } from '../util/logger.mjs';
|
|
8
8
|
import { getWorkspaceHome, isZ2hWorkspace } from '../util/workspace.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../src/shadow/scaffold.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../src/shadow/scaffold.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA0G9C;;;GAGG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYvG"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { ensureDir, writeFile, writeJson } from 'fs-extra';
|
|
3
3
|
|
|
4
|
-
const WRAPPER_TEMPLATE = `import
|
|
4
|
+
const WRAPPER_TEMPLATE = `import '@vibe/core/tokens';
|
|
5
|
+
import ConsumerApp from '../../src/index';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
import * as ReactDOM from 'react-dom/client';
|
|
7
8
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
@@ -9,7 +9,7 @@ var hooks = {
|
|
|
9
9
|
hooks: [
|
|
10
10
|
{
|
|
11
11
|
type: "command",
|
|
12
|
-
command: "if [ -f .zth/dev.pid ]; then
|
|
12
|
+
command: "if [ -f .zth/dev.pid ]; then PGID=$(ps -o pgid= -p $(cat .zth/dev.pid) 2>/dev/null | tr -d ' '); [ -n \"$PGID\" ] && kill -- -$PGID 2>/dev/null; rm -f .zth/dev.pid; fi"
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
15
|
}
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,10 @@ const { version } = node_module.createRequire((typeof document === 'undefined' ?
|
|
|
25
25
|
const UPDATE_SCRIPT = path__default.default.join(os__default.default.homedir(), 'Development', 'bigbrain-z2h', 'z2h', 'setup', 'update.sh');
|
|
26
26
|
function selfUpdate() {
|
|
27
27
|
try {
|
|
28
|
-
execa.execa('bash', [UPDATE_SCRIPT], {
|
|
28
|
+
execa.execa('bash', [UPDATE_SCRIPT], {
|
|
29
|
+
detached: true,
|
|
30
|
+
stdio: 'ignore',
|
|
31
|
+
}).unref();
|
|
29
32
|
}
|
|
30
33
|
catch (err) {
|
|
31
34
|
util_logger.errorLog(`Z2H auto-update failed to start: ${err.message}`);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const execa = require('execa');
|
|
4
|
+
const fsExtra = require('fs-extra');
|
|
4
5
|
const node_module = require('node:module');
|
|
6
|
+
const path = require('node:path');
|
|
5
7
|
const node_url = require('node:url');
|
|
6
|
-
const fsExtra = require('fs-extra');
|
|
7
|
-
const execa = require('execa');
|
|
8
8
|
const semver = require('semver');
|
|
9
9
|
const util_logger = require('../util/logger.js');
|
|
10
10
|
const util_workspace = require('../util/workspace.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../src/shadow/scaffold.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../src/shadow/scaffold.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA0G9C;;;GAGG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYvG"}
|
package/dist/shadow/scaffold.js
CHANGED
|
@@ -7,7 +7,8 @@ const _interopDefault = e => e && e.__esModule ? e : { default: e };
|
|
|
7
7
|
|
|
8
8
|
const path__default = /*#__PURE__*/_interopDefault(path);
|
|
9
9
|
|
|
10
|
-
const WRAPPER_TEMPLATE = `import
|
|
10
|
+
const WRAPPER_TEMPLATE = `import '@vibe/core/tokens';
|
|
11
|
+
import ConsumerApp from '../../src/index';
|
|
11
12
|
import React from 'react';
|
|
12
13
|
import * as ReactDOM from 'react-dom/client';
|
|
13
14
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
@@ -11,7 +11,7 @@ var hooks = {
|
|
|
11
11
|
hooks: [
|
|
12
12
|
{
|
|
13
13
|
type: "command",
|
|
14
|
-
command: "if [ -f .zth/dev.pid ]; then
|
|
14
|
+
command: "if [ -f .zth/dev.pid ]; then PGID=$(ps -o pgid= -p $(cat .zth/dev.pid) 2>/dev/null | tr -d ' '); [ -n \"$PGID\" ] && kill -- -$PGID 2>/dev/null; rm -f .zth/dev.pid; fi"
|
|
15
15
|
}
|
|
16
16
|
]
|
|
17
17
|
}
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { mkdtemp, rm, writeJson, readJson, ensureDir, pathExists, writeFile } fr
|
|
|
4
4
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
5
5
|
|
|
6
6
|
import { runYarnInstall } from '../../util/npm/install';
|
|
7
|
+
import { buildCommand } from '../build';
|
|
7
8
|
import { createCommand } from '../create';
|
|
8
9
|
import * as manifest from '../../util/manifest';
|
|
9
10
|
|
|
@@ -14,6 +15,11 @@ vi.mock('../../util/npm/install', () => ({
|
|
|
14
15
|
runYarnInstall: vi.fn().mockResolvedValue(undefined),
|
|
15
16
|
}));
|
|
16
17
|
|
|
18
|
+
// Mock build so tsc/yarn build don't run in tests.
|
|
19
|
+
vi.mock('../build', () => ({
|
|
20
|
+
buildCommand: vi.fn().mockResolvedValue(undefined),
|
|
21
|
+
}));
|
|
22
|
+
|
|
17
23
|
vi.spyOn(manifest, 'readManifest').mockResolvedValue({});
|
|
18
24
|
|
|
19
25
|
async function makeWorkspace(tmp: string): Promise<void> {
|
|
@@ -33,6 +39,7 @@ describe('create', () => {
|
|
|
33
39
|
tmp = await mkdtemp(path.join(os.tmpdir(), 'z2h-c-'));
|
|
34
40
|
process.env.Z2H_WORKSPACE_HOME = tmp;
|
|
35
41
|
vi.mocked(runYarnInstall).mockClear();
|
|
42
|
+
vi.mocked(buildCommand).mockClear();
|
|
36
43
|
});
|
|
37
44
|
|
|
38
45
|
afterEach(async () => {
|
package/src/commands/build.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface BuildOptions {
|
|
|
8
8
|
publicUrl?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
11
12
|
export async function buildCommand(opts: BuildOptions): Promise<void> {
|
|
12
13
|
if (opts.json) {
|
|
13
14
|
setOutputMode('json');
|
package/src/commands/clean.ts
CHANGED
package/src/commands/create.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { readManifest } from '../util/manifest';
|
|
|
8
8
|
import { mfAppName } from '../util/app-name';
|
|
9
9
|
import { APP_NAME_PATTERN } from '../constants';
|
|
10
10
|
import { runYarnInstall } from '../util/npm/install';
|
|
11
|
+
import { buildCommand } from './build';
|
|
11
12
|
|
|
12
13
|
export interface CreateOptions {
|
|
13
14
|
template?: string;
|
|
@@ -118,6 +119,11 @@ export async function createCommand(appName: string, opts: CreateOptions): Promi
|
|
|
118
119
|
info(`installing dependencies for ${appName}...`);
|
|
119
120
|
await runYarnInstall({ cwd: workspace });
|
|
120
121
|
|
|
122
|
+
// build/dev/deploy all locate the consumer via process.cwd() — chdir before calling them.
|
|
123
|
+
info(`pre-building ${appName}`);
|
|
124
|
+
process.chdir(appDir);
|
|
125
|
+
await buildCommand({});
|
|
126
|
+
|
|
121
127
|
output(`[z2h-cli] app ready at ${appDir}`, {
|
|
122
128
|
ok: true,
|
|
123
129
|
appDir,
|
package/src/commands/deploy.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface DeployOptions {
|
|
|
23
23
|
json?: boolean;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
26
27
|
export async function deployCommand(opts: DeployOptions): Promise<void> {
|
|
27
28
|
if (opts.json) {
|
|
28
29
|
setOutputMode('json');
|
package/src/commands/dev.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface DevOptions {
|
|
|
15
15
|
|
|
16
16
|
const TRIDENT_READY_PATTERN = /Server started at/i;
|
|
17
17
|
|
|
18
|
+
// Should be run from the consumer app directory — uses process.cwd() to locate it.
|
|
18
19
|
export async function devCommand(opts: DevOptions): Promise<void> {
|
|
19
20
|
if (opts.json) {
|
|
20
21
|
setOutputMode('json');
|
|
@@ -31,6 +32,8 @@ export async function devCommand(opts: DevOptions): Promise<void> {
|
|
|
31
32
|
const server = execa('yarn', ['start'], {
|
|
32
33
|
cwd: ctx.paths.shadowDir,
|
|
33
34
|
stdio: ['inherit', 'pipe', 'inherit'],
|
|
35
|
+
// Trident requires NPM_TOKEN to be set or it refuses to start; 'FAKE_TOKEN' satisfies the check without real credentials.
|
|
36
|
+
env: { ...process.env, NPM_TOKEN: process.env.NPM_TOKEN ?? 'FAKE_TOKEN' },
|
|
34
37
|
});
|
|
35
38
|
|
|
36
39
|
const pidFile = path.join(ctx.paths.shadowDir, 'dev.pid');
|
package/src/index.ts
CHANGED
|
@@ -21,7 +21,10 @@ const UPDATE_SCRIPT = path.join(os.homedir(), 'Development', 'bigbrain-z2h', 'z2
|
|
|
21
21
|
|
|
22
22
|
function selfUpdate(): void {
|
|
23
23
|
try {
|
|
24
|
-
execa('bash', [UPDATE_SCRIPT], {
|
|
24
|
+
execa('bash', [UPDATE_SCRIPT], {
|
|
25
|
+
detached: true,
|
|
26
|
+
stdio: 'ignore',
|
|
27
|
+
}).unref();
|
|
25
28
|
} catch (err) {
|
|
26
29
|
errorLog(`Z2H auto-update failed to start: ${(err as Error).message}`);
|
|
27
30
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
import { pathExists, readJson, writeFile, writeJson } from 'fs-extra';
|
|
2
3
|
import { createRequire } from 'node:module';
|
|
4
|
+
import path from 'node:path';
|
|
3
5
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { pathExists, readJson, writeJson, writeFile } from 'fs-extra';
|
|
5
|
-
import { execa } from 'execa';
|
|
6
6
|
import semver from 'semver';
|
|
7
|
-
import { info, warn
|
|
7
|
+
import { errorLog, info, warn } from '../util/logger';
|
|
8
8
|
import { getWorkspaceHome, isZ2hWorkspace } from '../util/workspace';
|
|
9
9
|
|
|
10
10
|
const STATE_FILE = '.z2h-migrations-state.json';
|
package/src/shadow/scaffold.ts
CHANGED
|
@@ -2,7 +2,8 @@ import path from 'node:path';
|
|
|
2
2
|
import { ensureDir, writeFile, writeJson } from 'fs-extra';
|
|
3
3
|
import type { ConsumerPaths } from '../types';
|
|
4
4
|
|
|
5
|
-
const WRAPPER_TEMPLATE = `import
|
|
5
|
+
const WRAPPER_TEMPLATE = `import '@vibe/core/tokens';
|
|
6
|
+
import ConsumerApp from '../../src/index';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
import * as ReactDOM from 'react-dom/client';
|
|
8
9
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
@@ -27,7 +27,9 @@ The orchestrator routes to `z2h:feature-development`, which handles the typechec
|
|
|
27
27
|
|
|
28
28
|
## 🌟 Data-Fetching Hierarchy
|
|
29
29
|
|
|
30
|
-
When a request needs data, follow `z2h:coding-standards-mf` §0: write a `runQuery` helper for Snowflake data (TS module using `getBigBrainAPI()` for React apps; vanilla `<script>` using `window.location.origin` for html-embed apps), write a client-side fetch for other browser-accessible sources, or tell the user to reach out at `#ask-zero-to-hero` if the data needs an API key or server-side access. Backend changes to `bigbrain-zth` are not in scope.
|
|
30
|
+
When a request needs data, follow `z2h:coding-standards-mf` §0: write a `runQuery` helper for Snowflake data (TS module using `getBigBrainAPI()` for React apps; vanilla `<script>` using `window.location.origin` for html-embed apps), write a client-side fetch for other browser-accessible sources, or tell the user to reach out at `#ask-zero-to-hero` if the data needs an API key or server-side access. Backend changes to `bigbrain-zth` are not in scope — no modifications, no suggestions, no workarounds.
|
|
31
|
+
|
|
32
|
+
**Query storage:** All SQL query strings go in `src/queries.ts`, not inline in components or hooks. Import from there.
|
|
31
33
|
|
|
32
34
|
---
|
|
33
35
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"hooks": [
|
|
11
11
|
{
|
|
12
12
|
"type": "command",
|
|
13
|
-
"command": "if [ -f .zth/dev.pid ]; then
|
|
13
|
+
"command": "if [ -f .zth/dev.pid ]; then PGID=$(ps -o pgid= -p $(cat .zth/dev.pid) 2>/dev/null | tr -d ' '); [ -n \"$PGID\" ] && kill -- -$PGID 2>/dev/null; rm -f .zth/dev.pid; fi"
|
|
14
14
|
}
|
|
15
15
|
]
|
|
16
16
|
}
|