Skip to content

Commit 8c1b8bd

Browse files
authored
Merge pull request #14 from studiorack/feature/installed-status
Add spinner and one-line console output, supress experimental warnings
2 parents 3b3b28c + fa036f4 commit 8c1b8bd

12 files changed

Lines changed: 273 additions & 58 deletions

File tree

package-lock.json

Lines changed: 219 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiorack/cli",
3-
"version": "2.0.2",
3+
"version": "3.0.0",
44
"description": "Audio project manager tool",
55
"type": "module",
66
"main": "./build/index.js",
@@ -39,13 +39,15 @@
3939
"node": ">=18"
4040
},
4141
"dependencies": {
42-
"@open-audio-stack/core": "^0.1.37",
42+
"@open-audio-stack/core": "^0.1.38",
4343
"cli-table3": "^0.6.5",
44-
"commander": "^12.1.0"
44+
"commander": "^12.1.0",
45+
"ora": "^9.0.0"
4546
},
4647
"devDependencies": {
4748
"@eslint/js": "^9.12.0",
4849
"@types/node": "^22.7.8",
50+
"@types/ora": "^3.1.0",
4951
"@vitest/coverage-v8": "^3.0.7",
5052
"eslint": "^9.12.0",
5153
"execa": "^9.5.2",

src/commands/install.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Command } from 'commander';
2+
import ora from 'ora';
23
import { CliOptions } from '../types/options.js';
3-
import { inputGetParts, ManagerLocal } from '@open-audio-stack/core';
4-
import { formatOutput } from '../utils.js';
4+
import { inputGetParts, ManagerLocal, isTests } from '@open-audio-stack/core';
55

66
export function install(command: Command, manager: ManagerLocal) {
77
command
@@ -12,7 +12,15 @@ export function install(command: Command, manager: ManagerLocal) {
1212
if (options.log) manager.logEnable();
1313
else manager.logDisable();
1414
const [slug, version] = inputGetParts(input);
15-
await manager.install(slug, version);
16-
console.log(formatOutput(manager.getPackage(slug), [version]));
15+
const spinner = ora(`Installing ${slug}${version ? `@${version}` : ''}...`).start();
16+
try {
17+
await manager.install(slug, version);
18+
spinner.succeed(`Installed ${slug}${version ? `@${version}` : ''}`);
19+
if (isTests()) console.log(`Installed ${slug}${version ? `@${version}` : ''}`);
20+
} catch (error) {
21+
spinner.fail(`Failed to install ${slug}${version ? `@${version}` : ''}`);
22+
if (isTests()) console.log(`Failed to install ${slug}${version ? `@${version}` : ''}`);
23+
throw error;
24+
}
1725
});
1826
}

0 commit comments

Comments
 (0)