@mondaydotcomorg/z2h-cli 0.6.2 → 0.7.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/esm/index.mjs +18 -1
- package/dist/index.js +22 -0
- package/package.json +1 -1
- package/src/index.ts +19 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
3
5
|
import { Command } from 'commander';
|
|
6
|
+
import { execa } from 'execa';
|
|
4
7
|
import { devCommand } from './commands/dev.mjs';
|
|
5
8
|
import { buildCommand } from './commands/build.mjs';
|
|
6
9
|
import { cleanCommand } from './commands/clean.mjs';
|
|
@@ -9,10 +12,19 @@ import { createWorkspaceCommand } from './commands/create-workspace.mjs';
|
|
|
9
12
|
import { createCommand } from './commands/create.mjs';
|
|
10
13
|
import { generateZ2HTokenCommand } from './commands/generate-z2h-token.mjs';
|
|
11
14
|
import { migrateCommand } from './commands/migrate.mjs';
|
|
12
|
-
import { errorLog, fail } from './util/logger.mjs';
|
|
15
|
+
import { errorLog, fail, getOutputMode } from './util/logger.mjs';
|
|
13
16
|
import { trackDuration } from './util/tracker.mjs';
|
|
14
17
|
|
|
15
18
|
const { version } = createRequire(import.meta.url)('../package.json');
|
|
19
|
+
const UPDATE_SCRIPT = path.join(os.homedir(), 'Development', 'bigbrain-z2h', 'z2h', 'setup', 'update.sh');
|
|
20
|
+
function selfUpdate() {
|
|
21
|
+
try {
|
|
22
|
+
execa('bash', [UPDATE_SCRIPT], { detached: true, stdio: 'ignore' }).unref();
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
errorLog(`Z2H auto-update failed to start: ${err.message}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
16
28
|
function getCwdAppName() {
|
|
17
29
|
try {
|
|
18
30
|
return JSON.parse(readFileSync('package.json', 'utf8')).name;
|
|
@@ -149,6 +161,11 @@ async function main() {
|
|
|
149
161
|
}
|
|
150
162
|
void main()
|
|
151
163
|
.then(() => {
|
|
164
|
+
// After the command succeeds, kick off update in the background.
|
|
165
|
+
// Human mode only — never surprise machine (--json) consumers.
|
|
166
|
+
if (getOutputMode() === 'human') {
|
|
167
|
+
selfUpdate();
|
|
168
|
+
}
|
|
152
169
|
process.exit(0);
|
|
153
170
|
})
|
|
154
171
|
.catch((err) => {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const node_module = require('node:module');
|
|
2
2
|
const fs = require('node:fs');
|
|
3
|
+
const os = require('node:os');
|
|
4
|
+
const path = require('node:path');
|
|
3
5
|
const commander = require('commander');
|
|
6
|
+
const execa = require('execa');
|
|
4
7
|
const commands_dev = require('./commands/dev.js');
|
|
5
8
|
const commands_build = require('./commands/build.js');
|
|
6
9
|
const commands_clean = require('./commands/clean.js');
|
|
@@ -13,7 +16,21 @@ const util_logger = require('./util/logger.js');
|
|
|
13
16
|
const util_tracker = require('./util/tracker.js');
|
|
14
17
|
|
|
15
18
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
19
|
+
const _interopDefault = e => e && e.__esModule ? e : { default: e };
|
|
20
|
+
|
|
21
|
+
const os__default = /*#__PURE__*/_interopDefault(os);
|
|
22
|
+
const path__default = /*#__PURE__*/_interopDefault(path);
|
|
23
|
+
|
|
16
24
|
const { version } = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)))('../package.json');
|
|
25
|
+
const UPDATE_SCRIPT = path__default.default.join(os__default.default.homedir(), 'Development', 'bigbrain-z2h', 'z2h', 'setup', 'update.sh');
|
|
26
|
+
function selfUpdate() {
|
|
27
|
+
try {
|
|
28
|
+
execa.execa('bash', [UPDATE_SCRIPT], { detached: true, stdio: 'ignore' }).unref();
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
util_logger.errorLog(`Z2H auto-update failed to start: ${err.message}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
17
34
|
function getCwdAppName() {
|
|
18
35
|
try {
|
|
19
36
|
return JSON.parse(fs.readFileSync('package.json', 'utf8')).name;
|
|
@@ -150,6 +167,11 @@ async function main() {
|
|
|
150
167
|
}
|
|
151
168
|
void main()
|
|
152
169
|
.then(() => {
|
|
170
|
+
// After the command succeeds, kick off update in the background.
|
|
171
|
+
// Human mode only — never surprise machine (--json) consumers.
|
|
172
|
+
if (util_logger.getOutputMode() === 'human') {
|
|
173
|
+
selfUpdate();
|
|
174
|
+
}
|
|
153
175
|
process.exit(0);
|
|
154
176
|
})
|
|
155
177
|
.catch((err) => {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
3
5
|
import { Command } from 'commander';
|
|
6
|
+
import { execa } from 'execa';
|
|
4
7
|
import { devCommand } from './commands/dev';
|
|
5
8
|
import { buildCommand } from './commands/build';
|
|
6
9
|
import { cleanCommand } from './commands/clean';
|
|
@@ -9,11 +12,21 @@ import { createWorkspaceCommand } from './commands/create-workspace';
|
|
|
9
12
|
import { createCommand } from './commands/create';
|
|
10
13
|
import { generateZ2HTokenCommand } from './commands/generate-z2h-token';
|
|
11
14
|
import { migrateCommand } from './commands/migrate';
|
|
12
|
-
import { errorLog, fail } from './util/logger';
|
|
15
|
+
import { errorLog, fail, getOutputMode } from './util/logger';
|
|
13
16
|
import { trackDuration } from './util/tracker';
|
|
14
17
|
|
|
15
18
|
const { version } = createRequire(import.meta.url)('../package.json') as { version: string };
|
|
16
19
|
|
|
20
|
+
const UPDATE_SCRIPT = path.join(os.homedir(), 'Development', 'bigbrain-z2h', 'z2h', 'setup', 'update.sh');
|
|
21
|
+
|
|
22
|
+
function selfUpdate(): void {
|
|
23
|
+
try {
|
|
24
|
+
execa('bash', [UPDATE_SCRIPT], { detached: true, stdio: 'ignore' }).unref();
|
|
25
|
+
} catch (err) {
|
|
26
|
+
errorLog(`Z2H auto-update failed to start: ${(err as Error).message}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
17
30
|
function getCwdAppName(): string | undefined {
|
|
18
31
|
try {
|
|
19
32
|
return (JSON.parse(readFileSync('package.json', 'utf8')) as { name?: string }).name;
|
|
@@ -156,6 +169,11 @@ async function main(): Promise<void> {
|
|
|
156
169
|
|
|
157
170
|
void main()
|
|
158
171
|
.then(() => {
|
|
172
|
+
// After the command succeeds, kick off update in the background.
|
|
173
|
+
// Human mode only — never surprise machine (--json) consumers.
|
|
174
|
+
if (getOutputMode() === 'human') {
|
|
175
|
+
selfUpdate();
|
|
176
|
+
}
|
|
159
177
|
process.exit(0);
|
|
160
178
|
})
|
|
161
179
|
.catch((err: unknown) => {
|