create-video 3.1.2 → 3.1.5

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.
@@ -10,28 +10,28 @@ const open_in_editor_1 = require("./open-in-editor");
10
10
  const yesno_1 = require("./yesno");
11
11
  const openInEditorFlow = async (projectRoot) => {
12
12
  const editors = await (0, open_in_editor_1.guessEditor)();
13
- const [guiEditor] = editors.filter((e) => !(0, open_in_editor_1.isTerminalEditor)(e));
13
+ const [guiEditor] = editors.filter((e) => !(0, open_in_editor_1.isTerminalEditor)(e.command));
14
14
  if (!guiEditor) {
15
15
  return;
16
16
  }
17
- const displayName = (0, open_in_editor_1.getDisplayNameForEditor)(guiEditor);
17
+ const displayName = (0, open_in_editor_1.getDisplayNameForEditor)(guiEditor.command);
18
18
  const should = await (0, yesno_1.yesOrNo)({
19
19
  defaultValue: true,
20
20
  question: `💻 Do you want to open the project in ${displayName}? (Y/n):`,
21
21
  });
22
22
  if (should) {
23
- (0, open_in_editor_1.launchEditor)({
23
+ await (0, open_in_editor_1.launchEditor)({
24
24
  colNumber: 1,
25
25
  editor: guiEditor,
26
26
  fileName: projectRoot,
27
27
  vsCodeNewWindow: true,
28
28
  lineNumber: 1,
29
29
  });
30
- if ((0, open_in_editor_1.isVsCodeDerivative)(guiEditor)) {
30
+ if ((0, open_in_editor_1.isVsCodeDerivative)(guiEditor.command)) {
31
31
  await new Promise((resolve) => {
32
32
  setTimeout(resolve, 1000);
33
33
  });
34
- (0, open_in_editor_1.launchEditor)({
34
+ await (0, open_in_editor_1.launchEditor)({
35
35
  colNumber: 1,
36
36
  editor: guiEditor,
37
37
  fileName: path_1.default.join(projectRoot, 'README.md'),
@@ -1,14 +1,18 @@
1
1
  export declare const isVsCodeDerivative: (editor: Editor) => boolean;
2
2
  export declare function isTerminalEditor(editor: Editor): boolean;
3
3
  declare const editorNames: readonly ["atom", "/Applications/Atom Beta.app/Contents/MacOS/Atom Beta", "brackets", "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl", "/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl", "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl", "code", "code-insiders", "vscodium", "/Applications/AppCode.app/Contents/MacOS/appcode", "/Applications/CLion.app/Contents/MacOS/clion", "/Applications/IntelliJ IDEA.app/Contents/MacOS/idea", "/Applications/PhpStorm.app/Contents/MacOS/phpstorm", "/Applications/PyCharm.app/Contents/MacOS/pycharm", "/Applications/PyCharm CE.app/Contents/MacOS/pycharm", "/Applications/RubyMine.app/Contents/MacOS/rubymine", "/Applications/WebStorm.app/Contents/MacOS/webstorm", "/Applications/GoLand.app/Contents/MacOS/goland", "/Applications/Rider.app/Contents/MacOS/rider", "mvim", "emacs", "gvim", "idea", "phpstorm", "pycharm", "rubymine", "sublime_text", "vim", "webstorm", "goland", "rider", "Brackets.exe", "Code.exe", "Code - Insiders.exe", "VSCodium.exe", "atom.exe", "sublime_text.exe", "notepad++.exe", "clion.exe", "clion64.exe", "idea.exe", "idea64.exe", "phpstorm.exe", "phpstorm64.exe", "pycharm.exe", "pycharm64.exe", "rubymine.exe", "rubymine64.exe", "webstorm.exe", "webstorm64.exe", "goland.exe", "goland64.exe", "rider.exe", "rider64.exe", "nano"];
4
- export declare const getDisplayNameForEditor: (editor: Editor | undefined) => string | null;
4
+ export declare const getDisplayNameForEditor: (editor: Editor) => string;
5
5
  declare type Editor = typeof editorNames[number];
6
- export declare function guessEditor(): Promise<Editor[]>;
6
+ declare type ProcessAndCommand = {
7
+ process: string;
8
+ command: Editor;
9
+ };
10
+ export declare function guessEditor(): Promise<ProcessAndCommand[]>;
7
11
  export declare function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow, }: {
8
12
  fileName: string;
9
13
  lineNumber: number;
10
14
  colNumber: number;
11
- editor: Editor;
15
+ editor: ProcessAndCommand;
12
16
  vsCodeNewWindow: boolean;
13
- }): boolean;
17
+ }): Promise<boolean>;
14
18
  export {};
@@ -170,9 +170,6 @@ const displayNameForEditor = {
170
170
  };
171
171
  const getDisplayNameForEditor = (editor) => {
172
172
  var _a, _b;
173
- if (!editor) {
174
- return null;
175
- }
176
173
  const endsIn = Object.keys(displayNameForEditor).find((displayNameKey) => {
177
174
  return editor.endsWith(displayNameKey);
178
175
  });
@@ -322,7 +319,10 @@ async function guessEditor() {
322
319
  for (let i = 0; i < processNames.length; i++) {
323
320
  const processName = processNames[i];
324
321
  if (output.indexOf(processName) !== -1) {
325
- availableEditors.push(COMMON_EDITORS_OSX[processName]);
322
+ availableEditors.push({
323
+ process: processName,
324
+ command: COMMON_EDITORS_OSX[processName],
325
+ });
326
326
  }
327
327
  }
328
328
  return availableEditors;
@@ -336,7 +336,10 @@ async function guessEditor() {
336
336
  const processPath = runningProcesses[i].trim();
337
337
  const processName = path_1.default.basename(processPath);
338
338
  if (COMMON_EDITORS_WIN.indexOf(processName) !== -1) {
339
- availableEditors.push(processPath);
339
+ availableEditors.push({
340
+ process: processPath,
341
+ command: processPath,
342
+ });
340
343
  }
341
344
  }
342
345
  return availableEditors;
@@ -350,7 +353,10 @@ async function guessEditor() {
350
353
  for (let i = 0; i < processNames.length; i++) {
351
354
  const processName = processNames[i];
352
355
  if (output.indexOf(processName) !== -1) {
353
- availableEditors.push(COMMON_EDITORS_LINUX[processName]);
356
+ availableEditors.push({
357
+ process: processName,
358
+ command: COMMON_EDITORS_LINUX[processName],
359
+ });
354
360
  }
355
361
  }
356
362
  return availableEditors;
@@ -361,16 +367,26 @@ async function guessEditor() {
361
367
  }
362
368
  // Last resort, use old skool env vars
363
369
  if (process.env.VISUAL) {
364
- return [process.env.VISUAL];
370
+ return [
371
+ {
372
+ process: process.env.VISUAL,
373
+ command: process.env.VISUAL,
374
+ },
375
+ ];
365
376
  }
366
377
  if (process.env.EDITOR) {
367
- return [process.env.EDITOR];
378
+ return [
379
+ {
380
+ process: process.env.EDITOR,
381
+ command: process.env.EDITOR,
382
+ },
383
+ ];
368
384
  }
369
385
  return [];
370
386
  }
371
387
  exports.guessEditor = guessEditor;
372
388
  let _childProcess = null;
373
- function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow, }) {
389
+ async function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow, }) {
374
390
  if (!fs_1.default.existsSync(fileName)) {
375
391
  return false;
376
392
  }
@@ -385,7 +401,7 @@ function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow
385
401
  if (!(Number.isInteger(colNumber) && colNumber > 0)) {
386
402
  colNumber = 1;
387
403
  }
388
- if (editor.toLowerCase() === 'none') {
404
+ if (editor.command.toLowerCase() === 'none') {
389
405
  return false;
390
406
  }
391
407
  if (process.platform === 'linux' &&
@@ -415,25 +431,41 @@ function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow
415
431
  console.log();
416
432
  return false;
417
433
  }
418
- const shouldOpenVsCodeNewWindow = (0, exports.isVsCodeDerivative)(editor) && vsCodeNewWindow;
434
+ const shouldOpenVsCodeNewWindow = (0, exports.isVsCodeDerivative)(editor.command) && vsCodeNewWindow;
419
435
  const args = shouldOpenVsCodeNewWindow
420
436
  ? ['--new-window', fileName]
421
437
  : lineNumber
422
- ? getArgumentsForLineNumber(editor, fileName, String(lineNumber), colNumber)
438
+ ? getArgumentsForLineNumber(editor.command, fileName, String(lineNumber), colNumber)
423
439
  : [fileName];
424
- if (_childProcess && isTerminalEditor(editor)) {
440
+ if (_childProcess && isTerminalEditor(editor.command)) {
425
441
  // There's an existing editor process already and it's attached
426
442
  // to the terminal, so go kill it. Otherwise two separate editor
427
443
  // instances attach to the stdin/stdout which gets confusing.
428
444
  _childProcess.kill('SIGKILL');
429
445
  }
446
+ const isWin = os_1.default.platform() === 'win32';
447
+ const where = isWin ? 'where' : 'which';
448
+ const binaryToUse = await new Promise((resolve) => {
449
+ if (editor.command === editor.process) {
450
+ resolve(editor.command);
451
+ return;
452
+ }
453
+ child_process_1.default.exec(`${where} "${editor.command}"`, (err) => {
454
+ if (err) {
455
+ resolve(editor.process);
456
+ }
457
+ else {
458
+ resolve(editor.command);
459
+ }
460
+ });
461
+ });
430
462
  if (process.platform === 'win32') {
431
463
  // On Windows, launch the editor in a shell because spawn can only
432
464
  // launch .exe files.
433
- _childProcess = child_process_1.default.spawn('cmd.exe', ['/C', editor].concat(args), { stdio: 'inherit', detached: true });
465
+ _childProcess = child_process_1.default.spawn('cmd.exe', ['/C', binaryToUse].concat(args), { stdio: 'inherit', detached: true });
434
466
  }
435
467
  else {
436
- _childProcess = child_process_1.default.spawn(editor, args, { stdio: 'inherit' });
468
+ _childProcess = child_process_1.default.spawn(binaryToUse, args, { stdio: 'inherit' });
437
469
  }
438
470
  _childProcess.on('exit', (errorCode) => {
439
471
  _childProcess = null;
package/dist/prompts.js CHANGED
@@ -48,7 +48,8 @@ async function selectAsync(questions, options) {
48
48
  if (!this.choices[next].disabled)
49
49
  break;
50
50
  }
51
- if (!this.choices[next].disabled && next !== this.cursor) {
51
+ if (!this.choices[next].disabled &&
52
+ next !== this.cursor) {
52
53
  this.moveCursor(next);
53
54
  this.render();
54
55
  }
@@ -67,7 +68,8 @@ async function selectAsync(questions, options) {
67
68
  if (!this.choices[next].disabled)
68
69
  break;
69
70
  }
70
- if (!this.choices[next].disabled && next !== this.cursor) {
71
+ if (!this.choices[next].disabled &&
72
+ next !== this.cursor) {
71
73
  this.moveCursor(next);
72
74
  this.render();
73
75
  }
package/dist/templates.js CHANGED
@@ -100,6 +100,20 @@ exports.FEATURED_TEMPLATES = [
100
100
  },
101
101
  cliId: 'audiogram',
102
102
  },
103
+ {
104
+ homePageLabel: 'Skia',
105
+ shortName: 'Skia',
106
+ org: 'remotion-dev',
107
+ repoName: 'template-skia',
108
+ description: 'React Native Skia starter',
109
+ longerDescription: 'A template with React Native Skia already setup.',
110
+ promoVideo: {
111
+ muxId: 'ecORcc01sP94IsTRGLwngxH4PC1r1kQq6iXpn00HqCIGI',
112
+ height: 1080,
113
+ width: 1920,
114
+ },
115
+ cliId: 'skia',
116
+ },
103
117
  {
104
118
  homePageLabel: 'Tailwind',
105
119
  shortName: 'Tailwind',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-video",
3
- "version": "3.1.2",
3
+ "version": "3.1.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -35,5 +35,5 @@
35
35
  "prettier-plugin-organize-imports": "^2.3.4",
36
36
  "typescript": "^4.7.0"
37
37
  },
38
- "gitHead": "7ac5f5675a7390cc776265c667d382149dee9814"
38
+ "gitHead": "965ca68bd4efce9ca5e27fe30c4a31aec594575c"
39
39
  }