@aspects-ai/workspace-cli 0.1.21 → 0.1.23
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 +21 -55
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command8 } 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.22",
|
|
10
10
|
private: false,
|
|
11
11
|
description: "Lightweight CLI for installing libraries into workspaces",
|
|
12
12
|
type: "module",
|
|
13
13
|
bin: {
|
|
14
|
-
"workspace-cli": "./dist/index.js"
|
|
14
|
+
"workspace-cli": "./dist/index.js",
|
|
15
|
+
remotion: "./node_modules/@remotion/cli/remotion-cli.js"
|
|
15
16
|
},
|
|
16
17
|
scripts: {
|
|
17
18
|
build: "tsup src/index.ts --format esm --dts --clean && npm run copy:registry",
|
|
@@ -620,45 +621,11 @@ function createInitCommand() {
|
|
|
620
621
|
});
|
|
621
622
|
}
|
|
622
623
|
|
|
623
|
-
// src/commands/remotion.ts
|
|
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 (...actionArgs) => {
|
|
630
|
-
const cmd = actionArgs[actionArgs.length - 1];
|
|
631
|
-
const args = cmd.parent?.args.slice(1) || process.argv.slice(process.argv.indexOf("remotion") + 1);
|
|
632
|
-
console.error("DEBUG actionArgs length:", actionArgs.length);
|
|
633
|
-
console.error("DEBUG cmd.args:", cmd.args);
|
|
634
|
-
console.error("DEBUG cmd.parent?.args:", cmd.parent?.args);
|
|
635
|
-
console.error("DEBUG process.argv:", process.argv);
|
|
636
|
-
console.error("DEBUG final args:", args);
|
|
637
|
-
const require2 = createRequire(import.meta.url);
|
|
638
|
-
const remotionCliPath = require2.resolve("@remotion/cli/package.json");
|
|
639
|
-
const remotionCliDir = path7.dirname(remotionCliPath);
|
|
640
|
-
const remotionBin = path7.join(remotionCliDir, "remotion-cli.js");
|
|
641
|
-
try {
|
|
642
|
-
await execa2("node", [remotionBin, ...args], {
|
|
643
|
-
stdio: "inherit",
|
|
644
|
-
cwd: process.cwd(),
|
|
645
|
-
env: {
|
|
646
|
-
...process.env,
|
|
647
|
-
ANIMATION_SSR_MODE: "true"
|
|
648
|
-
}
|
|
649
|
-
});
|
|
650
|
-
} catch (error) {
|
|
651
|
-
process.exit(error.exitCode || 1);
|
|
652
|
-
}
|
|
653
|
-
});
|
|
654
|
-
return command;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
624
|
// src/commands/list.ts
|
|
658
|
-
import { Command as
|
|
625
|
+
import { Command as Command5 } from "commander";
|
|
659
626
|
import chalk5 from "chalk";
|
|
660
627
|
function createListCommand() {
|
|
661
|
-
return new
|
|
628
|
+
return new Command5("list").description("List available libraries").action(async () => {
|
|
662
629
|
try {
|
|
663
630
|
const libraries = await listLibraries();
|
|
664
631
|
logger.log(chalk5.bold("\nAvailable libraries:\n"));
|
|
@@ -679,19 +646,19 @@ function createListCommand() {
|
|
|
679
646
|
|
|
680
647
|
// src/commands/update-template.ts
|
|
681
648
|
import chalk6 from "chalk";
|
|
682
|
-
import { Command as
|
|
683
|
-
import { execa as
|
|
649
|
+
import { Command as Command6 } from "commander";
|
|
650
|
+
import { execa as execa2 } from "execa";
|
|
684
651
|
import fs7 from "fs-extra";
|
|
685
652
|
import os2 from "os";
|
|
686
|
-
import
|
|
653
|
+
import path7 from "path";
|
|
687
654
|
var NOODLE_BASE_REPO = "https://github.com/aspects-ai/noodle-templates";
|
|
688
655
|
var NOODLE_BASE_BRANCH = "main";
|
|
689
656
|
var WORKSPACE_FILE_PATH = "noodle-base/WORKSPACE.md";
|
|
690
657
|
function createUpdateTemplateCommand() {
|
|
691
|
-
return new
|
|
658
|
+
return new Command6("update-template").description("Update WORKSPACE.md file from noodle-base template").action(async () => {
|
|
692
659
|
try {
|
|
693
660
|
const workspaceRoot = await ensureWorkspaceRoot();
|
|
694
|
-
const targetFile =
|
|
661
|
+
const targetFile = path7.join(workspaceRoot, "WORKSPACE.md");
|
|
695
662
|
const token = getToken();
|
|
696
663
|
const targetExists = await fs7.pathExists(targetFile);
|
|
697
664
|
if (targetExists) {
|
|
@@ -718,23 +685,23 @@ function createUpdateTemplateCommand() {
|
|
|
718
685
|
});
|
|
719
686
|
}
|
|
720
687
|
async function fetchFileFromGit(options) {
|
|
721
|
-
const tempDir = await fs7.mkdtemp(
|
|
688
|
+
const tempDir = await fs7.mkdtemp(path7.join(os2.tmpdir(), "workspace-cli-"));
|
|
722
689
|
try {
|
|
723
690
|
const repoUrl = options.repository.replace(
|
|
724
691
|
"https://github.com/",
|
|
725
692
|
`https://${options.token}@github.com/`
|
|
726
693
|
);
|
|
727
|
-
await
|
|
728
|
-
await
|
|
729
|
-
await
|
|
730
|
-
const sparseFile =
|
|
694
|
+
await execa2("git", ["init"], { cwd: tempDir });
|
|
695
|
+
await execa2("git", ["remote", "add", "origin", repoUrl], { cwd: tempDir });
|
|
696
|
+
await execa2("git", ["config", "core.sparseCheckout", "true"], { cwd: tempDir });
|
|
697
|
+
const sparseFile = path7.join(tempDir, ".git", "info", "sparse-checkout");
|
|
731
698
|
await fs7.writeFile(sparseFile, `${options.filePath}
|
|
732
699
|
`);
|
|
733
|
-
await
|
|
700
|
+
await execa2("git", ["pull", "origin", options.branch, "--depth=1"], {
|
|
734
701
|
cwd: tempDir,
|
|
735
702
|
stderr: "pipe"
|
|
736
703
|
});
|
|
737
|
-
const sourceFile =
|
|
704
|
+
const sourceFile = path7.join(tempDir, options.filePath);
|
|
738
705
|
if (!await fs7.pathExists(sourceFile)) {
|
|
739
706
|
throw new Error(`File '${options.filePath}' not found in repository`);
|
|
740
707
|
}
|
|
@@ -752,10 +719,10 @@ async function fetchFileFromGit(options) {
|
|
|
752
719
|
}
|
|
753
720
|
|
|
754
721
|
// src/commands/update.ts
|
|
755
|
-
import { Command as
|
|
722
|
+
import { Command as Command7 } from "commander";
|
|
756
723
|
import chalk7 from "chalk";
|
|
757
724
|
function createUpdateCommand() {
|
|
758
|
-
return new
|
|
725
|
+
return new Command7("update").description("Update an installed library to the latest version").argument("<library>", "Name of the library to update").action(async (libraryName) => {
|
|
759
726
|
try {
|
|
760
727
|
const workspaceRoot = await ensureWorkspaceRoot();
|
|
761
728
|
await getOrCreateConfig(workspaceRoot);
|
|
@@ -783,7 +750,7 @@ Use 'workspace-cli add ${libraryName}' to install it first.`
|
|
|
783
750
|
}
|
|
784
751
|
|
|
785
752
|
// src/index.ts
|
|
786
|
-
var program = new
|
|
753
|
+
var program = new Command8();
|
|
787
754
|
program.name("workspace-cli").description("Lightweight CLI for installing libraries into workspaces").version(package_default.version);
|
|
788
755
|
program.addCommand(createInitCommand());
|
|
789
756
|
program.addCommand(createListCommand());
|
|
@@ -792,5 +759,4 @@ program.addCommand(createUpdateCommand());
|
|
|
792
759
|
program.addCommand(createCreateCompositionCommand());
|
|
793
760
|
program.addCommand(createUpdateTemplateCommand());
|
|
794
761
|
program.addCommand(createCreateRemotionEntryCommand());
|
|
795
|
-
program.addCommand(createRemotionCommand());
|
|
796
762
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aspects-ai/workspace-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Lightweight CLI for installing libraries into workspaces",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"workspace-cli": "./dist/index.js"
|
|
8
|
+
"workspace-cli": "./dist/index.js",
|
|
9
|
+
"remotion": "./node_modules/@remotion/cli/remotion-cli.js"
|
|
9
10
|
},
|
|
10
11
|
"scripts": {
|
|
11
12
|
"build": "tsup src/index.ts --format esm --dts --clean && npm run copy:registry",
|