create-video 4.0.0-lambda.3 → 4.0.0-newpaths.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.
Files changed (76) hide show
  1. package/LICENSE.md +8 -8
  2. package/dist/add-yarn2-support.d.ts +6 -0
  3. package/dist/add-yarn2-support.js +27 -0
  4. package/dist/degit.d.ts +0 -0
  5. package/dist/degit.js +0 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.js +3 -1
  8. package/dist/init.d.ts +8 -0
  9. package/dist/init.js +63 -14
  10. package/dist/latest-remotion-version.d.ts +1 -0
  11. package/dist/latest-remotion-version.js +31 -0
  12. package/dist/list-of-remotion-packages.d.ts +1 -0
  13. package/dist/list-of-remotion-packages.js +25 -0
  14. package/dist/log.d.ts +0 -0
  15. package/dist/log.js +0 -0
  16. package/dist/mkdirp.d.ts +0 -0
  17. package/dist/mkdirp.js +0 -0
  18. package/dist/open-in-editor-flow.d.ts +0 -0
  19. package/dist/open-in-editor-flow.js +5 -5
  20. package/dist/open-in-editor.d.ts +8 -4
  21. package/dist/open-in-editor.js +47 -24
  22. package/dist/patch-package-json.d.ts +10 -1
  23. package/dist/patch-package-json.js +18 -4
  24. package/dist/patch-readme.d.ts +3 -2
  25. package/dist/patch-readme.js +4 -4
  26. package/dist/pkg-managers.d.ts +6 -2
  27. package/dist/pkg-managers.js +53 -7
  28. package/dist/prompts.d.ts +2 -1
  29. package/dist/prompts.js +4 -2
  30. package/dist/resolve-project-root.d.ts +0 -0
  31. package/dist/resolve-project-root.js +0 -0
  32. package/dist/select-template.d.ts +1 -1
  33. package/dist/select-template.js +0 -0
  34. package/dist/strip-ansi.d.ts +0 -0
  35. package/dist/strip-ansi.js +0 -0
  36. package/dist/templates.d.ts +21 -8
  37. package/dist/templates.js +115 -13
  38. package/dist/test/git-status.test.d.ts +1 -0
  39. package/dist/test/git-status.test.js +24 -0
  40. package/dist/test/patch-package-json.test.d.ts +1 -0
  41. package/dist/test/patch-package-json.test.js +48 -0
  42. package/dist/test/validate-templates.test.d.ts +1 -0
  43. package/dist/test/validate-templates.test.js +122 -0
  44. package/dist/validate-name.d.ts +0 -0
  45. package/dist/validate-name.js +0 -0
  46. package/dist/yesno.d.ts +0 -0
  47. package/dist/yesno.js +0 -0
  48. package/package.json +12 -8
  49. package/dist/degit.d.ts.map +0 -1
  50. package/dist/degit.js.map +0 -1
  51. package/dist/init.d.ts.map +0 -1
  52. package/dist/init.js.map +0 -1
  53. package/dist/log.d.ts.map +0 -1
  54. package/dist/log.js.map +0 -1
  55. package/dist/mkdirp.d.ts.map +0 -1
  56. package/dist/mkdirp.js.map +0 -1
  57. package/dist/open-in-editor-flow.d.ts.map +0 -1
  58. package/dist/open-in-editor-flow.js.map +0 -1
  59. package/dist/open-in-editor.d.ts.map +0 -1
  60. package/dist/open-in-editor.js.map +0 -1
  61. package/dist/patch-package-json.d.ts.map +0 -1
  62. package/dist/patch-package-json.js.map +0 -1
  63. package/dist/patch-readme.d.ts.map +0 -1
  64. package/dist/patch-readme.js.map +0 -1
  65. package/dist/pkg-managers.d.ts.map +0 -1
  66. package/dist/pkg-managers.js.map +0 -1
  67. package/dist/prompts.d.ts.map +0 -1
  68. package/dist/prompts.js.map +0 -1
  69. package/dist/resolve-project-root.d.ts.map +0 -1
  70. package/dist/resolve-project-root.js.map +0 -1
  71. package/dist/strip-ansi.d.ts.map +0 -1
  72. package/dist/strip-ansi.js.map +0 -1
  73. package/dist/validate-name.d.ts.map +0 -1
  74. package/dist/validate-name.js.map +0 -1
  75. package/dist/yesno.d.ts.map +0 -1
  76. package/dist/yesno.js.map +0 -1
package/LICENSE.md CHANGED
@@ -1,34 +1,34 @@
1
1
  # Remotion License
2
2
 
3
- Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion create videos for free (even commercial), while a company license is required for for-profit organisations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
3
+ Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion to create videos for free (even commercial), while a company license is required for for-profit organizations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
4
4
 
5
5
  - [Free license](#free-license)
6
6
  - [Company license](#company-license)
7
7
 
8
8
  ## Free license
9
9
 
10
- Copyright © 2022 [Jonny Burger](https://jonny.io)
10
+ Copyright © 2023 [Remotion](https://www.remotion.dev/)
11
11
 
12
12
  ### Eligibility
13
13
 
14
14
  You are eligible to use Remotion for free if you are:
15
15
 
16
16
  - an individual
17
- - a for-profit organisation with up to 3 employees
18
- - a non-profit or not-for-profit organisation
17
+ - a for-profit organization with up to 3 employees
18
+ - a non-profit or not-for-profit organization
19
19
  - evaluating whether Remotion is a good fit, and are not yet using it in a commercial way
20
20
 
21
21
  ### Allowed use cases
22
22
 
23
- Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify and the software to their own liking, for the purpose of fulfilling their custom use case or to contribute bug fixes or improvements back to Remotion.
23
+ Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify the software to their own liking, for the purpose of fulfilling their custom use case or to contribute bug fixes or improvements back to Remotion.
24
24
 
25
25
  ### Disallowed use cases
26
26
 
27
- It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, sublicensing your own derivate of Remotion.
27
+ It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, or sublicensing your own derivate of Remotion.
28
28
 
29
29
  ### Warranty notice
30
30
 
31
- The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the author or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
31
+ The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall the author or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
32
32
 
33
33
  ### Support
34
34
 
@@ -36,6 +36,6 @@ Support is provided on a best-we-can-do basis via GitHub Issues and Discord.
36
36
 
37
37
  ## Company license
38
38
 
39
- You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support.
39
+ You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support (read the [Support Policy](/docs/support)).
40
40
 
41
41
  Visit [companies.remotion.dev](https://companies.remotion.dev) for pricing and to buy a license.
@@ -0,0 +1,6 @@
1
+ import type { PackageManager } from './pkg-managers';
2
+ export declare const createYarnYmlFile: ({ projectRoot, pkgManagerVersion, pkgManager, }: {
3
+ projectRoot: string;
4
+ pkgManagerVersion: string | null;
5
+ pkgManager: PackageManager;
6
+ }) => void;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createYarnYmlFile = void 0;
7
+ const fs_1 = require("fs");
8
+ const path_1 = __importDefault(require("path"));
9
+ const log_1 = require("./log");
10
+ const createYarnYmlFile = ({ projectRoot, pkgManagerVersion, pkgManager, }) => {
11
+ if (pkgManager !== 'yarn') {
12
+ return;
13
+ }
14
+ if (!pkgManagerVersion) {
15
+ return;
16
+ }
17
+ const majorVersion = pkgManagerVersion[0];
18
+ const majorVersionNumber = Number(majorVersion);
19
+ if (majorVersionNumber < 2) {
20
+ return;
21
+ }
22
+ log_1.Log.info('Remotion has no support for automatically installing the Yarn PnP modules yet.');
23
+ log_1.Log.info('Creating .yarnrc.yml file to disable Yarn PnP.');
24
+ const yarnrcYml = `nodeLinker: node-modules\n`;
25
+ (0, fs_1.writeFileSync)(path_1.default.join(projectRoot, '.yarnrc.yml'), yarnrcYml);
26
+ };
27
+ exports.createYarnYmlFile = createYarnYmlFile;
package/dist/degit.d.ts CHANGED
File without changes
package/dist/degit.js CHANGED
File without changes
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export declare const CreateVideoInternals: {
2
2
  FEATURED_TEMPLATES: import("./templates").Template[];
3
+ listOfRemotionPackages: string[];
3
4
  };
4
5
  export { Template } from './templates';
5
6
  declare const _default: () => never;
package/dist/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CreateVideoInternals = void 0;
4
+ const list_of_remotion_packages_1 = require("./list-of-remotion-packages");
4
5
  const templates_1 = require("./templates");
5
6
  exports.CreateVideoInternals = {
6
7
  FEATURED_TEMPLATES: templates_1.FEATURED_TEMPLATES,
8
+ listOfRemotionPackages: list_of_remotion_packages_1.listOfRemotionPackages,
7
9
  };
8
10
  exports.default = () => {
9
- throw new Error('create-video is a CLI tool only. Run `yarn create video` or `npm init video` instead!');
11
+ throw new Error('create-video is a CLI tool only. Run `npm init video`, `pnpm create video` or `yarn create video` instead!');
10
12
  };
package/dist/init.d.ts CHANGED
@@ -1 +1,9 @@
1
+ export declare const checkGitAvailability: (cwd: string, command: string) => Promise<{
2
+ type: 'no-git-repo';
3
+ } | {
4
+ type: 'is-git-repo';
5
+ location: string;
6
+ } | {
7
+ type: 'git-not-installed';
8
+ }>;
1
9
  export declare const init: () => Promise<void>;
package/dist/init.js CHANGED
@@ -3,10 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.init = void 0;
6
+ exports.init = exports.checkGitAvailability = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const execa_1 = __importDefault(require("execa"));
9
+ const os_1 = __importDefault(require("os"));
10
+ const add_yarn2_support_1 = require("./add-yarn2-support");
9
11
  const degit_1 = require("./degit");
12
+ const latest_remotion_version_1 = require("./latest-remotion-version");
10
13
  const log_1 = require("./log");
11
14
  const open_in_editor_flow_1 = require("./open-in-editor-flow");
12
15
  const patch_package_json_1 = require("./patch-package-json");
@@ -14,19 +17,36 @@ const patch_readme_1 = require("./patch-readme");
14
17
  const pkg_managers_1 = require("./pkg-managers");
15
18
  const resolve_project_root_1 = require("./resolve-project-root");
16
19
  const select_template_1 = require("./select-template");
17
- const isGitExecutableAvailable = async () => {
20
+ const yesno_1 = require("./yesno");
21
+ const binaryExists = (name) => {
22
+ const isWin = os_1.default.platform() === 'win32';
23
+ const where = isWin ? 'where' : 'which';
18
24
  try {
19
- await (0, execa_1.default)('git', ['--version']);
25
+ execa_1.default.sync(where, [name]);
20
26
  return true;
21
27
  }
28
+ catch (err) {
29
+ return false;
30
+ }
31
+ };
32
+ const checkGitAvailability = async (cwd, command) => {
33
+ if (!binaryExists(command)) {
34
+ return { type: 'git-not-installed' };
35
+ }
36
+ try {
37
+ const result = await (0, execa_1.default)(command, ['rev-parse', '--show-toplevel'], {
38
+ cwd,
39
+ });
40
+ return { type: 'is-git-repo', location: result.stdout };
41
+ }
22
42
  catch (e) {
23
- if (e.errno === 'ENOENT') {
24
- log_1.Log.warn('Unable to find `git` command. `git` not in PATH.');
25
- return false;
26
- }
43
+ return {
44
+ type: 'no-git-repo',
45
+ };
27
46
  }
28
47
  };
29
- const initGitRepoAsync = async (root) => {
48
+ exports.checkGitAvailability = checkGitAvailability;
49
+ const getGitStatus = async (root) => {
30
50
  // not in git tree, so let's init
31
51
  try {
32
52
  await (0, execa_1.default)('git', ['init'], { cwd: root });
@@ -48,18 +68,42 @@ const initGitRepoAsync = async (root) => {
48
68
  };
49
69
  const init = async () => {
50
70
  var _a, _b, _c, _d, _e, _f;
71
+ const result = await (0, exports.checkGitAvailability)(process.cwd(), 'git');
72
+ if (result.type === 'git-not-installed') {
73
+ log_1.Log.error('Git is not installed or not in the path. Install Git to continue.');
74
+ process.exit(1);
75
+ }
76
+ if (result.type === 'is-git-repo') {
77
+ const should = await (0, yesno_1.yesOrNo)({
78
+ defaultValue: false,
79
+ question: `You are already inside a Git repo (${result.location}).\nThis might lead to a Git Submodule being created. Do you want to continue? (y/N):`,
80
+ });
81
+ if (!should) {
82
+ log_1.Log.error('Aborting.');
83
+ process.exit(1);
84
+ }
85
+ }
51
86
  const [projectRoot, folderName] = await (0, resolve_project_root_1.resolveProjectRoot)();
52
- await isGitExecutableAvailable();
87
+ const latestRemotionVersionPromise = (0, latest_remotion_version_1.getLatestRemotionVersion)();
53
88
  const selectedTemplate = await (0, select_template_1.selectTemplate)();
54
89
  const pkgManager = (0, pkg_managers_1.selectPackageManager)();
90
+ const pkgManagerVersion = await (0, pkg_managers_1.getPackageManagerVersionOrNull)(pkgManager);
55
91
  try {
56
92
  await (0, degit_1.degit)({
57
93
  repoOrg: selectedTemplate.org,
58
94
  repoName: selectedTemplate.repoName,
59
95
  dest: projectRoot,
60
96
  });
61
- (0, patch_readme_1.patchReadmeMd)(projectRoot, pkgManager);
62
- (0, patch_package_json_1.patchPackageJson)(projectRoot, folderName);
97
+ (0, patch_readme_1.patchReadmeMd)(projectRoot, pkgManager, selectedTemplate);
98
+ const latestVersion = await latestRemotionVersionPromise;
99
+ (0, patch_package_json_1.patchPackageJson)({
100
+ projectRoot,
101
+ projectName: folderName,
102
+ latestRemotionVersion: latestVersion,
103
+ packageManager: pkgManagerVersion
104
+ ? `${pkgManager}@${pkgManagerVersion}`
105
+ : null,
106
+ });
63
107
  }
64
108
  catch (e) {
65
109
  log_1.Log.error(e);
@@ -67,6 +111,11 @@ const init = async () => {
67
111
  process.exit(1);
68
112
  }
69
113
  log_1.Log.info(`Copied ${chalk_1.default.blueBright(selectedTemplate.shortName)} to ${chalk_1.default.blueBright(folderName)}. Installing dependencies...`);
114
+ (0, add_yarn2_support_1.createYarnYmlFile)({
115
+ pkgManager,
116
+ pkgManagerVersion,
117
+ projectRoot,
118
+ });
70
119
  if (pkgManager === 'yarn') {
71
120
  log_1.Log.info('> yarn');
72
121
  const promise = (0, execa_1.default)('yarn', [], {
@@ -100,17 +149,17 @@ const init = async () => {
100
149
  (_f = promise.stdout) === null || _f === void 0 ? void 0 : _f.pipe(process.stdout);
101
150
  await promise;
102
151
  }
103
- await initGitRepoAsync(projectRoot);
152
+ await getGitStatus(projectRoot);
104
153
  log_1.Log.info();
105
154
  log_1.Log.info(`Welcome to ${chalk_1.default.blueBright('Remotion')}!`);
106
155
  log_1.Log.info(`✨ Your video has been created at ${chalk_1.default.blueBright(folderName)}.`);
107
156
  await (0, open_in_editor_flow_1.openInEditorFlow)(projectRoot);
108
157
  log_1.Log.info('Get started by running');
109
158
  log_1.Log.info(chalk_1.default.blueBright(`cd ${folderName}`));
110
- log_1.Log.info(chalk_1.default.blueBright((0, pkg_managers_1.getStartCommand)(pkgManager)));
159
+ log_1.Log.info(chalk_1.default.blueBright((0, pkg_managers_1.getDevCommand)(pkgManager, selectedTemplate)));
111
160
  log_1.Log.info('');
112
161
  log_1.Log.info('To render a video, run');
113
- log_1.Log.info(chalk_1.default.blueBright((0, pkg_managers_1.getRenderCommand)(pkgManager)));
162
+ log_1.Log.info(chalk_1.default.blueBright((0, pkg_managers_1.getRenderCommandForTemplate)(pkgManager, selectedTemplate)));
114
163
  log_1.Log.info('');
115
164
  log_1.Log.info('Docs to get you started:', chalk_1.default.underline('https://www.remotion.dev/docs/the-fundamentals'));
116
165
  log_1.Log.info('Enjoy Remotion!');
@@ -0,0 +1 @@
1
+ export declare const getLatestRemotionVersion: () => Promise<any>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getLatestRemotionVersion = void 0;
7
+ const https_1 = __importDefault(require("https"));
8
+ const getPackageJsonForRemotion = () => {
9
+ return new Promise((resolve, reject) => {
10
+ const req = https_1.default.get('https://registry.npmjs.org/remotion', {
11
+ headers: {
12
+ accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*',
13
+ },
14
+ }, (res) => {
15
+ let data = '';
16
+ res.on('data', (d) => {
17
+ data += d;
18
+ });
19
+ res.on('end', () => resolve(data));
20
+ });
21
+ req.on('error', (error) => {
22
+ reject(error);
23
+ });
24
+ req.end();
25
+ });
26
+ };
27
+ const getLatestRemotionVersion = async () => {
28
+ const pkgJson = await getPackageJsonForRemotion();
29
+ return JSON.parse(pkgJson)['dist-tags'].latest;
30
+ };
31
+ exports.getLatestRemotionVersion = getLatestRemotionVersion;
@@ -0,0 +1 @@
1
+ export declare const listOfRemotionPackages: string[];
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listOfRemotionPackages = void 0;
4
+ exports.listOfRemotionPackages = [
5
+ '@remotion/bundler',
6
+ '@remotion/cli',
7
+ '@remotion/eslint-config',
8
+ '@remotion/eslint-plugin',
9
+ '@remotion/renderer',
10
+ '@remotion/skia',
11
+ '@remotion/lottie',
12
+ '@remotion/media-utils',
13
+ '@remotion/motion-blur',
14
+ '@remotion/google-fonts',
15
+ '@remotion/noise',
16
+ '@remotion/paths',
17
+ '@remotion/babel-loader',
18
+ '@remotion/lambda',
19
+ '@remotion/player',
20
+ '@remotion/preload',
21
+ '@remotion/three',
22
+ '@remotion/gif',
23
+ '@remotion/shapes',
24
+ 'remotion',
25
+ ];
package/dist/log.d.ts CHANGED
File without changes
package/dist/log.js CHANGED
File without changes
package/dist/mkdirp.d.ts CHANGED
File without changes
package/dist/mkdirp.js CHANGED
File without changes
File without changes
@@ -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 {};
@@ -28,15 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.launchEditor = exports.guessEditor = exports.getDisplayNameForEditor = exports.isTerminalEditor = exports.isVsCodeDerivative = void 0;
31
- /*
32
- Source code adapted from https://github.com/facebook/create-react-app/tree/main/packages/react-error-overlay and refactored in Typescript. This file is MIT-licensed.
33
- */
34
- /**
35
- * Copyright (c) 2015-present, Facebook, Inc.
36
- *
37
- * This source code is licensed under the MIT license found in the
38
- * LICENSE file in the root directory of this source tree.
39
- */
40
31
  const child_process_1 = __importStar(require("child_process"));
41
32
  const fs_1 = __importDefault(require("fs"));
42
33
  const os_1 = __importDefault(require("os"));
@@ -179,9 +170,6 @@ const displayNameForEditor = {
179
170
  };
180
171
  const getDisplayNameForEditor = (editor) => {
181
172
  var _a, _b;
182
- if (!editor) {
183
- return null;
184
- }
185
173
  const endsIn = Object.keys(displayNameForEditor).find((displayNameKey) => {
186
174
  return editor.endsWith(displayNameKey);
187
175
  });
@@ -331,7 +319,10 @@ async function guessEditor() {
331
319
  for (let i = 0; i < processNames.length; i++) {
332
320
  const processName = processNames[i];
333
321
  if (output.indexOf(processName) !== -1) {
334
- availableEditors.push(COMMON_EDITORS_OSX[processName]);
322
+ availableEditors.push({
323
+ process: processName,
324
+ command: COMMON_EDITORS_OSX[processName],
325
+ });
335
326
  }
336
327
  }
337
328
  return availableEditors;
@@ -345,7 +336,10 @@ async function guessEditor() {
345
336
  const processPath = runningProcesses[i].trim();
346
337
  const processName = path_1.default.basename(processPath);
347
338
  if (COMMON_EDITORS_WIN.indexOf(processName) !== -1) {
348
- availableEditors.push(processPath);
339
+ availableEditors.push({
340
+ process: processPath,
341
+ command: processPath,
342
+ });
349
343
  }
350
344
  }
351
345
  return availableEditors;
@@ -359,7 +353,10 @@ async function guessEditor() {
359
353
  for (let i = 0; i < processNames.length; i++) {
360
354
  const processName = processNames[i];
361
355
  if (output.indexOf(processName) !== -1) {
362
- availableEditors.push(COMMON_EDITORS_LINUX[processName]);
356
+ availableEditors.push({
357
+ process: processName,
358
+ command: COMMON_EDITORS_LINUX[processName],
359
+ });
363
360
  }
364
361
  }
365
362
  return availableEditors;
@@ -370,16 +367,26 @@ async function guessEditor() {
370
367
  }
371
368
  // Last resort, use old skool env vars
372
369
  if (process.env.VISUAL) {
373
- return [process.env.VISUAL];
370
+ return [
371
+ {
372
+ process: process.env.VISUAL,
373
+ command: process.env.VISUAL,
374
+ },
375
+ ];
374
376
  }
375
377
  if (process.env.EDITOR) {
376
- return [process.env.EDITOR];
378
+ return [
379
+ {
380
+ process: process.env.EDITOR,
381
+ command: process.env.EDITOR,
382
+ },
383
+ ];
377
384
  }
378
385
  return [];
379
386
  }
380
387
  exports.guessEditor = guessEditor;
381
388
  let _childProcess = null;
382
- function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow, }) {
389
+ async function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow, }) {
383
390
  if (!fs_1.default.existsSync(fileName)) {
384
391
  return false;
385
392
  }
@@ -394,7 +401,7 @@ function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow
394
401
  if (!(Number.isInteger(colNumber) && colNumber > 0)) {
395
402
  colNumber = 1;
396
403
  }
397
- if (editor.toLowerCase() === 'none') {
404
+ if (editor.command.toLowerCase() === 'none') {
398
405
  return false;
399
406
  }
400
407
  if (process.platform === 'linux' &&
@@ -424,25 +431,41 @@ function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow
424
431
  console.log();
425
432
  return false;
426
433
  }
427
- const shouldOpenVsCodeNewWindow = (0, exports.isVsCodeDerivative)(editor) && vsCodeNewWindow;
434
+ const shouldOpenVsCodeNewWindow = (0, exports.isVsCodeDerivative)(editor.command) && vsCodeNewWindow;
428
435
  const args = shouldOpenVsCodeNewWindow
429
436
  ? ['--new-window', fileName]
430
437
  : lineNumber
431
- ? getArgumentsForLineNumber(editor, fileName, String(lineNumber), colNumber)
438
+ ? getArgumentsForLineNumber(editor.command, fileName, String(lineNumber), colNumber)
432
439
  : [fileName];
433
- if (_childProcess && isTerminalEditor(editor)) {
440
+ if (_childProcess && isTerminalEditor(editor.command)) {
434
441
  // There's an existing editor process already and it's attached
435
442
  // to the terminal, so go kill it. Otherwise two separate editor
436
443
  // instances attach to the stdin/stdout which gets confusing.
437
444
  _childProcess.kill('SIGKILL');
438
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
+ });
439
462
  if (process.platform === 'win32') {
440
463
  // On Windows, launch the editor in a shell because spawn can only
441
464
  // launch .exe files.
442
- _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 });
443
466
  }
444
467
  else {
445
- _childProcess = child_process_1.default.spawn(editor, args, { stdio: 'inherit' });
468
+ _childProcess = child_process_1.default.spawn(binaryToUse, args, { stdio: 'inherit' });
446
469
  }
447
470
  _childProcess.on('exit', (errorCode) => {
448
471
  _childProcess = null;
@@ -1 +1,10 @@
1
- export declare const patchPackageJson: (projectRoot: string, projectName: string) => void;
1
+ import type { PackageManager } from './pkg-managers';
2
+ export declare const patchPackageJson: ({ projectRoot, projectName, latestRemotionVersion, packageManager, }: {
3
+ projectRoot: string;
4
+ projectName: string;
5
+ latestRemotionVersion: string;
6
+ packageManager: `${PackageManager}@${string}` | null;
7
+ }, { getPackageJson, setPackageJson, }?: {
8
+ getPackageJson?: ((filename: string) => string) | undefined;
9
+ setPackageJson?: ((filename: string, content: string) => void) | undefined;
10
+ }) => void;
@@ -6,14 +6,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.patchPackageJson = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
- const patchPackageJson = (projectRoot, projectName) => {
9
+ const list_of_remotion_packages_1 = require("./list-of-remotion-packages");
10
+ const patchPackageJson = ({ projectRoot, projectName, latestRemotionVersion, packageManager, }, { getPackageJson = (filename) => fs_1.default.readFileSync(filename, 'utf-8'), setPackageJson = (filename, content) => fs_1.default.writeFileSync(filename, content), } = {}) => {
10
11
  const fileName = path_1.default.join(projectRoot, 'package.json');
11
- const contents = fs_1.default.readFileSync(fileName, 'utf-8');
12
+ const contents = getPackageJson(fileName);
12
13
  const packageJson = JSON.parse(contents);
14
+ const { name, dependencies, ...others } = packageJson;
15
+ const newDependencies = Object.keys(dependencies)
16
+ .map((d) => {
17
+ if (list_of_remotion_packages_1.listOfRemotionPackages.includes(d)) {
18
+ return [d, latestRemotionVersion];
19
+ }
20
+ return [d, dependencies[d]];
21
+ })
22
+ .reduce((a, b) => {
23
+ return { ...a, [b[0]]: b[1] };
24
+ }, {});
13
25
  const newPackageJson = JSON.stringify({
14
- ...packageJson,
15
26
  name: projectName,
27
+ ...others,
28
+ dependencies: newDependencies,
29
+ ...(packageManager ? { packageManager } : {}),
16
30
  }, undefined, 2);
17
- fs_1.default.writeFileSync(fileName, newPackageJson);
31
+ setPackageJson(fileName, newPackageJson);
18
32
  };
19
33
  exports.patchPackageJson = patchPackageJson;
@@ -1,2 +1,3 @@
1
- import { PackageManager } from './pkg-managers';
2
- export declare const patchReadmeMd: (projectRoot: string, packageManager: PackageManager) => void;
1
+ import type { PackageManager } from './pkg-managers';
2
+ import type { Template } from './templates';
3
+ export declare const patchReadmeMd: (projectRoot: string, packageManager: PackageManager, template: Template) => void;
@@ -7,7 +7,7 @@ exports.patchReadmeMd = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const pkg_managers_1 = require("./pkg-managers");
10
- const patchReadmeMd = (projectRoot, packageManager) => {
10
+ const patchReadmeMd = (projectRoot, packageManager, template) => {
11
11
  const fileName = path_1.default.join(projectRoot, 'README.md');
12
12
  const contents = fs_1.default.readFileSync(fileName, 'utf8');
13
13
  const newContents = contents
@@ -17,13 +17,13 @@ const patchReadmeMd = (projectRoot, packageManager) => {
17
17
  return (0, pkg_managers_1.getInstallCommand)(packageManager);
18
18
  }
19
19
  if (c.startsWith('npm start')) {
20
- return (0, pkg_managers_1.getStartCommand)(packageManager);
20
+ return (0, pkg_managers_1.getDevCommand)(packageManager, template);
21
21
  }
22
22
  if (c.startsWith('npm run build')) {
23
23
  return (0, pkg_managers_1.getRenderCommand)(packageManager);
24
24
  }
25
- if (c.startsWith('npm run upgrade')) {
26
- return (0, pkg_managers_1.getUpgradeCommand)(packageManager);
25
+ if (c.startsWith('npm run ')) {
26
+ return (0, pkg_managers_1.getRunCommand)(packageManager) + c.replace('npm run', '');
27
27
  }
28
28
  return c;
29
29
  })
@@ -1,6 +1,10 @@
1
+ import type { Template } from './templates';
1
2
  export declare type PackageManager = 'npm' | 'yarn' | 'pnpm';
2
3
  export declare const selectPackageManager: () => PackageManager;
3
4
  export declare const getInstallCommand: (manager: PackageManager) => "yarn" | "npm i" | "pnpm i" | undefined;
4
- export declare const getStartCommand: (manager: PackageManager) => "npm start" | "yarn start" | "pnpm start" | undefined;
5
+ export declare const getDevCommand: (manager: PackageManager, template: Template) => string | undefined;
6
+ export declare const getRenderCommandForTemplate: (manager: PackageManager, template: Template) => string | undefined;
5
7
  export declare const getRenderCommand: (manager: PackageManager) => "npm run build" | "yarn build" | "pnpm build" | undefined;
6
- export declare const getUpgradeCommand: (manager: PackageManager) => "npm run upgrade" | "yarn run upgrade" | "pnpm run upgrade" | undefined;
8
+ export declare const getRunCommand: (manager: PackageManager) => "npm run" | "yarn run" | "pnpm run";
9
+ export declare const getPackageManagerVersion: (manager: PackageManager) => Promise<string>;
10
+ export declare const getPackageManagerVersionOrNull: (manager: PackageManager) => Promise<string | null>;