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