@aspects-ai/workspace-cli 0.1.15 → 0.1.16
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/index.js +55 -29
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command9 } from "commander";
|
|
5
5
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@aspects-ai/workspace-cli",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.16",
|
|
10
10
|
private: false,
|
|
11
11
|
description: "Lightweight CLI for installing libraries into workspaces",
|
|
12
12
|
type: "module",
|
|
@@ -28,6 +28,7 @@ var package_default = {
|
|
|
28
28
|
commander: "^12.0.0",
|
|
29
29
|
execa: "^8.0.0",
|
|
30
30
|
"fs-extra": "^11.2.0",
|
|
31
|
+
remotion: "4.0.356",
|
|
31
32
|
zod: "^3.22.0"
|
|
32
33
|
},
|
|
33
34
|
devDependencies: {
|
|
@@ -442,7 +443,7 @@ async function fetchExampleComposition(toolName, targetPath) {
|
|
|
442
443
|
const library = await getLibrary(toolName);
|
|
443
444
|
const token = getToken();
|
|
444
445
|
logger.info(`Fetching example composition from ${chalk3.cyan(library.repository.url)}`);
|
|
445
|
-
const exampleCompositionDirectory = library.repository.directory.replace("/src", "/starter-
|
|
446
|
+
const exampleCompositionDirectory = library.repository.directory.replace("/src", "/starter-comp-123");
|
|
446
447
|
await fetchDirectory({
|
|
447
448
|
repository: library.repository.url,
|
|
448
449
|
directory: exampleCompositionDirectory,
|
|
@@ -544,7 +545,7 @@ async function createRemotionEntry(compositionsDir, outputPath, animateCorePath)
|
|
|
544
545
|
* It automatically registers all compositions in the ./compositions directory.
|
|
545
546
|
*
|
|
546
547
|
* Usage:
|
|
547
|
-
* ANIMATION_SSR_MODE=true npx remotion render remotion-entry.tsx <composition-id> output.mp4
|
|
548
|
+
* ANIMATION_SSR_MODE=true npx @aspects-ai/workspace-cli remotion render remotion-entry.tsx <composition-id> output.mp4
|
|
548
549
|
*
|
|
549
550
|
* To regenerate this file:
|
|
550
551
|
* npx @aspects-ai/workspace-cli create-remotion-entry
|
|
@@ -574,7 +575,7 @@ registerRoot(Root);
|
|
|
574
575
|
});
|
|
575
576
|
logger.log("");
|
|
576
577
|
logger.log(chalk4.bold("Next steps:"));
|
|
577
|
-
logger.log(` ${chalk4.gray("Render a composition:")} ANIMATION_SSR_MODE=true npx remotion render remotion-entry.tsx <composition-id> output.mp4`);
|
|
578
|
+
logger.log(` ${chalk4.gray("Render a composition:")} ANIMATION_SSR_MODE=true npx @aspects-ai/workspace-cli remotion render remotion-entry.tsx <composition-id> output.mp4`);
|
|
578
579
|
logger.log("");
|
|
579
580
|
}
|
|
580
581
|
function createCreateRemotionEntryCommand() {
|
|
@@ -618,11 +619,35 @@ function createInitCommand() {
|
|
|
618
619
|
});
|
|
619
620
|
}
|
|
620
621
|
|
|
621
|
-
// src/commands/
|
|
622
|
+
// src/commands/remotion.ts
|
|
622
623
|
import { Command as Command5 } from "commander";
|
|
624
|
+
import { execa as execa2 } from "execa";
|
|
625
|
+
import { createRequire } from "module";
|
|
626
|
+
import path7 from "path";
|
|
627
|
+
function createRemotionCommand() {
|
|
628
|
+
const command = new Command5("remotion").description("Run remotion CLI commands using the bundled remotion installation").allowUnknownOption().allowExcessArguments().action(async (_options, cmd) => {
|
|
629
|
+
const args = cmd.args;
|
|
630
|
+
const require2 = createRequire(import.meta.url);
|
|
631
|
+
const remotionCliPath = require2.resolve("remotion/cli");
|
|
632
|
+
const remotionBinDir = path7.dirname(remotionCliPath);
|
|
633
|
+
const remotionBin = path7.join(remotionBinDir, "cli.mjs");
|
|
634
|
+
try {
|
|
635
|
+
await execa2("node", [remotionBin, ...args], {
|
|
636
|
+
stdio: "inherit",
|
|
637
|
+
cwd: process.cwd()
|
|
638
|
+
});
|
|
639
|
+
} catch (error) {
|
|
640
|
+
process.exit(error.exitCode || 1);
|
|
641
|
+
}
|
|
642
|
+
});
|
|
643
|
+
return command;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
// src/commands/list.ts
|
|
647
|
+
import { Command as Command6 } from "commander";
|
|
623
648
|
import chalk5 from "chalk";
|
|
624
649
|
function createListCommand() {
|
|
625
|
-
return new
|
|
650
|
+
return new Command6("list").description("List available libraries").action(async () => {
|
|
626
651
|
try {
|
|
627
652
|
const libraries = await listLibraries();
|
|
628
653
|
logger.log(chalk5.bold("\nAvailable libraries:\n"));
|
|
@@ -642,38 +667,38 @@ function createListCommand() {
|
|
|
642
667
|
}
|
|
643
668
|
|
|
644
669
|
// src/commands/update-template.ts
|
|
645
|
-
import
|
|
646
|
-
import
|
|
670
|
+
import chalk6 from "chalk";
|
|
671
|
+
import { Command as Command7 } from "commander";
|
|
672
|
+
import { execa as execa3 } from "execa";
|
|
647
673
|
import fs7 from "fs-extra";
|
|
648
|
-
import { execa as execa2 } from "execa";
|
|
649
674
|
import os2 from "os";
|
|
650
|
-
import
|
|
675
|
+
import path8 from "path";
|
|
651
676
|
var NOODLE_BASE_REPO = "https://github.com/aspects-ai/noodle-templates";
|
|
652
677
|
var NOODLE_BASE_BRANCH = "main";
|
|
653
|
-
var
|
|
678
|
+
var WORKSPACE_FILE_PATH = "noodle-base/WORKSPACE.md";
|
|
654
679
|
function createUpdateTemplateCommand() {
|
|
655
|
-
return new
|
|
680
|
+
return new Command7("update-template").description("Update WORKSPACE.md file from noodle-base template").action(async () => {
|
|
656
681
|
try {
|
|
657
682
|
const workspaceRoot = await ensureWorkspaceRoot();
|
|
658
|
-
const targetFile =
|
|
683
|
+
const targetFile = path8.join(workspaceRoot, "WORKSPACE.md");
|
|
659
684
|
const token = getToken();
|
|
660
685
|
const targetExists = await fs7.pathExists(targetFile);
|
|
661
686
|
if (targetExists) {
|
|
662
|
-
logger.info("Existing
|
|
687
|
+
logger.info("Existing WORKSPACE.md found, it will be overwritten.");
|
|
663
688
|
}
|
|
664
|
-
logger.info("Fetching
|
|
689
|
+
logger.info("Fetching WORKSPACE.md from noodle-base...");
|
|
665
690
|
const content = await fetchFileFromGit({
|
|
666
691
|
repository: NOODLE_BASE_REPO,
|
|
667
|
-
filePath:
|
|
692
|
+
filePath: WORKSPACE_FILE_PATH,
|
|
668
693
|
branch: NOODLE_BASE_BRANCH,
|
|
669
694
|
token
|
|
670
695
|
});
|
|
671
696
|
await fs7.writeFile(targetFile, content, "utf-8");
|
|
672
697
|
logger.success(
|
|
673
|
-
`Successfully ${targetExists ? "updated" : "copied"}
|
|
698
|
+
`Successfully ${targetExists ? "updated" : "copied"} WORKSPACE.md to workspace`
|
|
674
699
|
);
|
|
675
700
|
logger.log("\n" + chalk6.bold("Next steps:"));
|
|
676
|
-
logger.log(` ${chalk6.gray("Review the file:")} cat
|
|
701
|
+
logger.log(` ${chalk6.gray("Review the file:")} cat WORKSPACE.md`);
|
|
677
702
|
logger.log("");
|
|
678
703
|
} catch (error) {
|
|
679
704
|
logger.error(error.message);
|
|
@@ -682,23 +707,23 @@ function createUpdateTemplateCommand() {
|
|
|
682
707
|
});
|
|
683
708
|
}
|
|
684
709
|
async function fetchFileFromGit(options) {
|
|
685
|
-
const tempDir = await fs7.mkdtemp(
|
|
710
|
+
const tempDir = await fs7.mkdtemp(path8.join(os2.tmpdir(), "workspace-cli-"));
|
|
686
711
|
try {
|
|
687
712
|
const repoUrl = options.repository.replace(
|
|
688
713
|
"https://github.com/",
|
|
689
714
|
`https://${options.token}@github.com/`
|
|
690
715
|
);
|
|
691
|
-
await
|
|
692
|
-
await
|
|
693
|
-
await
|
|
694
|
-
const sparseFile =
|
|
716
|
+
await execa3("git", ["init"], { cwd: tempDir });
|
|
717
|
+
await execa3("git", ["remote", "add", "origin", repoUrl], { cwd: tempDir });
|
|
718
|
+
await execa3("git", ["config", "core.sparseCheckout", "true"], { cwd: tempDir });
|
|
719
|
+
const sparseFile = path8.join(tempDir, ".git", "info", "sparse-checkout");
|
|
695
720
|
await fs7.writeFile(sparseFile, `${options.filePath}
|
|
696
721
|
`);
|
|
697
|
-
await
|
|
722
|
+
await execa3("git", ["pull", "origin", options.branch, "--depth=1"], {
|
|
698
723
|
cwd: tempDir,
|
|
699
724
|
stderr: "pipe"
|
|
700
725
|
});
|
|
701
|
-
const sourceFile =
|
|
726
|
+
const sourceFile = path8.join(tempDir, options.filePath);
|
|
702
727
|
if (!await fs7.pathExists(sourceFile)) {
|
|
703
728
|
throw new Error(`File '${options.filePath}' not found in repository`);
|
|
704
729
|
}
|
|
@@ -716,10 +741,10 @@ async function fetchFileFromGit(options) {
|
|
|
716
741
|
}
|
|
717
742
|
|
|
718
743
|
// src/commands/update.ts
|
|
719
|
-
import { Command as
|
|
744
|
+
import { Command as Command8 } from "commander";
|
|
720
745
|
import chalk7 from "chalk";
|
|
721
746
|
function createUpdateCommand() {
|
|
722
|
-
return new
|
|
747
|
+
return new Command8("update").description("Update an installed library to the latest version").argument("<library>", "Name of the library to update").action(async (libraryName) => {
|
|
723
748
|
try {
|
|
724
749
|
const workspaceRoot = await ensureWorkspaceRoot();
|
|
725
750
|
await getOrCreateConfig(workspaceRoot);
|
|
@@ -747,7 +772,7 @@ Use 'workspace-cli add ${libraryName}' to install it first.`
|
|
|
747
772
|
}
|
|
748
773
|
|
|
749
774
|
// src/index.ts
|
|
750
|
-
var program = new
|
|
775
|
+
var program = new Command9();
|
|
751
776
|
program.name("workspace-cli").description("Lightweight CLI for installing libraries into workspaces").version(package_default.version);
|
|
752
777
|
program.addCommand(createInitCommand());
|
|
753
778
|
program.addCommand(createListCommand());
|
|
@@ -756,4 +781,5 @@ program.addCommand(createUpdateCommand());
|
|
|
756
781
|
program.addCommand(createCreateCompositionCommand());
|
|
757
782
|
program.addCommand(createUpdateTemplateCommand());
|
|
758
783
|
program.addCommand(createCreateRemotionEntryCommand());
|
|
784
|
+
program.addCommand(createRemotionCommand());
|
|
759
785
|
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.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Lightweight CLI for installing libraries into workspaces",
|
|
6
6
|
"type": "module",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"commander": "^12.0.0",
|
|
23
23
|
"execa": "^8.0.0",
|
|
24
24
|
"fs-extra": "^11.2.0",
|
|
25
|
+
"remotion": "4.0.356",
|
|
25
26
|
"zod": "^3.22.0"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|