@doubledigit/cli 0.10.0 → 0.10.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remotion-hub-init.d.ts","sourceRoot":"","sources":["../../src/lib/remotion-hub-init.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"remotion-hub-init.d.ts","sourceRoot":"","sources":["../../src/lib/remotion-hub-init.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGV,MAAM,oBAAoB,CAAC;AAY5B,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;AAQF,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,CAAC,MAAM,CAAC,oBAAoB,EAAE;QAChD,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC,CAAC;IACJ,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ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AQ,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;AAqMD,wBAAgB,2BAA2B,CACzC,OAAO,GAAE,IAAI,CAAC,yBAAyB,EAAE,gBAAgB,GAAG,KAAK,CAAM;;;;IAMxE;AA0QD,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B,GAAG,wBAAwB,CA0DpG;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CAmGlC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
1
|
+
import { spawnSync, } from 'node:child_process';
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync, } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { GENERATED_DEFAULT_ACTIONS_APP_URL } from '../generated/defaults.js';
|
|
@@ -203,14 +203,50 @@ function hasPackageJson(projectDir) {
|
|
|
203
203
|
function hasEntries(projectDir) {
|
|
204
204
|
return existsSync(projectDir) && readdirSync(projectDir).length > 0;
|
|
205
205
|
}
|
|
206
|
+
function withNonInteractiveNpx(command, nonInteractive) {
|
|
207
|
+
if (!nonInteractive || command.command !== 'npx')
|
|
208
|
+
return command;
|
|
209
|
+
const args = command.args[0] === '--yes'
|
|
210
|
+
? command.args
|
|
211
|
+
: ['--yes', ...command.args];
|
|
212
|
+
const display = command.display
|
|
213
|
+
? command.display.startsWith('npx --yes ')
|
|
214
|
+
? command.display
|
|
215
|
+
: command.display.startsWith('npx ')
|
|
216
|
+
? `npx --yes ${command.display.slice('npx '.length)}`
|
|
217
|
+
: `npx --yes ${args.slice(1).join(' ')}`
|
|
218
|
+
: command.display;
|
|
219
|
+
return {
|
|
220
|
+
...command,
|
|
221
|
+
args,
|
|
222
|
+
...(display ? { display } : {}),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function componentHubChildSpawnOptions(command, options) {
|
|
226
|
+
return {
|
|
227
|
+
cwd: options.cwd,
|
|
228
|
+
encoding: 'buffer',
|
|
229
|
+
stdio: options.quiet ? 'pipe' : 'inherit',
|
|
230
|
+
...(options.nonInteractive && command === 'npx'
|
|
231
|
+
? { env: { ...process.env, npm_config_yes: 'true' } }
|
|
232
|
+
: {}),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function spawnComponentHubChild(command, options) {
|
|
236
|
+
return (options.spawnImpl ?? spawnSync)(command.command, command.args, componentHubChildSpawnOptions(command.command, options));
|
|
237
|
+
}
|
|
206
238
|
export function buildRemotionSkillsCommands(options = {}) {
|
|
207
239
|
const nonInteractive = options.yes === true || options.nonInteractive === true;
|
|
208
|
-
return getComponentFrameworkAdapter('remotion')
|
|
240
|
+
return getComponentFrameworkAdapter('remotion')
|
|
241
|
+
.skillsCommands({ nonInteractive })
|
|
242
|
+
.map((command) => withNonInteractiveNpx(command, nonInteractive));
|
|
209
243
|
}
|
|
210
244
|
function runFrameworkSkillsInstall(projectDir, options) {
|
|
211
245
|
const adapter = getComponentFrameworkAdapter(options.framework);
|
|
212
246
|
const nonInteractive = options.yes === true || options.nonInteractive === true;
|
|
213
|
-
const commands = adapter
|
|
247
|
+
const commands = adapter
|
|
248
|
+
.skillsCommands({ nonInteractive })
|
|
249
|
+
.map((command) => withNonInteractiveNpx(command, nonInteractive));
|
|
214
250
|
if (options.skipSkills) {
|
|
215
251
|
return commands.map((command) => ({
|
|
216
252
|
...command,
|
|
@@ -220,9 +256,11 @@ function runFrameworkSkillsInstall(projectDir, options) {
|
|
|
220
256
|
}));
|
|
221
257
|
}
|
|
222
258
|
return commands.map((command) => {
|
|
223
|
-
const result = (
|
|
259
|
+
const result = spawnComponentHubChild(command, {
|
|
224
260
|
cwd: projectDir,
|
|
225
|
-
|
|
261
|
+
nonInteractive,
|
|
262
|
+
quiet: options.quiet,
|
|
263
|
+
spawnImpl: options.spawnImpl,
|
|
226
264
|
});
|
|
227
265
|
return {
|
|
228
266
|
...command,
|
|
@@ -247,7 +285,7 @@ function shouldSkipFrameworkCreate(options) {
|
|
|
247
285
|
function ensureBaseFrameworkProject(projectDir, options) {
|
|
248
286
|
const adapter = getComponentFrameworkAdapter(options.framework);
|
|
249
287
|
const nonInteractive = options.yes === true || options.nonInteractive === true;
|
|
250
|
-
const frameworkCreate = adapter.buildCreateCommand(projectDir, { nonInteractive });
|
|
288
|
+
const frameworkCreate = withNonInteractiveNpx(adapter.buildCreateCommand(projectDir, { nonInteractive }), nonInteractive);
|
|
251
289
|
if (shouldSkipFrameworkCreate(options) || hasPackageJson(projectDir)) {
|
|
252
290
|
return {
|
|
253
291
|
...frameworkCreate,
|
|
@@ -259,9 +297,11 @@ function ensureBaseFrameworkProject(projectDir, options) {
|
|
|
259
297
|
throw new Error(`Project directory exists but is not a ${adapter.displayName} project: ${projectDir}. `
|
|
260
298
|
+ `Remove it, choose an empty path, or run ${adapter.displayName} setup manually before Component Hub init.`);
|
|
261
299
|
}
|
|
262
|
-
const result = (
|
|
300
|
+
const result = spawnComponentHubChild(frameworkCreate, {
|
|
263
301
|
cwd: process.cwd(),
|
|
264
|
-
|
|
302
|
+
nonInteractive,
|
|
303
|
+
quiet: options.quiet,
|
|
304
|
+
spawnImpl: options.spawnImpl,
|
|
265
305
|
});
|
|
266
306
|
assertFrameworkCreateSucceeded(result, adapter.displayName, frameworkCreate.command, frameworkCreate.args);
|
|
267
307
|
return {
|