@doubledigit/cli 0.8.1 → 0.10.0
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/README.md +17 -12
- package/dist/commands/actions.d.ts.map +1 -1
- package/dist/commands/actions.js +10 -7
- package/dist/commands/remotion-hub-add.d.ts.map +1 -1
- package/dist/commands/remotion-hub-add.js +4 -0
- package/dist/commands/remotion-hub-init.d.ts.map +1 -1
- package/dist/commands/remotion-hub-init.js +27 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/actions-client.d.ts.map +1 -1
- package/dist/lib/actions-client.js +4 -1
- package/dist/lib/component-frameworks.d.ts +34 -0
- package/dist/lib/component-frameworks.d.ts.map +1 -0
- package/dist/lib/component-frameworks.js +121 -0
- package/dist/lib/remotion-hub-init.d.ts +28 -5
- package/dist/lib/remotion-hub-init.d.ts.map +1 -1
- package/dist/lib/remotion-hub-init.js +119 -88
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ pnpm dd doctor
|
|
|
21
21
|
pnpm onboard
|
|
22
22
|
pnpm onboard -- --no-run
|
|
23
23
|
pnpm dd actions remotion-hub
|
|
24
|
-
pnpm dd actions remotion-hub init temp-project
|
|
24
|
+
pnpm dd actions remotion-hub init temp-project --framework remotion
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
If installed globally, the binary is available as `dd`:
|
|
@@ -32,7 +32,7 @@ dd doctor
|
|
|
32
32
|
dd onboard
|
|
33
33
|
dd onboard --no-run
|
|
34
34
|
dd actions remotion-hub
|
|
35
|
-
dd actions remotion-hub init temp-project
|
|
35
|
+
dd actions remotion-hub init temp-project --framework remotion
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
## Requirements
|
|
@@ -117,24 +117,28 @@ Use `dd actions` to discover or call enabled micro-app actions through the runni
|
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
119
|
npx @doubledigit/cli@latest actions remotion-hub
|
|
120
|
-
npx @doubledigit/cli@latest actions remotion-hub init temp-project
|
|
121
|
-
npx @doubledigit/cli@latest actions remotion-hub
|
|
122
|
-
npx @doubledigit/cli@latest actions remotion-hub
|
|
120
|
+
npx @doubledigit/cli@latest actions remotion-hub init temp-project --framework remotion --yes
|
|
121
|
+
npx @doubledigit/cli@latest actions remotion-hub init html-project --framework hyperframe --yes
|
|
122
|
+
npx @doubledigit/cli@latest actions remotion-hub list-components --framework remotion --limit 5
|
|
123
|
+
npx @doubledigit/cli@latest actions remotion-hub search-components --framework hyperframe --query "animated chart" --limit 5
|
|
123
124
|
npx @doubledigit/cli@latest actions remotion-hub register-component --json-file component.json
|
|
124
125
|
```
|
|
125
126
|
|
|
126
|
-
|
|
127
|
+
Component Hub currently uses the `remotion-hub` compatibility command. `init` and `add` are handled locally by the CLI because they create or modify files on the caller's machine. Other actions, such as search and registry lookup, call the configured Double Digit app over HTTP.
|
|
127
128
|
|
|
128
|
-
|
|
129
|
+
Pass `--framework remotion|hyperframe` when the target framework is known. Remotion remains the default for compatibility and creates Remotion's Hello World starter so `remotion studio` opens with a visible composition. HyperFrames init requires Node.js 22 or newer and uses `npx hyperframes preview` as its dev command.
|
|
129
130
|
|
|
130
|
-
|
|
131
|
+
Pass `--skip-framework-create` when adding Component Hub files to an existing project. `--skip-remotion-create` and `--hub-only` remain compatibility aliases.
|
|
132
|
+
|
|
133
|
+
After init, the CLI attempts to install framework skills and the Double Digit Component Hub skill from the created project directory. The retry command list depends on the selected framework; examples include:
|
|
131
134
|
|
|
132
135
|
```bash
|
|
133
136
|
npx skills add remotion-dev/skills --all
|
|
134
|
-
npx skills add
|
|
137
|
+
npx skills add heygen-com/hyperframes
|
|
138
|
+
npx skills add crystalphantom/double-digit --skill dd-remotion-hub --agent '*' --yes
|
|
135
139
|
```
|
|
136
140
|
|
|
137
|
-
Pass `--skip-skills` to skip skill installation. If skill installation fails, init still completes the project scaffold and prints exact retry commands. `--non-interactive`
|
|
141
|
+
Pass `--skip-skills` to skip skill installation. If skill installation fails, init still completes the project scaffold and prints exact retry commands. Use `--yes` for agent-run or scripted init flows; `-y` and `--non-interactive` are accepted compatibility aliases and are forwarded to nested framework scaffolds where supported.
|
|
138
142
|
|
|
139
143
|
Register a component with simple JSON:
|
|
140
144
|
|
|
@@ -149,6 +153,7 @@ Minimal `component.json`:
|
|
|
149
153
|
"title": "Animated Chart",
|
|
150
154
|
"slug": "animated-chart",
|
|
151
155
|
"namespace": "doubledigit",
|
|
156
|
+
"framework": "remotion",
|
|
152
157
|
"kind": "component",
|
|
153
158
|
"description": "Animated chart scene.",
|
|
154
159
|
"tags": ["chart", "animation"],
|
|
@@ -157,7 +162,7 @@ Minimal `component.json`:
|
|
|
157
162
|
}
|
|
158
163
|
```
|
|
159
164
|
|
|
160
|
-
When no `--registry`, `--url`, or `--app-url` is passed,
|
|
165
|
+
When no `--registry`, `--url`, or `--app-url` is passed, Component Hub init writes a registry URL from exported `DD_APP_URL`, `APP_URL`, `NEXT_PUBLIC_APP_URL`, or `BETTER_AUTH_URL`; then the release-configured hosted app URL; then `http://localhost:3111` for local development builds.
|
|
161
166
|
|
|
162
167
|
For HTTP-backed actions, the command resolves the app URL from exported `DD_APP_URL`, `APP_URL`, or `BETTER_AUTH_URL`; then local env-file `DD_APP_URL`; then the release-configured hosted app URL. It prints JSON responses to stdout. It also reads `.env`, `.env.local`, `apps/main-app/.env`, and `apps/main-app/.env.local`; exported shell values take precedence.
|
|
163
168
|
|
|
@@ -171,7 +176,7 @@ npx @doubledigit/cli@latest actions remotion-hub
|
|
|
171
176
|
|
|
172
177
|
This hosted default does not require a local checkout or running app.
|
|
173
178
|
|
|
174
|
-
Before relying on the hosted default in automation, run discovery as a preflight. If the hosted action endpoint returns HTTP 500 or is unreachable, use `DD_APP_URL` or `--url` to target a local or self-hosted Double Digit app until the hosted
|
|
179
|
+
Before relying on the hosted default in automation, run discovery as a preflight. If the hosted action endpoint returns HTTP 500 or is unreachable, use `DD_APP_URL` or `--url` to target a local or self-hosted Double Digit app until the hosted Component Hub endpoint is healthy.
|
|
175
180
|
|
|
176
181
|
Local development or self-hosted environments should override the target explicitly:
|
|
177
182
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/commands/actions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/commands/actions.ts"],"names":[],"mappings":"AAqCA,wBAAgB,uBAAuB,WAKtC;AAsED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE;WACf,MAAM;WAAS,MAAM;IAuBxD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,WAGrD;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,WAGpD;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,EAAE,YAI7D;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,YAI5D;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC3D"}
|
package/dist/commands/actions.js
CHANGED
|
@@ -10,6 +10,7 @@ import { runRemotionHubInitCommand } from './remotion-hub-init.js';
|
|
|
10
10
|
const actionValueOptions = new Set([
|
|
11
11
|
'--app-url',
|
|
12
12
|
'--dir',
|
|
13
|
+
'--framework',
|
|
13
14
|
'--id-or-slug',
|
|
14
15
|
'--kind',
|
|
15
16
|
'--limit',
|
|
@@ -44,6 +45,7 @@ Options:
|
|
|
44
45
|
--query <text> Set input.query
|
|
45
46
|
--limit <number> Set input.limit
|
|
46
47
|
--namespace <namespace> Set input namespace/filter
|
|
48
|
+
--framework <framework> Set input framework/filter
|
|
47
49
|
--slug <slug> Set input.slug
|
|
48
50
|
--id-or-slug <value> Set input.idOrSlug
|
|
49
51
|
--kind <kind> Set input kind/filter
|
|
@@ -52,13 +54,14 @@ Options:
|
|
|
52
54
|
|
|
53
55
|
Examples:
|
|
54
56
|
npx @doubledigit/cli@latest actions remotion-hub
|
|
55
|
-
npx @doubledigit/cli@latest actions remotion-hub init my-video --
|
|
56
|
-
npx @doubledigit/cli@latest actions remotion-hub init my-video --
|
|
57
|
-
npx @doubledigit/cli@latest actions remotion-hub
|
|
58
|
-
npx @doubledigit/cli@latest actions remotion-hub
|
|
59
|
-
npx @doubledigit/cli@latest actions remotion-hub
|
|
57
|
+
npx @doubledigit/cli@latest actions remotion-hub init my-video --framework remotion --yes
|
|
58
|
+
npx @doubledigit/cli@latest actions remotion-hub init my-video --framework hyperframe --yes
|
|
59
|
+
npx @doubledigit/cli@latest actions remotion-hub init my-video --framework remotion --skip-skills
|
|
60
|
+
npx @doubledigit/cli@latest actions remotion-hub list-components --framework remotion --limit 5
|
|
61
|
+
npx @doubledigit/cli@latest actions remotion-hub add terminal-scene --framework remotion --dir my-video
|
|
62
|
+
npx @doubledigit/cli@latest actions remotion-hub search-components --framework remotion --query "animated chart" --limit 5
|
|
60
63
|
npx @doubledigit/cli@latest actions remotion-hub register-component --json-file component.json
|
|
61
|
-
npx @doubledigit/cli@latest actions remotion-hub get-registry-payload --json '{"namespace":"doubledigit","slug":"motion-strip"}'
|
|
64
|
+
npx @doubledigit/cli@latest actions remotion-hub get-registry-payload --json '{"namespace":"doubledigit","slug":"motion-strip","framework":"remotion"}'
|
|
62
65
|
`;
|
|
63
66
|
}
|
|
64
67
|
function readActionEnvFiles(paths) {
|
|
@@ -111,7 +114,7 @@ export function getActionPositionals(args) {
|
|
|
111
114
|
}
|
|
112
115
|
continue;
|
|
113
116
|
}
|
|
114
|
-
if (arg === '-h')
|
|
117
|
+
if (arg === '-h' || arg === '-y')
|
|
115
118
|
continue;
|
|
116
119
|
positionals.push({ value: arg, index: i });
|
|
117
120
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remotion-hub-add.d.ts","sourceRoot":"","sources":["../../src/commands/remotion-hub-add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"remotion-hub-add.d.ts","sourceRoot":"","sources":["../../src/commands/remotion-hub-add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AA+E9F,wBAAgB,uBAAuB,WAwBtC;AAkBD,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CA4B9C"}
|
|
@@ -5,6 +5,7 @@ const valueFlags = new Set([
|
|
|
5
5
|
'namespace',
|
|
6
6
|
'registry',
|
|
7
7
|
'url',
|
|
8
|
+
'framework',
|
|
8
9
|
]);
|
|
9
10
|
function parseArgs(args) {
|
|
10
11
|
const positional = [];
|
|
@@ -72,6 +73,7 @@ Options:
|
|
|
72
73
|
--registry <url> Double Digit app URL or /api/remotion-hub/r endpoint
|
|
73
74
|
--url, --app-url <url> Alias for --registry
|
|
74
75
|
--namespace <name> Registry namespace when item is not namespace/slug
|
|
76
|
+
--framework <name> Framework tag (e.g. remotion, hyperframe)
|
|
75
77
|
--force Overwrite existing generated files
|
|
76
78
|
--skip-install Do not install npm dependencies
|
|
77
79
|
--no-install Alias for --skip-install
|
|
@@ -80,6 +82,7 @@ Options:
|
|
|
80
82
|
Examples:
|
|
81
83
|
npx @doubledigit/cli@latest actions remotion-hub add terminal-scene
|
|
82
84
|
npx @doubledigit/cli@latest actions remotion-hub add doubledigit/terminal-scene --dir ./my-video
|
|
85
|
+
npx @doubledigit/cli@latest actions remotion-hub add doubledigit/terminal-scene --framework hyperframe
|
|
83
86
|
npx @doubledigit/cli@latest actions remotion-hub add terminal-scene --registry https://double-digit.example --skip-install
|
|
84
87
|
`;
|
|
85
88
|
}
|
|
@@ -116,6 +119,7 @@ export async function runRemotionHubAddCommand(args) {
|
|
|
116
119
|
force: booleanFlag(parsed.flags, 'force'),
|
|
117
120
|
skipInstall: booleanFlag(parsed.flags, 'skip-install', 'no-install'),
|
|
118
121
|
quiet: json,
|
|
122
|
+
framework: stringFlag(parsed.flags, 'framework'),
|
|
119
123
|
});
|
|
120
124
|
if (json)
|
|
121
125
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remotion-hub-init.d.ts","sourceRoot":"","sources":["../../src/commands/remotion-hub-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"remotion-hub-init.d.ts","sourceRoot":"","sources":["../../src/commands/remotion-hub-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAuFhG,wBAAgB,wBAAwB,WAgCvC;AAkCD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,wBAAwB,GAAG,SAAS,CA8B9F"}
|
|
@@ -2,6 +2,7 @@ import { runRemotionHubInit } from '../lib/remotion-hub-init.js';
|
|
|
2
2
|
const valueFlags = new Set([
|
|
3
3
|
'app-url',
|
|
4
4
|
'dir',
|
|
5
|
+
'framework',
|
|
5
6
|
'namespace',
|
|
6
7
|
'registry',
|
|
7
8
|
'url',
|
|
@@ -17,6 +18,10 @@ function parseArgs(args) {
|
|
|
17
18
|
flags.h = true;
|
|
18
19
|
continue;
|
|
19
20
|
}
|
|
21
|
+
if (arg === '-y') {
|
|
22
|
+
flags.y = true;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
20
25
|
if (!arg.startsWith('--')) {
|
|
21
26
|
positional.push(arg);
|
|
22
27
|
continue;
|
|
@@ -42,8 +47,10 @@ function parseArgs(args) {
|
|
|
42
47
|
|| rawKey === 'hub-only'
|
|
43
48
|
|| rawKey === 'json'
|
|
44
49
|
|| rawKey === 'non-interactive'
|
|
50
|
+
|| rawKey === 'skip-framework-create'
|
|
45
51
|
|| rawKey === 'skip-skills'
|
|
46
|
-
|| rawKey === 'skip-remotion-create'
|
|
52
|
+
|| rawKey === 'skip-remotion-create'
|
|
53
|
+
|| rawKey === 'yes') {
|
|
47
54
|
flags[rawKey] = true;
|
|
48
55
|
continue;
|
|
49
56
|
}
|
|
@@ -64,9 +71,9 @@ function booleanFlag(flags, ...names) {
|
|
|
64
71
|
}
|
|
65
72
|
export function buildRemotionHubInitHelp() {
|
|
66
73
|
return `
|
|
67
|
-
dd actions remotion-hub init - Initialize a local
|
|
74
|
+
dd actions remotion-hub init - Initialize a local Component Hub project
|
|
68
75
|
|
|
69
|
-
Creates a Remotion
|
|
76
|
+
Creates a Remotion starter by default, then adds Component Hub config files.
|
|
70
77
|
|
|
71
78
|
Usage:
|
|
72
79
|
dd actions remotion-hub init [project-dir] [options]
|
|
@@ -76,25 +83,31 @@ Options:
|
|
|
76
83
|
--registry <url> Double Digit app URL or /api/remotion-hub/r endpoint
|
|
77
84
|
--url, --app-url <url> Alias for --registry
|
|
78
85
|
--namespace <name> Registry namespace (default: doubledigit)
|
|
79
|
-
--
|
|
80
|
-
--
|
|
86
|
+
--framework <name> Framework to scaffold (remotion or hyperframe; default: remotion)
|
|
87
|
+
--skip-framework-create Only add Component Hub files; do not run framework scaffold
|
|
88
|
+
--skip-remotion-create Alias for --skip-framework-create
|
|
89
|
+
--hub-only Alias for --skip-framework-create
|
|
81
90
|
--skip-skills Do not install agent skills
|
|
82
|
-
--
|
|
91
|
+
--yes, -y Skip prompts in nested tools and use defaults
|
|
92
|
+
--non-interactive Alias for --yes
|
|
83
93
|
--force Overwrite existing generated files
|
|
84
94
|
--json Print machine-readable JSON
|
|
85
95
|
|
|
86
96
|
Examples:
|
|
87
97
|
npx @doubledigit/cli@latest actions remotion-hub init
|
|
88
98
|
npx @doubledigit/cli@latest actions remotion-hub init my-video
|
|
89
|
-
npx @doubledigit/cli@latest actions remotion-hub init my-video --
|
|
90
|
-
npx @doubledigit/cli@latest actions remotion-hub init my-video --
|
|
99
|
+
npx @doubledigit/cli@latest actions remotion-hub init my-video --framework remotion --yes
|
|
100
|
+
npx @doubledigit/cli@latest actions remotion-hub init my-video --framework hyperframe --yes
|
|
101
|
+
npx @doubledigit/cli@latest actions remotion-hub init my-video --framework remotion --skip-skills
|
|
91
102
|
npx @doubledigit/cli@latest actions remotion-hub init my-video --registry https://double-digit.example
|
|
92
103
|
`;
|
|
93
104
|
}
|
|
94
105
|
function printInit(result) {
|
|
95
|
-
console.log(`Initialized
|
|
96
|
-
|
|
97
|
-
|
|
106
|
+
console.log(`Initialized Component Hub in ${result.projectDir}`);
|
|
107
|
+
console.log(`Framework: ${result.framework}`);
|
|
108
|
+
console.log(`Dev command: ${result.devCommand}`);
|
|
109
|
+
if (!result.create.skipped) {
|
|
110
|
+
console.log(` Framework project: ${result.create.command} ${result.create.args.join(' ')}`);
|
|
98
111
|
}
|
|
99
112
|
for (const file of result.created) {
|
|
100
113
|
console.log(` ${file}`);
|
|
@@ -135,8 +148,11 @@ export function runRemotionHubInitCommand(args) {
|
|
|
135
148
|
registry: stringFlag(parsed.flags, 'registry', 'url', 'app-url'),
|
|
136
149
|
namespace: stringFlag(parsed.flags, 'namespace'),
|
|
137
150
|
force: booleanFlag(parsed.flags, 'force'),
|
|
151
|
+
framework: stringFlag(parsed.flags, 'framework'),
|
|
152
|
+
skipFrameworkCreate: booleanFlag(parsed.flags, 'skip-framework-create', 'skip-remotion-create', 'hub-only'),
|
|
138
153
|
skipRemotionCreate: booleanFlag(parsed.flags, 'skip-remotion-create', 'hub-only'),
|
|
139
154
|
skipSkills: booleanFlag(parsed.flags, 'skip-skills'),
|
|
155
|
+
nonInteractive: booleanFlag(parsed.flags, 'yes', 'y', 'non-interactive'),
|
|
140
156
|
quiet: json,
|
|
141
157
|
});
|
|
142
158
|
if (json)
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* without importing the full extension-management dependency graph first.
|
|
7
7
|
*/
|
|
8
8
|
declare const command: string, args: string[];
|
|
9
|
-
declare const HELP = "\n@doubledigit/cli \u2014 Manage extensions and local setup\n\nCommands:\n doctor Check local prerequisites and project health\n onboard Prepare local development and start the app\n run Start the local app with automatic DB bootstrap\n dev Start DB + app without migrations or seed data\n db <subcommand> Database helpers (status, migrate, create)\n actions <app> [action] Discover and invoke micro-app actions\n create <name> Scaffold a new micro-app from the template\n init <project-name> Scaffold a new Double Digit project\n add|install <source> Install an extension from GitHub or a marketplace\n sync Regenerate micro-apps.ts from dd-apps.config.json\n enable <name> Enable a micro-app (updates config + runs sync)\n disable <name> Disable a micro-app (updates config + runs sync)\n uninstall|remove <name> Completely remove a micro-app\n list List all discovered micro-apps with enabled/disabled status\n info <name> Show detailed info about an installed extension\n outdated Check for outdated marketplace extensions\n reconcile Detect drift between lock file, marketplace, and local files\n marketplace <sub> Manage marketplace registrations (add/list/update/remove)\n browse [marketplace] Browse available extensions in registered marketplaces\n\nOptions:\n --help, -h Show this help message\n\nExamples:\n dd doctor\n dd onboard --yes\n dd onboard # setup + start the dev server\n dd onboard --no-run # setup only\n dd init my-project # scaffold and bootstrap a fresh project\n dd init my-project --run # scaffold + bootstrap + start\n dd init my-project --skip-install --no-git\n dd run\n dd dev\n dd db status\n npx @doubledigit/cli@latest actions remotion-hub init my-video --
|
|
9
|
+
declare const HELP = "\n@doubledigit/cli \u2014 Manage extensions and local setup\n\nCommands:\n doctor Check local prerequisites and project health\n onboard Prepare local development and start the app\n run Start the local app with automatic DB bootstrap\n dev Start DB + app without migrations or seed data\n db <subcommand> Database helpers (status, migrate, create)\n actions <app> [action] Discover and invoke micro-app actions\n create <name> Scaffold a new micro-app from the template\n init <project-name> Scaffold a new Double Digit project\n add|install <source> Install an extension from GitHub or a marketplace\n sync Regenerate micro-apps.ts from dd-apps.config.json\n enable <name> Enable a micro-app (updates config + runs sync)\n disable <name> Disable a micro-app (updates config + runs sync)\n uninstall|remove <name> Completely remove a micro-app\n list List all discovered micro-apps with enabled/disabled status\n info <name> Show detailed info about an installed extension\n outdated Check for outdated marketplace extensions\n reconcile Detect drift between lock file, marketplace, and local files\n marketplace <sub> Manage marketplace registrations (add/list/update/remove)\n browse [marketplace] Browse available extensions in registered marketplaces\n\nOptions:\n --help, -h Show this help message\n\nExamples:\n dd doctor\n dd onboard --yes\n dd onboard # setup + start the dev server\n dd onboard --no-run # setup only\n dd init my-project # scaffold and bootstrap a fresh project\n dd init my-project --run # scaffold + bootstrap + start\n dd init my-project --skip-install --no-git\n dd run\n dd dev\n dd db status\n npx @doubledigit/cli@latest actions remotion-hub init my-video --framework remotion --yes\n npx @doubledigit/cli@latest actions remotion-hub init my-video --framework remotion --skip-skills\n npx @doubledigit/cli@latest actions remotion-hub search-components --framework remotion --query \"animated chart\"\n dd create invoice-tracker\n dd add gh:owner/repo/extensions/micro-apps/habit-tracker\n dd add habit-tracker@community\n dd info habit-tracker\n dd reconcile\n dd marketplace add digitaldouble/dd-marketplace\n dd browse community\n DD_APPS=tasks,agent-v2 dd sync\n";
|
|
10
10
|
declare function requireArg(value: string | undefined, usage: string): string;
|
|
11
11
|
declare function runAddCommand(rawArgs: string[]): Promise<void>;
|
|
12
12
|
declare function main(): Promise<void>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,QAAA,MAAW,OAAO,UAAK,IAAI,UAAgB,CAAC;AAE5C,QAAA,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,QAAA,MAAW,OAAO,UAAK,IAAI,UAAgB,CAAC;AAE5C,QAAA,MAAM,IAAI,y7EAiDT,CAAC;AAEF,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAOpE;AAED,iBAAe,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB7D;AAED,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAsInC"}
|
package/dist/index.js
CHANGED
|
@@ -45,9 +45,9 @@ Examples:
|
|
|
45
45
|
dd run
|
|
46
46
|
dd dev
|
|
47
47
|
dd db status
|
|
48
|
-
npx @doubledigit/cli@latest actions remotion-hub init my-video --
|
|
49
|
-
npx @doubledigit/cli@latest actions remotion-hub init my-video --skip-skills
|
|
50
|
-
npx @doubledigit/cli@latest actions remotion-hub search-components --query "animated chart"
|
|
48
|
+
npx @doubledigit/cli@latest actions remotion-hub init my-video --framework remotion --yes
|
|
49
|
+
npx @doubledigit/cli@latest actions remotion-hub init my-video --framework remotion --skip-skills
|
|
50
|
+
npx @doubledigit/cli@latest actions remotion-hub search-components --framework remotion --query "animated chart"
|
|
51
51
|
dd create invoice-tracker
|
|
52
52
|
dd add gh:owner/repo/extensions/micro-apps/habit-tracker
|
|
53
53
|
dd add habit-tracker@community
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions-client.d.ts","sourceRoot":"","sources":["../../src/lib/actions-client.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,0BAA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AAM,GAAG,SAAS,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,UAAU,EAAE,MAAM,CAAC;CACpB;AAOD,MAAM,WAAW,iCAAiC;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,0BAA0B,CAAC,EACzC,GAAiB,EACjB,YAAY,EACZ,eAAe,GAChB,EAAE,iCAAiC,UAKnC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,GAAiB,EACjB,OAAY,EACZ,UAAU,GACX,EAAE,0BAA0B,UAS5B;AA4ED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,iBAAiB,CA+DlE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,UAS7C;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,WAK3C;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,YAAY,GAAG,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAoBtI;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAiCjF"}
|
|
@@ -68,7 +68,7 @@ function setInputValue(input, key, value) {
|
|
|
68
68
|
input.limit = numeric;
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
if (key === 'namespace' || key === 'kind' || key === 'previewType') {
|
|
71
|
+
if (key === 'namespace' || key === 'kind' || key === 'previewType' || key === 'framework') {
|
|
72
72
|
input[key] = value;
|
|
73
73
|
asFilters(input)[key] = value;
|
|
74
74
|
return;
|
|
@@ -127,6 +127,9 @@ export function parseActionsArgs(args) {
|
|
|
127
127
|
else if (flag === '--namespace') {
|
|
128
128
|
setInputValue(input, 'namespace', readValue());
|
|
129
129
|
}
|
|
130
|
+
else if (flag === '--framework') {
|
|
131
|
+
setInputValue(input, 'framework', readValue());
|
|
132
|
+
}
|
|
130
133
|
else if (flag === '--slug') {
|
|
131
134
|
setInputValue(input, 'slug', readValue());
|
|
132
135
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type ComponentFrameworkId = 'remotion' | 'hyperframe';
|
|
2
|
+
export interface ComponentFrameworkAdapter {
|
|
3
|
+
id: ComponentFrameworkId;
|
|
4
|
+
aliases: string[];
|
|
5
|
+
displayName: string;
|
|
6
|
+
minNodeMajor?: number;
|
|
7
|
+
defaultDevCommand: string;
|
|
8
|
+
defaultFileExtension: string;
|
|
9
|
+
buildCreateCommand: (projectDir: string, options: {
|
|
10
|
+
nonInteractive: boolean;
|
|
11
|
+
}) => {
|
|
12
|
+
command: string;
|
|
13
|
+
args: string[];
|
|
14
|
+
};
|
|
15
|
+
skillsCommands: (options: {
|
|
16
|
+
nonInteractive: boolean;
|
|
17
|
+
}) => Array<{
|
|
18
|
+
command: 'npx';
|
|
19
|
+
args: string[];
|
|
20
|
+
display: string;
|
|
21
|
+
}>;
|
|
22
|
+
buildPostAddSnippet: (input: {
|
|
23
|
+
name: string;
|
|
24
|
+
primaryFile: string;
|
|
25
|
+
source: string;
|
|
26
|
+
projectDir: string;
|
|
27
|
+
config: unknown;
|
|
28
|
+
}) => string;
|
|
29
|
+
}
|
|
30
|
+
export declare const componentFrameworkAdapters: ComponentFrameworkAdapter[];
|
|
31
|
+
export declare function normalizeFrameworkId(value?: string): ComponentFrameworkId;
|
|
32
|
+
export declare function getComponentFrameworkAdapter(value?: string): ComponentFrameworkAdapter;
|
|
33
|
+
export declare function assertFrameworkNodeRequirement(adapter: ComponentFrameworkAdapter, nodeVersion?: string): void;
|
|
34
|
+
//# sourceMappingURL=component-frameworks.d.ts.map
|
|
@@ -0,0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AAyB,EAAE,WAAW,SAAwB,QAKrH"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
function addNonInteractiveAgentFlags(command, nonInteractive) {
|
|
3
|
+
if (!nonInteractive || !command.args.includes('--skill'))
|
|
4
|
+
return command;
|
|
5
|
+
return {
|
|
6
|
+
...command,
|
|
7
|
+
args: [...command.args, '--agent', '*', '--yes'],
|
|
8
|
+
display: `${command.display} --agent '*' --yes`,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function normalizeSlashes(value) {
|
|
12
|
+
return value.split(path.sep).join('/');
|
|
13
|
+
}
|
|
14
|
+
function exportNameFromSource(source, fallback) {
|
|
15
|
+
const match = source.match(/export\s+(?:function|const|class)\s+([A-Z][A-Za-z0-9_]*)/);
|
|
16
|
+
if (match?.[1])
|
|
17
|
+
return match[1];
|
|
18
|
+
return fallback
|
|
19
|
+
.split(/[^a-zA-Z0-9]+/)
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
.map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
|
|
22
|
+
.join('') || 'ComponentHubComponent';
|
|
23
|
+
}
|
|
24
|
+
function importPath(fromFile, toFile) {
|
|
25
|
+
const withoutExtension = toFile.replace(/\.[cm]?[tj]sx?$/, '');
|
|
26
|
+
let relative = normalizeSlashes(path.relative(path.dirname(fromFile), withoutExtension));
|
|
27
|
+
if (!relative.startsWith('.'))
|
|
28
|
+
relative = `./${relative}`;
|
|
29
|
+
return relative;
|
|
30
|
+
}
|
|
31
|
+
function buildRemotionSnippet(input) {
|
|
32
|
+
const config = input.config;
|
|
33
|
+
const root = config.remotion?.root || 'src/Root.tsx';
|
|
34
|
+
const rootFile = path.resolve(input.projectDir, root);
|
|
35
|
+
const exportName = exportNameFromSource(input.source, input.name);
|
|
36
|
+
const importFrom = importPath(rootFile, input.primaryFile);
|
|
37
|
+
return [
|
|
38
|
+
`import { ${exportName} } from '${importFrom}';`,
|
|
39
|
+
'',
|
|
40
|
+
`<Composition id="${input.name}" component={${exportName}} durationInFrames={180} fps={30} width={1920} height={1080} />`,
|
|
41
|
+
].join('\n');
|
|
42
|
+
}
|
|
43
|
+
export const componentFrameworkAdapters = [
|
|
44
|
+
{
|
|
45
|
+
id: 'remotion',
|
|
46
|
+
aliases: ['remotion', 'remotionjs'],
|
|
47
|
+
displayName: 'Remotion',
|
|
48
|
+
defaultDevCommand: 'npx remotion studio',
|
|
49
|
+
defaultFileExtension: 'tsx',
|
|
50
|
+
buildCreateCommand: (projectDir) => ({
|
|
51
|
+
command: 'npx',
|
|
52
|
+
args: ['create-video@latest', '--yes', '--hello-world', projectDir],
|
|
53
|
+
}),
|
|
54
|
+
skillsCommands: ({ nonInteractive }) => [
|
|
55
|
+
{
|
|
56
|
+
command: 'npx',
|
|
57
|
+
args: ['skills', 'add', 'remotion-dev/skills', '--all'],
|
|
58
|
+
display: 'npx skills add remotion-dev/skills --all',
|
|
59
|
+
},
|
|
60
|
+
addNonInteractiveAgentFlags({
|
|
61
|
+
command: 'npx',
|
|
62
|
+
args: ['skills', 'add', 'crystalphantom/double-digit', '--skill', 'dd-remotion-hub'],
|
|
63
|
+
display: 'npx skills add crystalphantom/double-digit --skill dd-remotion-hub',
|
|
64
|
+
}, nonInteractive),
|
|
65
|
+
],
|
|
66
|
+
buildPostAddSnippet: buildRemotionSnippet,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'hyperframe',
|
|
70
|
+
aliases: ['hyperframe', 'hyperframes'],
|
|
71
|
+
displayName: 'HyperFrames',
|
|
72
|
+
minNodeMajor: 22,
|
|
73
|
+
defaultDevCommand: 'npx hyperframes preview',
|
|
74
|
+
defaultFileExtension: 'html',
|
|
75
|
+
buildCreateCommand: (projectDir, { nonInteractive }) => ({
|
|
76
|
+
command: 'npx',
|
|
77
|
+
args: [
|
|
78
|
+
'hyperframes',
|
|
79
|
+
'init',
|
|
80
|
+
projectDir,
|
|
81
|
+
...(nonInteractive ? ['--non-interactive'] : []),
|
|
82
|
+
],
|
|
83
|
+
}),
|
|
84
|
+
skillsCommands: ({ nonInteractive }) => [
|
|
85
|
+
addNonInteractiveAgentFlags({
|
|
86
|
+
command: 'npx',
|
|
87
|
+
args: ['skills', 'add', 'heygen-com/hyperframes'],
|
|
88
|
+
display: 'npx skills add heygen-com/hyperframes',
|
|
89
|
+
}, nonInteractive),
|
|
90
|
+
addNonInteractiveAgentFlags({
|
|
91
|
+
command: 'npx',
|
|
92
|
+
args: ['skills', 'add', 'crystalphantom/double-digit', '--skill', 'dd-remotion-hub'],
|
|
93
|
+
display: 'npx skills add crystalphantom/double-digit --skill dd-remotion-hub',
|
|
94
|
+
}, nonInteractive),
|
|
95
|
+
],
|
|
96
|
+
buildPostAddSnippet: () => '',
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
export function normalizeFrameworkId(value) {
|
|
100
|
+
const normalized = (value || 'remotion').trim().toLowerCase();
|
|
101
|
+
const adapter = componentFrameworkAdapters.find((candidate) => candidate.id === normalized || candidate.aliases.includes(normalized));
|
|
102
|
+
if (!adapter) {
|
|
103
|
+
throw new Error(`Unsupported framework: ${value}. Supported frameworks: remotion, hyperframe`);
|
|
104
|
+
}
|
|
105
|
+
return adapter.id;
|
|
106
|
+
}
|
|
107
|
+
export function getComponentFrameworkAdapter(value) {
|
|
108
|
+
const id = normalizeFrameworkId(value);
|
|
109
|
+
const adapter = componentFrameworkAdapters.find((candidate) => candidate.id === id);
|
|
110
|
+
if (!adapter)
|
|
111
|
+
throw new Error(`Unsupported framework: ${value}`);
|
|
112
|
+
return adapter;
|
|
113
|
+
}
|
|
114
|
+
export function assertFrameworkNodeRequirement(adapter, nodeVersion = process.versions.node) {
|
|
115
|
+
if (!adapter.minNodeMajor)
|
|
116
|
+
return;
|
|
117
|
+
const major = Number(nodeVersion.split('.')[0]);
|
|
118
|
+
if (Number.isFinite(major) && major >= adapter.minNodeMajor)
|
|
119
|
+
return;
|
|
120
|
+
throw new Error(`${adapter.displayName} requires Node.js ${adapter.minNodeMajor}+`);
|
|
121
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
|
-
type
|
|
2
|
+
import { type ComponentFrameworkId } from './component-frameworks.js';
|
|
3
|
+
type ComponentHubSkillsCommand = {
|
|
3
4
|
command: 'npx';
|
|
4
5
|
args: string[];
|
|
5
6
|
display: string;
|
|
6
7
|
};
|
|
7
|
-
type
|
|
8
|
+
type ComponentHubSkillsInstallResult = ComponentHubSkillsCommand & {
|
|
8
9
|
skipped: boolean;
|
|
9
10
|
success: boolean;
|
|
10
11
|
status: number | null;
|
|
@@ -14,6 +15,13 @@ export interface RemotionHubConfig {
|
|
|
14
15
|
$schema: string;
|
|
15
16
|
registry: string;
|
|
16
17
|
namespace: string;
|
|
18
|
+
defaultFramework?: ComponentFrameworkId;
|
|
19
|
+
frameworks?: Partial<Record<ComponentFrameworkId, {
|
|
20
|
+
devCommand: string;
|
|
21
|
+
entrypoint?: string;
|
|
22
|
+
root?: string;
|
|
23
|
+
publicDir: string;
|
|
24
|
+
}>>;
|
|
17
25
|
paths: {
|
|
18
26
|
scenes: string;
|
|
19
27
|
components: string;
|
|
@@ -43,6 +51,7 @@ export interface RemotionHubLock {
|
|
|
43
51
|
files: string[];
|
|
44
52
|
dependencies: string[];
|
|
45
53
|
installedAt: string;
|
|
54
|
+
framework: string;
|
|
46
55
|
}>;
|
|
47
56
|
}
|
|
48
57
|
export interface RunRemotionHubInitOptions {
|
|
@@ -51,9 +60,14 @@ export interface RunRemotionHubInitOptions {
|
|
|
51
60
|
namespace?: string;
|
|
52
61
|
force?: boolean;
|
|
53
62
|
skipRemotionCreate?: boolean;
|
|
63
|
+
skipFrameworkCreate?: boolean;
|
|
54
64
|
skipSkills?: boolean;
|
|
65
|
+
nonInteractive?: boolean;
|
|
66
|
+
yes?: boolean;
|
|
55
67
|
quiet?: boolean;
|
|
56
68
|
spawnImpl?: typeof spawnSync;
|
|
69
|
+
framework?: string;
|
|
70
|
+
nodeVersion?: string;
|
|
57
71
|
}
|
|
58
72
|
export interface RunRemotionHubInitResult {
|
|
59
73
|
projectDir: string;
|
|
@@ -61,6 +75,13 @@ export interface RunRemotionHubInitResult {
|
|
|
61
75
|
lockPath: string;
|
|
62
76
|
created: string[];
|
|
63
77
|
config: RemotionHubConfig;
|
|
78
|
+
framework: ComponentFrameworkId;
|
|
79
|
+
devCommand: string;
|
|
80
|
+
create: {
|
|
81
|
+
skipped: boolean;
|
|
82
|
+
command: string;
|
|
83
|
+
args: string[];
|
|
84
|
+
};
|
|
64
85
|
remotionCreate: {
|
|
65
86
|
skipped: boolean;
|
|
66
87
|
command: string;
|
|
@@ -68,7 +89,7 @@ export interface RunRemotionHubInitResult {
|
|
|
68
89
|
};
|
|
69
90
|
skills: {
|
|
70
91
|
skipped: boolean;
|
|
71
|
-
commands:
|
|
92
|
+
commands: ComponentHubSkillsInstallResult[];
|
|
72
93
|
};
|
|
73
94
|
}
|
|
74
95
|
export interface RunRemotionHubAddOptions {
|
|
@@ -81,6 +102,7 @@ export interface RunRemotionHubAddOptions {
|
|
|
81
102
|
quiet?: boolean;
|
|
82
103
|
fetchImpl?: typeof fetch;
|
|
83
104
|
spawnImpl?: typeof spawnSync;
|
|
105
|
+
framework?: string;
|
|
84
106
|
}
|
|
85
107
|
export interface RunRemotionHubAddResult {
|
|
86
108
|
name: string;
|
|
@@ -92,6 +114,7 @@ export interface RunRemotionHubAddResult {
|
|
|
92
114
|
dependencies: string[];
|
|
93
115
|
installedDependencies: string[];
|
|
94
116
|
snippet: string;
|
|
117
|
+
framework: ComponentFrameworkId;
|
|
95
118
|
}
|
|
96
119
|
export interface ResolveRemotionHubRegistryOptions {
|
|
97
120
|
registry?: string;
|
|
@@ -100,9 +123,9 @@ export interface ResolveRemotionHubRegistryOptions {
|
|
|
100
123
|
localDefaultRegistry?: string;
|
|
101
124
|
}
|
|
102
125
|
export declare function resolveRemotionHubRegistry({ registry, env, generatedDefaultRegistry, localDefaultRegistry, }?: ResolveRemotionHubRegistryOptions): string;
|
|
103
|
-
export declare function buildRemotionSkillsCommands(): {
|
|
104
|
-
args: string[];
|
|
126
|
+
export declare function buildRemotionSkillsCommands(options?: Pick<RunRemotionHubInitOptions, 'nonInteractive' | 'yes'>): {
|
|
105
127
|
command: "npx";
|
|
128
|
+
args: string[];
|
|
106
129
|
display: string;
|
|
107
130
|
}[];
|
|
108
131
|
export declare function runRemotionHubInit(options?: RunRemotionHubInitOptions): RunRemotionHubInitResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remotion-hub-init.d.ts","sourceRoot":"","sources":["../../src/lib/remotion-hub-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"remotion-hub-init.d.ts","sourceRoot":"","sources":["../../src/lib/remotion-hub-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,oBAAoB,CAAC;AAYtE,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AAOnC,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,KAAK,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,+BAA+B,GAAG,yBAAyB,GAAG;IACjE,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,C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,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,oBAAoB,CAAC;CACjC;AAsFD,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,GAAiB,EACjB,wBAA4D,EAC5D,oBAAuC,GACxC,GAAE,iCAAsC,UAQxC;AA2ID,wBAAgB,2BAA2B,CACzC,OAAO,GAAE,IAAI,CAAC,yBAAyB,EAAE,gBAAgB,GAAG,KAAK,CAAM;;;;IAIxE;AAiQD,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B,GAAG,wBAAwB,CA0DpG;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CAmGlC"}
|
|
@@ -3,22 +3,11 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync, } from
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { GENERATED_DEFAULT_ACTIONS_APP_URL } from '../generated/defaults.js';
|
|
5
5
|
import { isLocalAppUrl } from './actions-client.js';
|
|
6
|
+
import { assertFrameworkNodeRequirement, getComponentFrameworkAdapter, normalizeFrameworkId, } from './component-frameworks.js';
|
|
6
7
|
const CONFIG_FILE = 'remotion-hub.json';
|
|
7
8
|
const LOCK_FILE = 'remotion-hub.lock.json';
|
|
8
9
|
const DEFAULT_REGISTRY = 'http://localhost:3111';
|
|
9
10
|
const DEFAULT_NAMESPACE = 'doubledigit';
|
|
10
|
-
const REMOTION_SKILLS_COMMANDS = [
|
|
11
|
-
{
|
|
12
|
-
command: 'npx',
|
|
13
|
-
args: ['skills', 'add', 'remotion-dev/skills', '--all'],
|
|
14
|
-
display: 'npx skills add remotion-dev/skills --all',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
command: 'npx',
|
|
18
|
-
args: ['skills', 'add', 'crystalphantom/double-digit', '--skill', 'dd-remotion-hub'],
|
|
19
|
-
display: 'npx skills add crystalphantom/double-digit --skill dd-remotion-hub',
|
|
20
|
-
},
|
|
21
|
-
];
|
|
22
11
|
function toJson(value) {
|
|
23
12
|
return `${JSON.stringify(value, null, 2)}\n`;
|
|
24
13
|
}
|
|
@@ -107,19 +96,35 @@ export function resolveRemotionHubRegistry({ registry, env = process.env, genera
|
|
|
107
96
|
?? localDefaultRegistry;
|
|
108
97
|
}
|
|
109
98
|
function defaultConfig(projectDir, options) {
|
|
99
|
+
const framework = normalizeFrameworkId(options.framework);
|
|
110
100
|
const language = detectLanguage(projectDir);
|
|
111
101
|
const rootExtension = language === 'typescript' ? 'tsx' : 'jsx';
|
|
112
102
|
const entryExtension = language === 'typescript' ? 'ts' : 'js';
|
|
103
|
+
const remotionAdapter = getComponentFrameworkAdapter('remotion');
|
|
104
|
+
const hyperframeAdapter = getComponentFrameworkAdapter('hyperframe');
|
|
113
105
|
return {
|
|
114
106
|
$schema: 'https://remotion-hub.dev/schema/remotion-hub.json',
|
|
115
107
|
registry: resolveRemotionHubRegistry({ registry: options.registry }),
|
|
116
108
|
namespace: options.namespace?.trim() || DEFAULT_NAMESPACE,
|
|
109
|
+
defaultFramework: framework,
|
|
110
|
+
frameworks: {
|
|
111
|
+
remotion: {
|
|
112
|
+
devCommand: remotionAdapter.defaultDevCommand,
|
|
113
|
+
entrypoint: firstExisting(projectDir, ['src/index.ts', 'src/index.tsx', 'src/index.js', 'src/index.jsx'], `src/index.${entryExtension}`),
|
|
114
|
+
root: firstExisting(projectDir, ['src/Root.tsx', 'src/Root.jsx', 'src/root.tsx', 'src/root.jsx'], `src/Root.${rootExtension}`),
|
|
115
|
+
publicDir: 'public',
|
|
116
|
+
},
|
|
117
|
+
hyperframe: {
|
|
118
|
+
devCommand: hyperframeAdapter.defaultDevCommand,
|
|
119
|
+
publicDir: 'public',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
117
122
|
paths: {
|
|
118
|
-
scenes: 'src/remotion-hub/scenes',
|
|
119
|
-
components: 'src/remotion-hub/components',
|
|
120
|
-
overlays: 'src/remotion-hub/overlays',
|
|
121
|
-
transitions: 'src/remotion-hub/transitions',
|
|
122
|
-
assets: 'public/remotion-hub/assets',
|
|
123
|
+
scenes: 'src/remotion-hub/[framework]/scenes',
|
|
124
|
+
components: 'src/remotion-hub/[framework]/components',
|
|
125
|
+
overlays: 'src/remotion-hub/[framework]/overlays',
|
|
126
|
+
transitions: 'src/remotion-hub/[framework]/transitions',
|
|
127
|
+
assets: 'public/remotion-hub/[framework]/assets',
|
|
123
128
|
registry: `src/remotion-hub/registry.${entryExtension}`,
|
|
124
129
|
},
|
|
125
130
|
remotion: {
|
|
@@ -133,6 +138,18 @@ function defaultConfig(projectDir, options) {
|
|
|
133
138
|
},
|
|
134
139
|
};
|
|
135
140
|
}
|
|
141
|
+
function getFrameworkConfig(config, framework) {
|
|
142
|
+
const adapter = getComponentFrameworkAdapter(framework);
|
|
143
|
+
return {
|
|
144
|
+
devCommand: config.frameworks?.[framework]?.devCommand ?? adapter.defaultDevCommand,
|
|
145
|
+
publicDir: config.frameworks?.[framework]?.publicDir ?? config.remotion?.publicDir ?? 'public',
|
|
146
|
+
entrypoint: config.frameworks?.[framework]?.entrypoint,
|
|
147
|
+
root: config.frameworks?.[framework]?.root,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function getConfigDefaultFramework(config) {
|
|
151
|
+
return normalizeFrameworkId(config.defaultFramework);
|
|
152
|
+
}
|
|
136
153
|
function defaultLock() {
|
|
137
154
|
return {
|
|
138
155
|
version: 1,
|
|
@@ -140,6 +157,11 @@ function defaultLock() {
|
|
|
140
157
|
};
|
|
141
158
|
}
|
|
142
159
|
function ensureDir(projectDir, relativePath, created) {
|
|
160
|
+
if (relativePath.includes('[framework]')) {
|
|
161
|
+
ensureDir(projectDir, relativePath.replace('[framework]', 'remotion'), created);
|
|
162
|
+
ensureDir(projectDir, relativePath.replace('[framework]', 'hyperframe'), created);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
143
165
|
const target = resolveInsideProject(projectDir, relativePath, relativePath);
|
|
144
166
|
if (!existsSync(target)) {
|
|
145
167
|
mkdirSync(target, { recursive: true });
|
|
@@ -155,6 +177,7 @@ function registrySource(config, lock) {
|
|
|
155
177
|
namespace: entry.namespace,
|
|
156
178
|
slug: entry.slug,
|
|
157
179
|
files: entry.files,
|
|
180
|
+
framework: entry.framework ?? 'remotion',
|
|
158
181
|
};
|
|
159
182
|
return acc;
|
|
160
183
|
}, {});
|
|
@@ -180,20 +203,14 @@ function hasPackageJson(projectDir) {
|
|
|
180
203
|
function hasEntries(projectDir) {
|
|
181
204
|
return existsSync(projectDir) && readdirSync(projectDir).length > 0;
|
|
182
205
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
args: ['create-video@latest', '--yes', '--hello-world', projectDir],
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
export function buildRemotionSkillsCommands() {
|
|
190
|
-
return REMOTION_SKILLS_COMMANDS.map((command) => ({
|
|
191
|
-
...command,
|
|
192
|
-
args: [...command.args],
|
|
193
|
-
}));
|
|
206
|
+
export function buildRemotionSkillsCommands(options = {}) {
|
|
207
|
+
const nonInteractive = options.yes === true || options.nonInteractive === true;
|
|
208
|
+
return getComponentFrameworkAdapter('remotion').skillsCommands({ nonInteractive });
|
|
194
209
|
}
|
|
195
|
-
function
|
|
196
|
-
const
|
|
210
|
+
function runFrameworkSkillsInstall(projectDir, options) {
|
|
211
|
+
const adapter = getComponentFrameworkAdapter(options.framework);
|
|
212
|
+
const nonInteractive = options.yes === true || options.nonInteractive === true;
|
|
213
|
+
const commands = adapter.skillsCommands({ nonInteractive });
|
|
197
214
|
if (options.skipSkills) {
|
|
198
215
|
return commands.map((command) => ({
|
|
199
216
|
...command,
|
|
@@ -216,33 +233,39 @@ function runRemotionSkillsInstall(projectDir, options) {
|
|
|
216
233
|
};
|
|
217
234
|
});
|
|
218
235
|
}
|
|
219
|
-
function
|
|
236
|
+
function assertFrameworkCreateSucceeded(result, adapterName, command, args) {
|
|
220
237
|
if (result.error) {
|
|
221
|
-
throw new Error(
|
|
238
|
+
throw new Error(`${adapterName} project creation failed: ${result.error.message}`);
|
|
222
239
|
}
|
|
223
240
|
if (result.status !== 0) {
|
|
224
|
-
throw new Error(
|
|
241
|
+
throw new Error(`${adapterName} project creation failed: ${command} ${args.join(' ')}`);
|
|
225
242
|
}
|
|
226
243
|
}
|
|
227
|
-
function
|
|
228
|
-
|
|
229
|
-
|
|
244
|
+
function shouldSkipFrameworkCreate(options) {
|
|
245
|
+
return options.skipFrameworkCreate === true || options.skipRemotionCreate === true;
|
|
246
|
+
}
|
|
247
|
+
function ensureBaseFrameworkProject(projectDir, options) {
|
|
248
|
+
const adapter = getComponentFrameworkAdapter(options.framework);
|
|
249
|
+
const nonInteractive = options.yes === true || options.nonInteractive === true;
|
|
250
|
+
const frameworkCreate = adapter.buildCreateCommand(projectDir, { nonInteractive });
|
|
251
|
+
if (shouldSkipFrameworkCreate(options) || hasPackageJson(projectDir)) {
|
|
230
252
|
return {
|
|
231
|
-
...
|
|
253
|
+
...frameworkCreate,
|
|
232
254
|
skipped: true,
|
|
233
255
|
};
|
|
234
256
|
}
|
|
257
|
+
assertFrameworkNodeRequirement(adapter, options.nodeVersion);
|
|
235
258
|
if (hasEntries(projectDir)) {
|
|
236
|
-
throw new Error(`Project directory exists but is not a
|
|
237
|
-
+
|
|
259
|
+
throw new Error(`Project directory exists but is not a ${adapter.displayName} project: ${projectDir}. `
|
|
260
|
+
+ `Remove it, choose an empty path, or run ${adapter.displayName} setup manually before Component Hub init.`);
|
|
238
261
|
}
|
|
239
|
-
const result = (options.spawnImpl ?? spawnSync)(
|
|
262
|
+
const result = (options.spawnImpl ?? spawnSync)(frameworkCreate.command, frameworkCreate.args, {
|
|
240
263
|
cwd: process.cwd(),
|
|
241
264
|
stdio: options.quiet ? 'pipe' : 'inherit',
|
|
242
265
|
});
|
|
243
|
-
|
|
266
|
+
assertFrameworkCreateSucceeded(result, adapter.displayName, frameworkCreate.command, frameworkCreate.args);
|
|
244
267
|
return {
|
|
245
|
-
...
|
|
268
|
+
...frameworkCreate,
|
|
246
269
|
skipped: false,
|
|
247
270
|
};
|
|
248
271
|
}
|
|
@@ -272,25 +295,35 @@ function parseItemRef(item, namespace) {
|
|
|
272
295
|
}
|
|
273
296
|
return { namespace: namespace || DEFAULT_NAMESPACE, slug: trimmed };
|
|
274
297
|
}
|
|
275
|
-
function registryPayloadUrl(config, namespace, slug, registryOverride) {
|
|
298
|
+
function registryPayloadUrl(config, namespace, slug, registryOverride, framework) {
|
|
276
299
|
const base = normalizeRegistryBase(registryOverride || config.registry || DEFAULT_REGISTRY);
|
|
277
300
|
const encodedNamespace = encodeURIComponent(namespace);
|
|
278
301
|
const encodedSlug = encodeURIComponent(slug);
|
|
302
|
+
let url = '';
|
|
279
303
|
if (base.endsWith('/api/remotion-hub/r')) {
|
|
280
|
-
|
|
304
|
+
url = `${base}/${encodedNamespace}/${encodedSlug}`;
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
url = `${base}/api/remotion-hub/r/${encodedNamespace}/${encodedSlug}`;
|
|
281
308
|
}
|
|
282
|
-
|
|
309
|
+
if (framework) {
|
|
310
|
+
url += `?framework=${encodeURIComponent(framework)}`;
|
|
311
|
+
}
|
|
312
|
+
return url;
|
|
283
313
|
}
|
|
284
314
|
function asStringArray(value) {
|
|
285
315
|
if (!Array.isArray(value))
|
|
286
316
|
return [];
|
|
287
317
|
return value.filter((item) => typeof item === 'string' && item.trim().length > 0);
|
|
288
318
|
}
|
|
289
|
-
function readRegistryPayload(value) {
|
|
319
|
+
function readRegistryPayload(value, fallbackFramework) {
|
|
290
320
|
const name = typeof value.name === 'string' && value.name.trim() ? value.name.trim() : '';
|
|
291
321
|
const type = typeof value.type === 'string' && value.type.trim() ? value.type.trim() : 'registry:component';
|
|
292
322
|
const version = typeof value.version === 'string' && value.version.trim() ? value.version.trim() : null;
|
|
293
323
|
const files = Array.isArray(value.files) ? value.files : [];
|
|
324
|
+
const framework = typeof value.framework === 'string' && value.framework.trim()
|
|
325
|
+
? normalizeFrameworkId(value.framework)
|
|
326
|
+
: fallbackFramework;
|
|
294
327
|
if (!name)
|
|
295
328
|
throw new Error('Registry payload is missing name');
|
|
296
329
|
if (files.length === 0)
|
|
@@ -301,9 +334,10 @@ function readRegistryPayload(value) {
|
|
|
301
334
|
version,
|
|
302
335
|
files,
|
|
303
336
|
dependencies: asStringArray(value.dependencies),
|
|
337
|
+
framework,
|
|
304
338
|
};
|
|
305
339
|
}
|
|
306
|
-
async function fetchRegistryPayload(url, fetchImpl) {
|
|
340
|
+
async function fetchRegistryPayload(url, fetchImpl, fallbackFramework) {
|
|
307
341
|
const response = await fetchImpl(url);
|
|
308
342
|
const text = await response.text();
|
|
309
343
|
const parsed = text ? JSON.parse(text) : {};
|
|
@@ -313,14 +347,19 @@ async function fetchRegistryPayload(url, fetchImpl) {
|
|
|
313
347
|
: `Request failed with HTTP ${response.status}`;
|
|
314
348
|
throw new Error(error);
|
|
315
349
|
}
|
|
316
|
-
return readRegistryPayload(parsed);
|
|
350
|
+
return readRegistryPayload(parsed, fallbackFramework);
|
|
317
351
|
}
|
|
318
|
-
function targetForRegistryFile(config, file) {
|
|
352
|
+
function targetForRegistryFile(config, file, framework) {
|
|
319
353
|
const explicitTarget = typeof file.target === 'string' ? file.target.trim() : '';
|
|
320
354
|
if (explicitTarget)
|
|
321
|
-
return explicitTarget;
|
|
355
|
+
return explicitTarget.replace(/\[framework\]/g, framework);
|
|
322
356
|
const sourcePath = ensureRelativePath(typeof file.path === 'string' ? file.path : '', 'file.path');
|
|
323
357
|
const mappings = [
|
|
358
|
+
[`components/${framework}/`, config.paths.components],
|
|
359
|
+
[`scenes/${framework}/`, config.paths.scenes],
|
|
360
|
+
[`overlays/${framework}/`, config.paths.overlays],
|
|
361
|
+
[`transitions/${framework}/`, config.paths.transitions],
|
|
362
|
+
[`assets/${framework}/`, config.paths.assets],
|
|
324
363
|
['components/', config.paths.components],
|
|
325
364
|
['scenes/', config.paths.scenes],
|
|
326
365
|
['overlays/', config.paths.overlays],
|
|
@@ -329,10 +368,11 @@ function targetForRegistryFile(config, file) {
|
|
|
329
368
|
];
|
|
330
369
|
for (const [prefix, targetRoot] of mappings) {
|
|
331
370
|
if (sourcePath.startsWith(prefix)) {
|
|
332
|
-
|
|
371
|
+
const rootPath = targetRoot.replace(/\[framework\]/g, framework);
|
|
372
|
+
return path.posix.join(rootPath.replace(/\/+$/, ''), sourcePath.slice(prefix.length));
|
|
333
373
|
}
|
|
334
374
|
}
|
|
335
|
-
return path.posix.join('src/remotion-hub', sourcePath);
|
|
375
|
+
return path.posix.join('src/remotion-hub', sourcePath).replace(/\[framework\]/g, framework);
|
|
336
376
|
}
|
|
337
377
|
function packageJsonDependencies(projectDir) {
|
|
338
378
|
const packageJsonPath = path.join(projectDir, 'package.json');
|
|
@@ -372,45 +412,21 @@ function installDependencies(projectDir, packageManager, dependencies, spawnImpl
|
|
|
372
412
|
}
|
|
373
413
|
return missing;
|
|
374
414
|
}
|
|
375
|
-
function exportNameFromSource(source, fallback) {
|
|
376
|
-
const match = source.match(/export\s+(?:function|const|class)\s+([A-Z][A-Za-z0-9_]*)/);
|
|
377
|
-
if (match?.[1])
|
|
378
|
-
return match[1];
|
|
379
|
-
return fallback
|
|
380
|
-
.split(/[^a-zA-Z0-9]+/)
|
|
381
|
-
.filter(Boolean)
|
|
382
|
-
.map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
|
|
383
|
-
.join('') || 'RemotionHubComponent';
|
|
384
|
-
}
|
|
385
|
-
function importPath(fromFile, toFile) {
|
|
386
|
-
const withoutExtension = toFile.replace(/\.[cm]?[tj]sx?$/, '');
|
|
387
|
-
let relative = normalizeSlashes(path.relative(path.dirname(fromFile), withoutExtension));
|
|
388
|
-
if (!relative.startsWith('.'))
|
|
389
|
-
relative = `./${relative}`;
|
|
390
|
-
return relative;
|
|
391
|
-
}
|
|
392
|
-
function buildSnippet(config, projectDir, name, primaryFile, source) {
|
|
393
|
-
const rootFile = resolveInsideProject(projectDir, config.remotion.root, 'remotion.root');
|
|
394
|
-
const exportName = exportNameFromSource(source, name);
|
|
395
|
-
const importFrom = importPath(rootFile, primaryFile);
|
|
396
|
-
return [
|
|
397
|
-
`import { ${exportName} } from '${importFrom}';`,
|
|
398
|
-
'',
|
|
399
|
-
`<Composition id="${name}" component={${exportName}} durationInFrames={180} fps={30} width={1920} height={1080} />`,
|
|
400
|
-
].join('\n');
|
|
401
|
-
}
|
|
402
415
|
export function runRemotionHubInit(options = {}) {
|
|
416
|
+
const framework = normalizeFrameworkId(options.framework);
|
|
417
|
+
const adapter = getComponentFrameworkAdapter(framework);
|
|
418
|
+
const normalizedOptions = { ...options, framework };
|
|
403
419
|
const projectDir = resolveProjectDir(options.projectDir);
|
|
404
420
|
const configPath = path.join(projectDir, CONFIG_FILE);
|
|
405
421
|
const lockPath = path.join(projectDir, LOCK_FILE);
|
|
406
422
|
const created = [];
|
|
407
|
-
const
|
|
423
|
+
const create = ensureBaseFrameworkProject(projectDir, normalizedOptions);
|
|
408
424
|
mkdirSync(projectDir, { recursive: true });
|
|
409
425
|
const configExists = existsSync(configPath);
|
|
410
426
|
const lockExists = existsSync(lockPath);
|
|
411
427
|
const config = configExists && !options.force
|
|
412
428
|
? loadConfig(projectDir)
|
|
413
|
-
: defaultConfig(projectDir,
|
|
429
|
+
: defaultConfig(projectDir, normalizedOptions);
|
|
414
430
|
if (!configExists || options.force) {
|
|
415
431
|
writeJsonFile(configPath, config);
|
|
416
432
|
created.push(CONFIG_FILE);
|
|
@@ -431,14 +447,17 @@ export function runRemotionHubInit(options = {}) {
|
|
|
431
447
|
const lock = readJsonFile(lockPath, defaultLock());
|
|
432
448
|
writeRegistryFile(projectDir, config, lock);
|
|
433
449
|
created.push(config.paths.registry);
|
|
434
|
-
const skills =
|
|
450
|
+
const skills = runFrameworkSkillsInstall(projectDir, normalizedOptions);
|
|
435
451
|
return {
|
|
436
452
|
projectDir,
|
|
437
453
|
configPath,
|
|
438
454
|
lockPath,
|
|
439
455
|
created,
|
|
440
456
|
config,
|
|
441
|
-
|
|
457
|
+
framework,
|
|
458
|
+
devCommand: getFrameworkConfig(config, framework).devCommand ?? adapter.defaultDevCommand,
|
|
459
|
+
create,
|
|
460
|
+
remotionCreate: create,
|
|
442
461
|
skills: {
|
|
443
462
|
skipped: options.skipSkills === true,
|
|
444
463
|
commands: skills,
|
|
@@ -448,9 +467,12 @@ export function runRemotionHubInit(options = {}) {
|
|
|
448
467
|
export async function runRemotionHubAdd(options) {
|
|
449
468
|
const projectDir = resolveProjectDir(options.projectDir);
|
|
450
469
|
const config = loadConfig(projectDir);
|
|
470
|
+
const framework = normalizeFrameworkId(options.framework ?? getConfigDefaultFramework(config));
|
|
451
471
|
const itemRef = parseItemRef(options.item, options.namespace || config.namespace);
|
|
452
|
-
const resolved = registryPayloadUrl(config, itemRef.namespace, itemRef.slug, options.registry);
|
|
453
|
-
const payload = await fetchRegistryPayload(resolved, options.fetchImpl ?? fetch);
|
|
472
|
+
const resolved = registryPayloadUrl(config, itemRef.namespace, itemRef.slug, options.registry, framework);
|
|
473
|
+
const payload = await fetchRegistryPayload(resolved, options.fetchImpl ?? fetch, framework);
|
|
474
|
+
const payloadFramework = normalizeFrameworkId(payload.framework || framework);
|
|
475
|
+
const payloadAdapter = getComponentFrameworkAdapter(payloadFramework);
|
|
454
476
|
const lockPath = path.join(projectDir, LOCK_FILE);
|
|
455
477
|
const lock = readJsonFile(lockPath, defaultLock());
|
|
456
478
|
const written = [];
|
|
@@ -462,7 +484,7 @@ export async function runRemotionHubAdd(options) {
|
|
|
462
484
|
const content = typeof file.content === 'string' ? file.content : '';
|
|
463
485
|
if (!content)
|
|
464
486
|
throw new Error(`Registry file for ${payload.name} is missing content`);
|
|
465
|
-
const relativeTarget = targetForRegistryFile(config, file);
|
|
487
|
+
const relativeTarget = targetForRegistryFile(config, file, payloadFramework);
|
|
466
488
|
const destination = resolveInsideProject(projectDir, relativeTarget, 'file.target');
|
|
467
489
|
const relativePath = normalizeSlashes(path.relative(projectDir, destination));
|
|
468
490
|
if (seenTargets.has(relativePath)) {
|
|
@@ -491,7 +513,8 @@ export async function runRemotionHubAdd(options) {
|
|
|
491
513
|
throw new Error(`Failed to write file: ${normalizeSlashes(path.relative(projectDir, destination))}`);
|
|
492
514
|
}
|
|
493
515
|
}
|
|
494
|
-
|
|
516
|
+
const lockKey = `${itemRef.namespace}/${itemRef.slug}/${payloadFramework}`;
|
|
517
|
+
lock.installed[lockKey] = {
|
|
495
518
|
version: payload.version,
|
|
496
519
|
type: payload.type,
|
|
497
520
|
namespace: itemRef.namespace,
|
|
@@ -500,11 +523,18 @@ export async function runRemotionHubAdd(options) {
|
|
|
500
523
|
files: written,
|
|
501
524
|
dependencies: payload.dependencies,
|
|
502
525
|
installedAt: new Date().toISOString(),
|
|
526
|
+
framework: payloadFramework,
|
|
503
527
|
};
|
|
504
528
|
writeJsonFile(lockPath, lock);
|
|
505
529
|
writeRegistryFile(projectDir, config, lock);
|
|
506
530
|
const snippet = primaryFile
|
|
507
|
-
?
|
|
531
|
+
? payloadAdapter.buildPostAddSnippet({
|
|
532
|
+
name: payload.name,
|
|
533
|
+
primaryFile,
|
|
534
|
+
source: primarySource,
|
|
535
|
+
projectDir,
|
|
536
|
+
config,
|
|
537
|
+
})
|
|
508
538
|
: '';
|
|
509
539
|
return {
|
|
510
540
|
name: payload.name,
|
|
@@ -516,5 +546,6 @@ export async function runRemotionHubAdd(options) {
|
|
|
516
546
|
dependencies: payload.dependencies,
|
|
517
547
|
installedDependencies,
|
|
518
548
|
snippet,
|
|
549
|
+
framework: payloadFramework,
|
|
519
550
|
};
|
|
520
551
|
}
|