@aspects-ai/workspace-cli 0.1.1 → 0.1.2
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/README.md +15 -0
- package/dist/index.js +34 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -83,6 +83,21 @@ The command will:
|
|
|
83
83
|
3. Update `workspace.config.json`
|
|
84
84
|
4. Add dependencies to `package.json`
|
|
85
85
|
|
|
86
|
+
### `update <library>`
|
|
87
|
+
|
|
88
|
+
Update an installed library to the latest version from the repository.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
WORKSPACE_CLI_TOKEN=ghp_xxx workspace-cli update animate-core
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This command will:
|
|
95
|
+
1. Check the currently installed version
|
|
96
|
+
2. Fetch the latest version from the git repository
|
|
97
|
+
3. Overwrite the existing files
|
|
98
|
+
4. Update `workspace.config.json` with the new version and commit hash
|
|
99
|
+
5. Update dependencies in `package.json` if they changed
|
|
100
|
+
|
|
86
101
|
## Usage Examples
|
|
87
102
|
|
|
88
103
|
### Basic Workflow
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command5 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/init.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -397,10 +397,42 @@ function createAddCommand() {
|
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
+
// src/commands/update.ts
|
|
401
|
+
import { Command as Command4 } from "commander";
|
|
402
|
+
import chalk4 from "chalk";
|
|
403
|
+
function createUpdateCommand() {
|
|
404
|
+
return new Command4("update").description("Update an installed library to the latest version").argument("<library>", "Name of the library to update").action(async (libraryName) => {
|
|
405
|
+
try {
|
|
406
|
+
const workspaceRoot = await ensureWorkspaceRoot();
|
|
407
|
+
await getOrCreateConfig(workspaceRoot);
|
|
408
|
+
if (!await isLibraryInstalled(workspaceRoot, libraryName)) {
|
|
409
|
+
throw new Error(
|
|
410
|
+
`Library '${libraryName}' is not installed.
|
|
411
|
+
Use 'workspace-cli add ${libraryName}' to install it first.`
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
const config = await loadWorkspaceConfig(workspaceRoot);
|
|
415
|
+
const currentVersion = config?.libraries[libraryName]?.version || "unknown";
|
|
416
|
+
const currentCommit = config?.libraries[libraryName]?.commit || "unknown";
|
|
417
|
+
logger.info(`Current version: ${currentVersion} (commit: ${currentCommit.substring(0, 7)})`);
|
|
418
|
+
logger.info(`Updating ${libraryName}...`);
|
|
419
|
+
await installLibrary(workspaceRoot, libraryName, { force: true });
|
|
420
|
+
logger.log("\n" + chalk4.bold("Next steps:"));
|
|
421
|
+
logger.log(` ${chalk4.gray("Review changes:")} git diff ./core/${libraryName.replace("animate-", "")}`);
|
|
422
|
+
logger.log(` ${chalk4.gray("Install updated dependencies:")} npm install`);
|
|
423
|
+
logger.log("");
|
|
424
|
+
} catch (error) {
|
|
425
|
+
logger.error(error.message);
|
|
426
|
+
process.exit(1);
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
|
|
400
431
|
// src/index.ts
|
|
401
|
-
var program = new
|
|
432
|
+
var program = new Command5();
|
|
402
433
|
program.name("workspace-cli").description("Lightweight CLI for installing libraries into workspaces").version("0.1.0");
|
|
403
434
|
program.addCommand(createInitCommand());
|
|
404
435
|
program.addCommand(createListCommand());
|
|
405
436
|
program.addCommand(createAddCommand());
|
|
437
|
+
program.addCommand(createUpdateCommand());
|
|
406
438
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aspects-ai/workspace-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Lightweight CLI for installing libraries into workspaces",
|
|
6
6
|
"type": "module",
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=18.0.0"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|