@pixelbyte-software/pixcode 1.47.2 → 1.47.4
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/assets/{index-CR14oRxl.js → index-C7zmMv0b.js} +179 -178
- package/dist/assets/index-ak1p_4ew.js +11 -0
- package/dist/assets/{vendor-codemirror-CzYAOTxS.js → vendor-codemirror-CzSp4P1a.js} +1 -1
- package/dist/assets/{vendor-react-D7WwDXvu.js → vendor-react-DB6V5Fl1.js} +9 -9
- package/dist/index.html +3 -3
- package/dist-server/server/cli.js +62 -22
- package/dist-server/server/cli.js.map +1 -1
- package/dist-server/server/index.js +6 -1
- package/dist-server/server/index.js.map +1 -1
- package/package.json +3 -1
- package/scripts/smoke/code-editor-vscode-engine.mjs +60 -0
- package/scripts/smoke/git-install-update.mjs +37 -2
- package/scripts/update-git-install.mjs +7 -0
- package/server/cli.js +72 -24
- package/server/index.js +6 -1
|
@@ -21,10 +21,28 @@ assert.doesNotMatch(
|
|
|
21
21
|
'Server update command should not use the brittle raw git checkout/pull/install chain.',
|
|
22
22
|
);
|
|
23
23
|
|
|
24
|
+
assert.match(
|
|
25
|
+
serverIndex,
|
|
26
|
+
/updateCommandLabel[\s\S]*Pixcode source update/,
|
|
27
|
+
'Server update stream should describe git installs with product language instead of an internal script command.',
|
|
28
|
+
);
|
|
29
|
+
|
|
24
30
|
assert.match(
|
|
31
|
+
modal,
|
|
32
|
+
/versionUpdate\.pixcodeUpgradeCommand/,
|
|
33
|
+
'Version modal should show the user-facing Pixcode update command.',
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
assert.doesNotMatch(
|
|
25
37
|
modal,
|
|
26
38
|
/node scripts\/update-git-install\.mjs/,
|
|
27
|
-
'Version modal should
|
|
39
|
+
'Version modal should not expose the internal git updater script as manual product guidance.',
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
assert.match(
|
|
43
|
+
fs.readFileSync('server/cli.js', 'utf8'),
|
|
44
|
+
/update-git-install\.mjs[\s\S]*installMode === 'git'[\s\S]*updateGitPackage/,
|
|
45
|
+
'pixcode update should drive the safe git updater for source installs.',
|
|
28
46
|
);
|
|
29
47
|
|
|
30
48
|
assert.match(
|
|
@@ -51,6 +69,12 @@ assert.match(
|
|
|
51
69
|
'Safe updater should reinstall dependencies after updating source files.',
|
|
52
70
|
);
|
|
53
71
|
|
|
72
|
+
assert.match(
|
|
73
|
+
updater,
|
|
74
|
+
/npm[\s\S]*run[\s\S]*build/,
|
|
75
|
+
'Safe updater should rebuild source installs after updating source files.',
|
|
76
|
+
);
|
|
77
|
+
|
|
54
78
|
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'pixcode-git-update-'));
|
|
55
79
|
const origin = path.join(tempRoot, 'origin.git');
|
|
56
80
|
const source = path.join(tempRoot, 'source');
|
|
@@ -81,7 +105,13 @@ function run(command, args, cwd) {
|
|
|
81
105
|
function writePackage(version) {
|
|
82
106
|
fs.writeFileSync(
|
|
83
107
|
path.join(source, 'package.json'),
|
|
84
|
-
JSON.stringify({
|
|
108
|
+
JSON.stringify({
|
|
109
|
+
name: 'pixcode-update-smoke',
|
|
110
|
+
version,
|
|
111
|
+
scripts: {
|
|
112
|
+
build: 'node -e "require(\\"node:fs\\").writeFileSync(\\"built.txt\\", \\"built\\")"',
|
|
113
|
+
},
|
|
114
|
+
}, null, 2),
|
|
85
115
|
);
|
|
86
116
|
fs.writeFileSync(
|
|
87
117
|
path.join(source, 'package-lock.json'),
|
|
@@ -137,5 +167,10 @@ assert.match(
|
|
|
137
167
|
/pixcode-auto-update-/,
|
|
138
168
|
'Safe updater should leave local dirty files recoverable in git stash.',
|
|
139
169
|
);
|
|
170
|
+
assert.equal(
|
|
171
|
+
fs.readFileSync(path.join(install, 'built.txt'), 'utf8'),
|
|
172
|
+
'built',
|
|
173
|
+
'Safe updater should run the repository build after installing dependencies.',
|
|
174
|
+
);
|
|
140
175
|
|
|
141
176
|
console.log('git install update smoke passed');
|
|
@@ -119,6 +119,13 @@ async function main() {
|
|
|
119
119
|
log(`Repository updated to Pixcode ${packageVersion}.`);
|
|
120
120
|
|
|
121
121
|
await run('npm', ['install', '--no-audit', '--no-fund']);
|
|
122
|
+
const updatedPackageJson = JSON.parse(fs.readFileSync(path.join(repoRoot, 'package.json'), 'utf8'));
|
|
123
|
+
if (updatedPackageJson.scripts?.build) {
|
|
124
|
+
log('Building Pixcode source install.');
|
|
125
|
+
await run('npm', ['run', 'build']);
|
|
126
|
+
} else {
|
|
127
|
+
log('No build script found; skipping build.');
|
|
128
|
+
}
|
|
122
129
|
log('Pixcode git install update completed.');
|
|
123
130
|
}
|
|
124
131
|
|
package/server/cli.js
CHANGED
|
@@ -249,10 +249,77 @@ async function checkForUpdates(silent = false) {
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
+
function runInherited(command, args, options = {}) {
|
|
253
|
+
return new Promise((resolve, reject) => {
|
|
254
|
+
const child = spawn(command, args, {
|
|
255
|
+
cwd: options.cwd || APP_ROOT,
|
|
256
|
+
env: options.env || process.env,
|
|
257
|
+
stdio: 'inherit',
|
|
258
|
+
shell: false,
|
|
259
|
+
windowsHide: false,
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
child.on('error', reject);
|
|
263
|
+
child.on('close', (code) => {
|
|
264
|
+
if (code === 0) {
|
|
265
|
+
resolve();
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
reject(new Error(`${command} ${args.join(' ')} exited with code ${code}`));
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
async function maybeRestartDaemonAfterUpdate(options = {}) {
|
|
275
|
+
if (options.restartDaemon) {
|
|
276
|
+
if (!hasInstalledDaemonUnit()) {
|
|
277
|
+
console.log(`${c.warn('[WARN]')} No daemon unit detected; skipping restart.`);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
console.log(`${c.info('[INFO]')} Restarting daemon service...`);
|
|
281
|
+
await handleDaemonCommand(['restart', '--mode=system'], {
|
|
282
|
+
appRoot: APP_ROOT,
|
|
283
|
+
defaultPort: process.env.SERVER_PORT || process.env.PORT || '3001',
|
|
284
|
+
color: c,
|
|
285
|
+
});
|
|
286
|
+
console.log(`${c.ok('[OK]')} Daemon restart completed.`);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (hasInstalledDaemonUnit()) {
|
|
291
|
+
const restartCommand = buildDaemonCliCommand(
|
|
292
|
+
{ subcommand: 'restart', mode: 'system' },
|
|
293
|
+
DAEMON_COMMAND_CONTEXT
|
|
294
|
+
);
|
|
295
|
+
console.log(`${c.tip('[TIP]')} Daemon unit detected. Restart to apply update: ${c.bright(restartCommand)}`);
|
|
296
|
+
console.log(`${c.tip('[TIP]')} Or update + restart in one step: ${c.bright('pixcode update --restart-daemon')}`);
|
|
297
|
+
} else {
|
|
298
|
+
console.log(`${c.tip('[TIP]')} Restart pixcode to use the new version.`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async function updateGitPackage(options = {}) {
|
|
303
|
+
const gitUpdateScript = path.join(APP_ROOT, 'scripts', 'update-git-install.mjs');
|
|
304
|
+
if (!fs.existsSync(gitUpdateScript)) {
|
|
305
|
+
throw new Error(`Git update script was not found: ${gitUpdateScript}`);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
console.log(`${c.info('[INFO]')} Updating Pixcode source checkout...`);
|
|
309
|
+
await runInherited(process.execPath, [gitUpdateScript], { cwd: APP_ROOT });
|
|
310
|
+
console.log(`${c.ok('[OK]')} Source update complete!`);
|
|
311
|
+
await maybeRestartDaemonAfterUpdate(options);
|
|
312
|
+
}
|
|
313
|
+
|
|
252
314
|
// Update the package
|
|
253
315
|
async function updatePackage(options = {}) {
|
|
254
316
|
try {
|
|
255
317
|
const { execSync } = await import('child_process');
|
|
318
|
+
if (installMode === 'git') {
|
|
319
|
+
await updateGitPackage(options);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
|
|
256
323
|
console.log(`${c.info('[INFO]')} Checking for updates...`);
|
|
257
324
|
|
|
258
325
|
const { hasUpdate, latestVersion, currentVersion } = await checkForUpdates(true);
|
|
@@ -265,32 +332,13 @@ async function updatePackage(options = {}) {
|
|
|
265
332
|
console.log(`${c.info('[INFO]')} Updating from ${currentVersion} to ${latestVersion}...`);
|
|
266
333
|
execSync('npm update -g @pixelbyte-software/pixcode', { stdio: 'inherit' });
|
|
267
334
|
console.log(`${c.ok('[OK]')} Update complete!`);
|
|
268
|
-
|
|
269
|
-
if (options.restartDaemon) {
|
|
270
|
-
if (!hasInstalledDaemonUnit()) {
|
|
271
|
-
console.log(`${c.warn('[WARN]')} No daemon unit detected; skipping restart.`);
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
console.log(`${c.info('[INFO]')} Restarting daemon service...`);
|
|
275
|
-
await handleDaemonCommand(['restart', '--mode=system'], {
|
|
276
|
-
appRoot: APP_ROOT,
|
|
277
|
-
defaultPort: process.env.SERVER_PORT || process.env.PORT || '3001',
|
|
278
|
-
color: c,
|
|
279
|
-
});
|
|
280
|
-
console.log(`${c.ok('[OK]')} Daemon restart completed.`);
|
|
281
|
-
} else if (hasInstalledDaemonUnit()) {
|
|
282
|
-
const restartCommand = buildDaemonCliCommand(
|
|
283
|
-
{ subcommand: 'restart', mode: 'system' },
|
|
284
|
-
DAEMON_COMMAND_CONTEXT
|
|
285
|
-
);
|
|
286
|
-
console.log(`${c.tip('[TIP]')} Daemon unit detected. Restart to apply update: ${c.bright(restartCommand)}`);
|
|
287
|
-
console.log(`${c.tip('[TIP]')} Or update + restart in one step: ${c.bright('pixcode update --restart-daemon')}`);
|
|
288
|
-
} else {
|
|
289
|
-
console.log(`${c.tip('[TIP]')} Restart pixcode to use the new version.`);
|
|
290
|
-
}
|
|
335
|
+
await maybeRestartDaemonAfterUpdate(options);
|
|
291
336
|
} catch (e) {
|
|
292
337
|
console.error(`${c.error('[ERROR]')} Update failed: ${e.message}`);
|
|
293
|
-
|
|
338
|
+
const fallbackCommand = installMode === 'git'
|
|
339
|
+
? 'pixcode update --restart-daemon'
|
|
340
|
+
: 'npm update -g @pixelbyte-software/pixcode';
|
|
341
|
+
console.log(`${c.tip('[TIP]')} Try running manually: ${fallbackCommand}`);
|
|
294
342
|
}
|
|
295
343
|
}
|
|
296
344
|
|
package/server/index.js
CHANGED
|
@@ -498,6 +498,11 @@ app.post('/api/system/update', authenticateToken, async (req, res) => {
|
|
|
498
498
|
: installMode === 'git'
|
|
499
499
|
? `${JSON.stringify(process.execPath)} ${JSON.stringify(gitUpdateScript)}`
|
|
500
500
|
: 'npm install -g @pixelbyte-software/pixcode@latest';
|
|
501
|
+
const updateCommandLabel = IS_PLATFORM
|
|
502
|
+
? 'Pixcode platform update'
|
|
503
|
+
: installMode === 'git'
|
|
504
|
+
? 'Pixcode source update'
|
|
505
|
+
: 'pixcode update';
|
|
501
506
|
|
|
502
507
|
const updateCwd = IS_PLATFORM || installMode === 'git'
|
|
503
508
|
? projectRoot
|
|
@@ -770,7 +775,7 @@ app.post('/api/system/update', authenticateToken, async (req, res) => {
|
|
|
770
775
|
}
|
|
771
776
|
}
|
|
772
777
|
|
|
773
|
-
send('log', { stream: 'meta', chunk: `Running: ${
|
|
778
|
+
send('log', { stream: 'meta', chunk: `Running: ${updateCommandLabel}\n` });
|
|
774
779
|
|
|
775
780
|
// Cross-platform shell invocation. `detached: true` + `unref()` below
|
|
776
781
|
// means the install child survives if this server process gets killed
|