project-compass 3.3.5 → 3.3.7
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 +1 -1
- package/src/cli.js +21 -12
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -248,24 +248,31 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
248
248
|
});
|
|
249
249
|
}, []);
|
|
250
250
|
|
|
251
|
-
const detailedIndexed = useMemo(() => buildDetailCommands(selectedProject, config).map((command, index) =>
|
|
252
|
-
|
|
253
|
-
shortcut: `${index + 1}
|
|
254
|
-
|
|
251
|
+
const detailedIndexed = useMemo(() => buildDetailCommands(selectedProject, config).map((command, index) => {
|
|
252
|
+
const isOver9 = index >= 9;
|
|
253
|
+
const shortcut = isOver9 ? `S+${String.fromCharCode(65 + index - 9)}` : `${index + 1}`;
|
|
254
|
+
return { ...command, shortcut };
|
|
255
|
+
}), [selectedProject, config]);
|
|
255
256
|
|
|
256
257
|
const detailShortcutMap = useMemo(() => {
|
|
257
258
|
const map = new Map();
|
|
258
|
-
detailedIndexed.forEach((cmd) =>
|
|
259
|
+
detailedIndexed.forEach((cmd) => {
|
|
260
|
+
if (cmd.shortcut.startsWith('S+')) {
|
|
261
|
+
map.set(cmd.shortcut.slice(2).toLowerCase(), cmd);
|
|
262
|
+
} else {
|
|
263
|
+
map.set(cmd.shortcut, cmd);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
259
266
|
return map;
|
|
260
267
|
}, [detailedIndexed]);
|
|
261
268
|
|
|
262
269
|
const killAllTasks = useCallback(() => {
|
|
263
270
|
runningProcessMap.current.forEach((proc) => {
|
|
264
271
|
try {
|
|
265
|
-
if (
|
|
266
|
-
|
|
272
|
+
if (process.platform === 'win32') {
|
|
273
|
+
execa('taskkill', ['/pid', proc.pid, '/f', '/t']);
|
|
267
274
|
} else {
|
|
268
|
-
|
|
275
|
+
process.kill(-proc.pid, 'SIGKILL');
|
|
269
276
|
}
|
|
270
277
|
} catch { /* ignore */ }
|
|
271
278
|
});
|
|
@@ -296,7 +303,7 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
296
303
|
cwd: project.path,
|
|
297
304
|
env: process.env,
|
|
298
305
|
stdin: 'pipe',
|
|
299
|
-
detached:
|
|
306
|
+
detached: process.platform !== 'win32',
|
|
300
307
|
cleanup: true
|
|
301
308
|
});
|
|
302
309
|
runningProcessMap.current.set(taskId, subprocess);
|
|
@@ -325,7 +332,9 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
325
332
|
if (proc) {
|
|
326
333
|
addLogToTask(taskId, kleur.yellow('! Force killing process group...'));
|
|
327
334
|
try {
|
|
328
|
-
if (
|
|
335
|
+
if (process.platform === 'win32') {
|
|
336
|
+
execa('taskkill', ['/pid', proc.pid, '/f', '/t']);
|
|
337
|
+
} else if (proc.pid) {
|
|
329
338
|
process.kill(-proc.pid, 'SIGKILL');
|
|
330
339
|
} else {
|
|
331
340
|
proc.kill('SIGKILL');
|
|
@@ -609,7 +618,7 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
609
618
|
|
|
610
619
|
const helpCards = [
|
|
611
620
|
{label: 'Navigation', color: 'magenta', body: ['↑ / ↓ move focus, Enter: details', 'Shift+↑ / ↓ scroll output', 'Shift+H toggle help cards', 'Shift+D detach from task']},
|
|
612
|
-
{label: 'Commands', color: 'cyan', body: ['B / T / R build/test/run', '1-9
|
|
621
|
+
{label: 'Commands', color: 'cyan', body: ['B / T / R build/test/run', '1-9 / S+A-Z numbered commands', 'Shift+L rerun last command', 'Shift+X clear / Shift+E export']},
|
|
613
622
|
{label: 'Orbit & Studio', color: 'yellow', body: ['Shift+T task manager', 'Shift+A studio / Shift+B art board', 'Shift+S structure / Shift+Q quit']}
|
|
614
623
|
];
|
|
615
624
|
|
|
@@ -696,7 +705,7 @@ async function main() {
|
|
|
696
705
|
console.log('');
|
|
697
706
|
console.log(kleur.bold('Execution shortcuts:'));
|
|
698
707
|
console.log(' B / T / R Quick run: Build / Test / Run');
|
|
699
|
-
console.log(' 1-9
|
|
708
|
+
console.log(' 1-9 / S+A-Z Run numbered commands in detail view');
|
|
700
709
|
console.log(' Shift+L Rerun the last executed command');
|
|
701
710
|
console.log(' Shift+C Add a custom command (in detail view)');
|
|
702
711
|
console.log('');
|