@aspects-ai/workspace-cli 0.1.14 → 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 +71 -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,
|
|
@@ -520,6 +521,20 @@ async function createRemotionEntry(compositionsDir, outputPath, animateCorePath)
|
|
|
520
521
|
const compositionsObject = imports.map(({ compositionDir, varName, defName }) => {
|
|
521
522
|
return ` '${compositionDir}': { component: ${varName}, compositionDefinition: ${defName} },`;
|
|
522
523
|
}).join("\n");
|
|
524
|
+
const stylesheetLoader = `// Load stylesheet - try compiled.css first, fall back to Tailwind CDN
|
|
525
|
+
(async () => {
|
|
526
|
+
try {
|
|
527
|
+
await import('./styles/compiled.css');
|
|
528
|
+
} catch (error) {
|
|
529
|
+
// If compiled.css doesn't exist, inject Tailwind CDN as fallback
|
|
530
|
+
console.error("Failed to load compiled styles");
|
|
531
|
+
if (typeof document !== 'undefined') {
|
|
532
|
+
const script = document.createElement('script');
|
|
533
|
+
script.src = 'https://cdn.tailwindcss.com';
|
|
534
|
+
document.head.appendChild(script);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
})();`;
|
|
523
538
|
const content = `/**
|
|
524
539
|
* Auto-generated Remotion SSR Entry Point
|
|
525
540
|
*
|
|
@@ -530,12 +545,14 @@ async function createRemotionEntry(compositionsDir, outputPath, animateCorePath)
|
|
|
530
545
|
* It automatically registers all compositions in the ./compositions directory.
|
|
531
546
|
*
|
|
532
547
|
* Usage:
|
|
533
|
-
* 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
|
|
534
549
|
*
|
|
535
550
|
* To regenerate this file:
|
|
536
551
|
* npx @aspects-ai/workspace-cli create-remotion-entry
|
|
537
552
|
*/
|
|
538
553
|
|
|
554
|
+
${stylesheetLoader}
|
|
555
|
+
|
|
539
556
|
import { registerRoot } from 'remotion';
|
|
540
557
|
import { createRemotionRoot } from '${animateCorePath}/remotion';
|
|
541
558
|
|
|
@@ -558,7 +575,7 @@ registerRoot(Root);
|
|
|
558
575
|
});
|
|
559
576
|
logger.log("");
|
|
560
577
|
logger.log(chalk4.bold("Next steps:"));
|
|
561
|
-
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`);
|
|
562
579
|
logger.log("");
|
|
563
580
|
}
|
|
564
581
|
function createCreateRemotionEntryCommand() {
|
|
@@ -602,11 +619,35 @@ function createInitCommand() {
|
|
|
602
619
|
});
|
|
603
620
|
}
|
|
604
621
|
|
|
605
|
-
// src/commands/
|
|
622
|
+
// src/commands/remotion.ts
|
|
606
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";
|
|
607
648
|
import chalk5 from "chalk";
|
|
608
649
|
function createListCommand() {
|
|
609
|
-
return new
|
|
650
|
+
return new Command6("list").description("List available libraries").action(async () => {
|
|
610
651
|
try {
|
|
611
652
|
const libraries = await listLibraries();
|
|
612
653
|
logger.log(chalk5.bold("\nAvailable libraries:\n"));
|
|
@@ -626,38 +667,38 @@ function createListCommand() {
|
|
|
626
667
|
}
|
|
627
668
|
|
|
628
669
|
// src/commands/update-template.ts
|
|
629
|
-
import
|
|
630
|
-
import
|
|
670
|
+
import chalk6 from "chalk";
|
|
671
|
+
import { Command as Command7 } from "commander";
|
|
672
|
+
import { execa as execa3 } from "execa";
|
|
631
673
|
import fs7 from "fs-extra";
|
|
632
|
-
import { execa as execa2 } from "execa";
|
|
633
674
|
import os2 from "os";
|
|
634
|
-
import
|
|
675
|
+
import path8 from "path";
|
|
635
676
|
var NOODLE_BASE_REPO = "https://github.com/aspects-ai/noodle-templates";
|
|
636
677
|
var NOODLE_BASE_BRANCH = "main";
|
|
637
|
-
var
|
|
678
|
+
var WORKSPACE_FILE_PATH = "noodle-base/WORKSPACE.md";
|
|
638
679
|
function createUpdateTemplateCommand() {
|
|
639
|
-
return new
|
|
680
|
+
return new Command7("update-template").description("Update WORKSPACE.md file from noodle-base template").action(async () => {
|
|
640
681
|
try {
|
|
641
682
|
const workspaceRoot = await ensureWorkspaceRoot();
|
|
642
|
-
const targetFile =
|
|
683
|
+
const targetFile = path8.join(workspaceRoot, "WORKSPACE.md");
|
|
643
684
|
const token = getToken();
|
|
644
685
|
const targetExists = await fs7.pathExists(targetFile);
|
|
645
686
|
if (targetExists) {
|
|
646
|
-
logger.info("Existing
|
|
687
|
+
logger.info("Existing WORKSPACE.md found, it will be overwritten.");
|
|
647
688
|
}
|
|
648
|
-
logger.info("Fetching
|
|
689
|
+
logger.info("Fetching WORKSPACE.md from noodle-base...");
|
|
649
690
|
const content = await fetchFileFromGit({
|
|
650
691
|
repository: NOODLE_BASE_REPO,
|
|
651
|
-
filePath:
|
|
692
|
+
filePath: WORKSPACE_FILE_PATH,
|
|
652
693
|
branch: NOODLE_BASE_BRANCH,
|
|
653
694
|
token
|
|
654
695
|
});
|
|
655
696
|
await fs7.writeFile(targetFile, content, "utf-8");
|
|
656
697
|
logger.success(
|
|
657
|
-
`Successfully ${targetExists ? "updated" : "copied"}
|
|
698
|
+
`Successfully ${targetExists ? "updated" : "copied"} WORKSPACE.md to workspace`
|
|
658
699
|
);
|
|
659
700
|
logger.log("\n" + chalk6.bold("Next steps:"));
|
|
660
|
-
logger.log(` ${chalk6.gray("Review the file:")} cat
|
|
701
|
+
logger.log(` ${chalk6.gray("Review the file:")} cat WORKSPACE.md`);
|
|
661
702
|
logger.log("");
|
|
662
703
|
} catch (error) {
|
|
663
704
|
logger.error(error.message);
|
|
@@ -666,23 +707,23 @@ function createUpdateTemplateCommand() {
|
|
|
666
707
|
});
|
|
667
708
|
}
|
|
668
709
|
async function fetchFileFromGit(options) {
|
|
669
|
-
const tempDir = await fs7.mkdtemp(
|
|
710
|
+
const tempDir = await fs7.mkdtemp(path8.join(os2.tmpdir(), "workspace-cli-"));
|
|
670
711
|
try {
|
|
671
712
|
const repoUrl = options.repository.replace(
|
|
672
713
|
"https://github.com/",
|
|
673
714
|
`https://${options.token}@github.com/`
|
|
674
715
|
);
|
|
675
|
-
await
|
|
676
|
-
await
|
|
677
|
-
await
|
|
678
|
-
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");
|
|
679
720
|
await fs7.writeFile(sparseFile, `${options.filePath}
|
|
680
721
|
`);
|
|
681
|
-
await
|
|
722
|
+
await execa3("git", ["pull", "origin", options.branch, "--depth=1"], {
|
|
682
723
|
cwd: tempDir,
|
|
683
724
|
stderr: "pipe"
|
|
684
725
|
});
|
|
685
|
-
const sourceFile =
|
|
726
|
+
const sourceFile = path8.join(tempDir, options.filePath);
|
|
686
727
|
if (!await fs7.pathExists(sourceFile)) {
|
|
687
728
|
throw new Error(`File '${options.filePath}' not found in repository`);
|
|
688
729
|
}
|
|
@@ -700,10 +741,10 @@ async function fetchFileFromGit(options) {
|
|
|
700
741
|
}
|
|
701
742
|
|
|
702
743
|
// src/commands/update.ts
|
|
703
|
-
import { Command as
|
|
744
|
+
import { Command as Command8 } from "commander";
|
|
704
745
|
import chalk7 from "chalk";
|
|
705
746
|
function createUpdateCommand() {
|
|
706
|
-
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) => {
|
|
707
748
|
try {
|
|
708
749
|
const workspaceRoot = await ensureWorkspaceRoot();
|
|
709
750
|
await getOrCreateConfig(workspaceRoot);
|
|
@@ -731,7 +772,7 @@ Use 'workspace-cli add ${libraryName}' to install it first.`
|
|
|
731
772
|
}
|
|
732
773
|
|
|
733
774
|
// src/index.ts
|
|
734
|
-
var program = new
|
|
775
|
+
var program = new Command9();
|
|
735
776
|
program.name("workspace-cli").description("Lightweight CLI for installing libraries into workspaces").version(package_default.version);
|
|
736
777
|
program.addCommand(createInitCommand());
|
|
737
778
|
program.addCommand(createListCommand());
|
|
@@ -740,4 +781,5 @@ program.addCommand(createUpdateCommand());
|
|
|
740
781
|
program.addCommand(createCreateCompositionCommand());
|
|
741
782
|
program.addCommand(createUpdateTemplateCommand());
|
|
742
783
|
program.addCommand(createCreateRemotionEntryCommand());
|
|
784
|
+
program.addCommand(createRemotionCommand());
|
|
743
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": {
|