@aspects-ai/workspace-cli 0.1.22 → 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 -58
- 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,48 +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
|
-
const execArgs = [remotionBin, ...args];
|
|
643
|
-
console.error("DEBUG remotionBin:", remotionBin);
|
|
644
|
-
console.error("DEBUG execArgs:", execArgs);
|
|
645
|
-
await execa2("node", execArgs, {
|
|
646
|
-
stdio: "inherit",
|
|
647
|
-
cwd: process.cwd(),
|
|
648
|
-
env: {
|
|
649
|
-
...process.env,
|
|
650
|
-
ANIMATION_SSR_MODE: "true"
|
|
651
|
-
}
|
|
652
|
-
});
|
|
653
|
-
} catch (error) {
|
|
654
|
-
process.exit(error.exitCode || 1);
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
|
-
return command;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
624
|
// src/commands/list.ts
|
|
661
|
-
import { Command as
|
|
625
|
+
import { Command as Command5 } from "commander";
|
|
662
626
|
import chalk5 from "chalk";
|
|
663
627
|
function createListCommand() {
|
|
664
|
-
return new
|
|
628
|
+
return new Command5("list").description("List available libraries").action(async () => {
|
|
665
629
|
try {
|
|
666
630
|
const libraries = await listLibraries();
|
|
667
631
|
logger.log(chalk5.bold("\nAvailable libraries:\n"));
|
|
@@ -682,19 +646,19 @@ function createListCommand() {
|
|
|
682
646
|
|
|
683
647
|
// src/commands/update-template.ts
|
|
684
648
|
import chalk6 from "chalk";
|
|
685
|
-
import { Command as
|
|
686
|
-
import { execa as
|
|
649
|
+
import { Command as Command6 } from "commander";
|
|
650
|
+
import { execa as execa2 } from "execa";
|
|
687
651
|
import fs7 from "fs-extra";
|
|
688
652
|
import os2 from "os";
|
|
689
|
-
import
|
|
653
|
+
import path7 from "path";
|
|
690
654
|
var NOODLE_BASE_REPO = "https://github.com/aspects-ai/noodle-templates";
|
|
691
655
|
var NOODLE_BASE_BRANCH = "main";
|
|
692
656
|
var WORKSPACE_FILE_PATH = "noodle-base/WORKSPACE.md";
|
|
693
657
|
function createUpdateTemplateCommand() {
|
|
694
|
-
return new
|
|
658
|
+
return new Command6("update-template").description("Update WORKSPACE.md file from noodle-base template").action(async () => {
|
|
695
659
|
try {
|
|
696
660
|
const workspaceRoot = await ensureWorkspaceRoot();
|
|
697
|
-
const targetFile =
|
|
661
|
+
const targetFile = path7.join(workspaceRoot, "WORKSPACE.md");
|
|
698
662
|
const token = getToken();
|
|
699
663
|
const targetExists = await fs7.pathExists(targetFile);
|
|
700
664
|
if (targetExists) {
|
|
@@ -721,23 +685,23 @@ function createUpdateTemplateCommand() {
|
|
|
721
685
|
});
|
|
722
686
|
}
|
|
723
687
|
async function fetchFileFromGit(options) {
|
|
724
|
-
const tempDir = await fs7.mkdtemp(
|
|
688
|
+
const tempDir = await fs7.mkdtemp(path7.join(os2.tmpdir(), "workspace-cli-"));
|
|
725
689
|
try {
|
|
726
690
|
const repoUrl = options.repository.replace(
|
|
727
691
|
"https://github.com/",
|
|
728
692
|
`https://${options.token}@github.com/`
|
|
729
693
|
);
|
|
730
|
-
await
|
|
731
|
-
await
|
|
732
|
-
await
|
|
733
|
-
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");
|
|
734
698
|
await fs7.writeFile(sparseFile, `${options.filePath}
|
|
735
699
|
`);
|
|
736
|
-
await
|
|
700
|
+
await execa2("git", ["pull", "origin", options.branch, "--depth=1"], {
|
|
737
701
|
cwd: tempDir,
|
|
738
702
|
stderr: "pipe"
|
|
739
703
|
});
|
|
740
|
-
const sourceFile =
|
|
704
|
+
const sourceFile = path7.join(tempDir, options.filePath);
|
|
741
705
|
if (!await fs7.pathExists(sourceFile)) {
|
|
742
706
|
throw new Error(`File '${options.filePath}' not found in repository`);
|
|
743
707
|
}
|
|
@@ -755,10 +719,10 @@ async function fetchFileFromGit(options) {
|
|
|
755
719
|
}
|
|
756
720
|
|
|
757
721
|
// src/commands/update.ts
|
|
758
|
-
import { Command as
|
|
722
|
+
import { Command as Command7 } from "commander";
|
|
759
723
|
import chalk7 from "chalk";
|
|
760
724
|
function createUpdateCommand() {
|
|
761
|
-
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) => {
|
|
762
726
|
try {
|
|
763
727
|
const workspaceRoot = await ensureWorkspaceRoot();
|
|
764
728
|
await getOrCreateConfig(workspaceRoot);
|
|
@@ -786,7 +750,7 @@ Use 'workspace-cli add ${libraryName}' to install it first.`
|
|
|
786
750
|
}
|
|
787
751
|
|
|
788
752
|
// src/index.ts
|
|
789
|
-
var program = new
|
|
753
|
+
var program = new Command8();
|
|
790
754
|
program.name("workspace-cli").description("Lightweight CLI for installing libraries into workspaces").version(package_default.version);
|
|
791
755
|
program.addCommand(createInitCommand());
|
|
792
756
|
program.addCommand(createListCommand());
|
|
@@ -795,5 +759,4 @@ program.addCommand(createUpdateCommand());
|
|
|
795
759
|
program.addCommand(createCreateCompositionCommand());
|
|
796
760
|
program.addCommand(createUpdateTemplateCommand());
|
|
797
761
|
program.addCommand(createCreateRemotionEntryCommand());
|
|
798
|
-
program.addCommand(createRemotionCommand());
|
|
799
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",
|