create-video 4.0.0-alpha.4 → 4.0.0-alpha5
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/LICENSE.md +8 -8
- package/dist/add-yarn2-support.d.ts +6 -0
- package/dist/add-yarn2-support.js +27 -0
- package/dist/degit.d.ts +0 -0
- package/dist/degit.js +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/init.d.ts +8 -0
- package/dist/init.js +62 -14
- package/dist/latest-remotion-version.d.ts +1 -0
- package/dist/latest-remotion-version.js +31 -0
- package/dist/list-of-remotion-packages.d.ts +1 -0
- package/dist/list-of-remotion-packages.js +28 -0
- package/dist/log.d.ts +0 -0
- package/dist/log.js +0 -0
- package/dist/mkdirp.d.ts +0 -0
- package/dist/mkdirp.js +0 -0
- package/dist/open-in-editor-flow.d.ts +0 -0
- package/dist/open-in-editor-flow.js +0 -0
- package/dist/open-in-editor.d.ts +0 -0
- package/dist/open-in-editor.js +0 -0
- package/dist/patch-package-json.d.ts +10 -1
- package/dist/patch-package-json.js +24 -4
- package/dist/patch-readme.d.ts +2 -1
- package/dist/patch-readme.js +4 -4
- package/dist/pkg-managers.d.ts +6 -2
- package/dist/pkg-managers.js +53 -7
- package/dist/prompts.d.ts +0 -0
- package/dist/prompts.js +0 -0
- package/dist/resolve-project-root.d.ts +0 -0
- package/dist/resolve-project-root.js +0 -0
- package/dist/select-template.d.ts +0 -0
- package/dist/select-template.js +0 -0
- package/dist/strip-ansi.d.ts +0 -0
- package/dist/strip-ansi.js +0 -0
- package/dist/templates.d.ts +21 -8
- package/dist/templates.js +103 -14
- package/dist/test/git-status.test.d.ts +1 -0
- package/dist/test/git-status.test.js +26 -0
- package/dist/test/patch-package-json.test.d.ts +1 -0
- package/dist/test/patch-package-json.test.js +53 -0
- package/dist/test/validate-templates.test.d.ts +1 -0
- package/dist/test/validate-templates.test.js +136 -0
- package/dist/validate-name.d.ts +0 -0
- package/dist/validate-name.js +0 -0
- package/dist/yesno.d.ts +0 -0
- package/dist/yesno.js +0 -0
- package/package.json +41 -38
- package/dist/degit.d.ts.map +0 -1
- package/dist/degit.js.map +0 -1
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js.map +0 -1
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js.map +0 -1
- package/dist/mkdirp.d.ts.map +0 -1
- package/dist/mkdirp.js.map +0 -1
- package/dist/open-in-editor-flow.d.ts.map +0 -1
- package/dist/open-in-editor-flow.js.map +0 -1
- package/dist/open-in-editor.d.ts.map +0 -1
- package/dist/open-in-editor.js.map +0 -1
- package/dist/patch-package-json.d.ts.map +0 -1
- package/dist/patch-package-json.js.map +0 -1
- package/dist/patch-readme.d.ts.map +0 -1
- package/dist/patch-readme.js.map +0 -1
- package/dist/pkg-managers.d.ts.map +0 -1
- package/dist/pkg-managers.js.map +0 -1
- package/dist/prompts.d.ts.map +0 -1
- package/dist/prompts.js.map +0 -1
- package/dist/resolve-project-root.d.ts.map +0 -1
- package/dist/resolve-project-root.js.map +0 -1
- package/dist/strip-ansi.d.ts.map +0 -1
- package/dist/strip-ansi.js.map +0 -1
- package/dist/validate-name.d.ts.map +0 -1
- package/dist/validate-name.js.map +0 -1
- package/dist/yesno.d.ts.map +0 -1
- 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
|
|
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 ©
|
|
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
|
|
18
|
-
- a non-profit or not-for-profit
|
|
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
|
|
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
|
|
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,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
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 `
|
|
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, commandToCheck: string, argsToCheck: 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,12 @@ 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 add_yarn2_support_1 = require("./add-yarn2-support");
|
|
9
10
|
const degit_1 = require("./degit");
|
|
11
|
+
const latest_remotion_version_1 = require("./latest-remotion-version");
|
|
10
12
|
const log_1 = require("./log");
|
|
11
13
|
const open_in_editor_flow_1 = require("./open-in-editor-flow");
|
|
12
14
|
const patch_package_json_1 = require("./patch-package-json");
|
|
@@ -14,19 +16,34 @@ const patch_readme_1 = require("./patch-readme");
|
|
|
14
16
|
const pkg_managers_1 = require("./pkg-managers");
|
|
15
17
|
const resolve_project_root_1 = require("./resolve-project-root");
|
|
16
18
|
const select_template_1 = require("./select-template");
|
|
17
|
-
const
|
|
19
|
+
const yesno_1 = require("./yesno");
|
|
20
|
+
const gitExists = (commandToCheck, argsToCheck) => {
|
|
18
21
|
try {
|
|
19
|
-
|
|
22
|
+
execa_1.default.sync(commandToCheck, argsToCheck);
|
|
20
23
|
return true;
|
|
21
24
|
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const checkGitAvailability = async (cwd, commandToCheck, argsToCheck) => {
|
|
30
|
+
if (!gitExists(commandToCheck, argsToCheck)) {
|
|
31
|
+
return { type: 'git-not-installed' };
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const result = await (0, execa_1.default)('git', ['rev-parse', '--show-toplevel'], {
|
|
35
|
+
cwd,
|
|
36
|
+
});
|
|
37
|
+
return { type: 'is-git-repo', location: result.stdout };
|
|
38
|
+
}
|
|
22
39
|
catch (e) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
40
|
+
return {
|
|
41
|
+
type: 'no-git-repo',
|
|
42
|
+
};
|
|
27
43
|
}
|
|
28
44
|
};
|
|
29
|
-
|
|
45
|
+
exports.checkGitAvailability = checkGitAvailability;
|
|
46
|
+
const getGitStatus = async (root) => {
|
|
30
47
|
// not in git tree, so let's init
|
|
31
48
|
try {
|
|
32
49
|
await (0, execa_1.default)('git', ['init'], { cwd: root });
|
|
@@ -48,18 +65,44 @@ const initGitRepoAsync = async (root) => {
|
|
|
48
65
|
};
|
|
49
66
|
const init = async () => {
|
|
50
67
|
var _a, _b, _c, _d, _e, _f;
|
|
68
|
+
const result = await (0, exports.checkGitAvailability)(process.cwd(), 'git', [
|
|
69
|
+
'--version',
|
|
70
|
+
]);
|
|
71
|
+
if (result.type === 'git-not-installed') {
|
|
72
|
+
log_1.Log.error('Git is not installed or not in the path. Install Git to continue.');
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
if (result.type === 'is-git-repo') {
|
|
76
|
+
const should = await (0, yesno_1.yesOrNo)({
|
|
77
|
+
defaultValue: false,
|
|
78
|
+
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):`,
|
|
79
|
+
});
|
|
80
|
+
if (!should) {
|
|
81
|
+
log_1.Log.error('Aborting.');
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
51
85
|
const [projectRoot, folderName] = await (0, resolve_project_root_1.resolveProjectRoot)();
|
|
52
|
-
|
|
86
|
+
const latestRemotionVersionPromise = (0, latest_remotion_version_1.getLatestRemotionVersion)();
|
|
53
87
|
const selectedTemplate = await (0, select_template_1.selectTemplate)();
|
|
54
88
|
const pkgManager = (0, pkg_managers_1.selectPackageManager)();
|
|
89
|
+
const pkgManagerVersion = await (0, pkg_managers_1.getPackageManagerVersionOrNull)(pkgManager);
|
|
55
90
|
try {
|
|
56
91
|
await (0, degit_1.degit)({
|
|
57
92
|
repoOrg: selectedTemplate.org,
|
|
58
93
|
repoName: selectedTemplate.repoName,
|
|
59
94
|
dest: projectRoot,
|
|
60
95
|
});
|
|
61
|
-
(0, patch_readme_1.patchReadmeMd)(projectRoot, pkgManager);
|
|
62
|
-
|
|
96
|
+
(0, patch_readme_1.patchReadmeMd)(projectRoot, pkgManager, selectedTemplate);
|
|
97
|
+
const latestVersion = await latestRemotionVersionPromise;
|
|
98
|
+
(0, patch_package_json_1.patchPackageJson)({
|
|
99
|
+
projectRoot,
|
|
100
|
+
projectName: folderName,
|
|
101
|
+
latestRemotionVersion: latestVersion,
|
|
102
|
+
packageManager: pkgManagerVersion
|
|
103
|
+
? `${pkgManager}@${pkgManagerVersion}`
|
|
104
|
+
: null,
|
|
105
|
+
});
|
|
63
106
|
}
|
|
64
107
|
catch (e) {
|
|
65
108
|
log_1.Log.error(e);
|
|
@@ -67,6 +110,11 @@ const init = async () => {
|
|
|
67
110
|
process.exit(1);
|
|
68
111
|
}
|
|
69
112
|
log_1.Log.info(`Copied ${chalk_1.default.blueBright(selectedTemplate.shortName)} to ${chalk_1.default.blueBright(folderName)}. Installing dependencies...`);
|
|
113
|
+
(0, add_yarn2_support_1.createYarnYmlFile)({
|
|
114
|
+
pkgManager,
|
|
115
|
+
pkgManagerVersion,
|
|
116
|
+
projectRoot,
|
|
117
|
+
});
|
|
70
118
|
if (pkgManager === 'yarn') {
|
|
71
119
|
log_1.Log.info('> yarn');
|
|
72
120
|
const promise = (0, execa_1.default)('yarn', [], {
|
|
@@ -100,17 +148,17 @@ const init = async () => {
|
|
|
100
148
|
(_f = promise.stdout) === null || _f === void 0 ? void 0 : _f.pipe(process.stdout);
|
|
101
149
|
await promise;
|
|
102
150
|
}
|
|
103
|
-
await
|
|
151
|
+
await getGitStatus(projectRoot);
|
|
104
152
|
log_1.Log.info();
|
|
105
153
|
log_1.Log.info(`Welcome to ${chalk_1.default.blueBright('Remotion')}!`);
|
|
106
154
|
log_1.Log.info(`✨ Your video has been created at ${chalk_1.default.blueBright(folderName)}.`);
|
|
107
155
|
await (0, open_in_editor_flow_1.openInEditorFlow)(projectRoot);
|
|
108
156
|
log_1.Log.info('Get started by running');
|
|
109
157
|
log_1.Log.info(chalk_1.default.blueBright(`cd ${folderName}`));
|
|
110
|
-
log_1.Log.info(chalk_1.default.blueBright((0, pkg_managers_1.
|
|
158
|
+
log_1.Log.info(chalk_1.default.blueBright((0, pkg_managers_1.getDevCommand)(pkgManager, selectedTemplate)));
|
|
111
159
|
log_1.Log.info('');
|
|
112
160
|
log_1.Log.info('To render a video, run');
|
|
113
|
-
log_1.Log.info(chalk_1.default.blueBright((0, pkg_managers_1.
|
|
161
|
+
log_1.Log.info(chalk_1.default.blueBright((0, pkg_managers_1.getRenderCommandForTemplate)(pkgManager, selectedTemplate)));
|
|
114
162
|
log_1.Log.info('');
|
|
115
163
|
log_1.Log.info('Docs to get you started:', chalk_1.default.underline('https://www.remotion.dev/docs/the-fundamentals'));
|
|
116
164
|
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,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listOfRemotionPackages = void 0;
|
|
4
|
+
// Keep in sync with cli
|
|
5
|
+
exports.listOfRemotionPackages = [
|
|
6
|
+
'@remotion/bundler',
|
|
7
|
+
'@remotion/cli',
|
|
8
|
+
'@remotion/eslint-config',
|
|
9
|
+
'@remotion/eslint-plugin',
|
|
10
|
+
'@remotion/renderer',
|
|
11
|
+
'@remotion/skia',
|
|
12
|
+
'@remotion/lottie',
|
|
13
|
+
'@remotion/media-utils',
|
|
14
|
+
'@remotion/motion-blur',
|
|
15
|
+
'@remotion/google-fonts',
|
|
16
|
+
'@remotion/noise',
|
|
17
|
+
'@remotion/paths',
|
|
18
|
+
'@remotion/babel-loader',
|
|
19
|
+
'@remotion/lambda',
|
|
20
|
+
'@remotion/player',
|
|
21
|
+
'@remotion/preload',
|
|
22
|
+
'@remotion/three',
|
|
23
|
+
'@remotion/rive',
|
|
24
|
+
'@remotion/gif',
|
|
25
|
+
'@remotion/shapes',
|
|
26
|
+
'@remotion/zod-types',
|
|
27
|
+
'remotion',
|
|
28
|
+
];
|
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
|
|
File without changes
|
package/dist/open-in-editor.d.ts
CHANGED
|
File without changes
|
package/dist/open-in-editor.js
CHANGED
|
File without changes
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
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,34 @@ 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
|
|
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 =
|
|
12
|
+
const contents = getPackageJson(fileName);
|
|
12
13
|
const packageJson = JSON.parse(contents);
|
|
14
|
+
const { name, dependencies, devDependencies, ...others } = packageJson;
|
|
15
|
+
const [newDependencies, newDevDependencies] = [
|
|
16
|
+
dependencies,
|
|
17
|
+
devDependencies !== null && devDependencies !== void 0 ? devDependencies : {},
|
|
18
|
+
].map((depsField) => {
|
|
19
|
+
return Object.keys(depsField)
|
|
20
|
+
.map((d) => {
|
|
21
|
+
if (list_of_remotion_packages_1.listOfRemotionPackages.includes(d)) {
|
|
22
|
+
return [d, latestRemotionVersion];
|
|
23
|
+
}
|
|
24
|
+
return [d, depsField[d]];
|
|
25
|
+
})
|
|
26
|
+
.reduce((a, b) => {
|
|
27
|
+
return { ...a, [b[0]]: b[1] };
|
|
28
|
+
}, {});
|
|
29
|
+
});
|
|
13
30
|
const newPackageJson = JSON.stringify({
|
|
14
|
-
...packageJson,
|
|
15
31
|
name: projectName,
|
|
32
|
+
...others,
|
|
33
|
+
dependencies: newDependencies,
|
|
34
|
+
devDependencies: newDevDependencies,
|
|
35
|
+
...(packageManager ? { packageManager } : {}),
|
|
16
36
|
}, undefined, 2);
|
|
17
|
-
|
|
37
|
+
setPackageJson(fileName, newPackageJson);
|
|
18
38
|
};
|
|
19
39
|
exports.patchPackageJson = patchPackageJson;
|
package/dist/patch-readme.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { PackageManager } from './pkg-managers';
|
|
2
|
-
|
|
2
|
+
import type { Template } from './templates';
|
|
3
|
+
export declare const patchReadmeMd: (projectRoot: string, packageManager: PackageManager, template: Template) => void;
|
package/dist/patch-readme.js
CHANGED
|
@@ -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.
|
|
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
|
|
26
|
-
return (0, pkg_managers_1.
|
|
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
|
})
|
package/dist/pkg-managers.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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>;
|
package/dist/pkg-managers.js
CHANGED
|
@@ -3,7 +3,8 @@ 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.
|
|
6
|
+
exports.getPackageManagerVersionOrNull = exports.getPackageManagerVersion = exports.getRunCommand = exports.getRenderCommand = exports.getRenderCommandForTemplate = exports.getDevCommand = exports.getInstallCommand = exports.selectPackageManager = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
7
8
|
const path_1 = __importDefault(require("path"));
|
|
8
9
|
const shouldUseYarn = () => {
|
|
9
10
|
var _a, _b;
|
|
@@ -47,6 +48,23 @@ const getInstallCommand = (manager) => {
|
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
50
|
exports.getInstallCommand = getInstallCommand;
|
|
51
|
+
const getDevCommand = (manager, template) => {
|
|
52
|
+
if (template.cliId === 'remix' || template.cliId === 'next') {
|
|
53
|
+
return `${(0, exports.getRunCommand)(manager)} dev`;
|
|
54
|
+
}
|
|
55
|
+
return getStartCommand(manager);
|
|
56
|
+
};
|
|
57
|
+
exports.getDevCommand = getDevCommand;
|
|
58
|
+
const getRenderCommandForTemplate = (manager, template) => {
|
|
59
|
+
if (template.cliId === 'remix' || template.cliId === 'next') {
|
|
60
|
+
return `${(0, exports.getRunCommand)(manager)} remotion:render`;
|
|
61
|
+
}
|
|
62
|
+
if (template.cliId === 'still') {
|
|
63
|
+
return `${(0, exports.getRunCommand)(manager)} render`;
|
|
64
|
+
}
|
|
65
|
+
return (0, exports.getRenderCommand)(manager);
|
|
66
|
+
};
|
|
67
|
+
exports.getRenderCommandForTemplate = getRenderCommandForTemplate;
|
|
50
68
|
const getStartCommand = (manager) => {
|
|
51
69
|
if (manager === 'npm') {
|
|
52
70
|
return `npm start`;
|
|
@@ -58,7 +76,6 @@ const getStartCommand = (manager) => {
|
|
|
58
76
|
return `pnpm start`;
|
|
59
77
|
}
|
|
60
78
|
};
|
|
61
|
-
exports.getStartCommand = getStartCommand;
|
|
62
79
|
const getRenderCommand = (manager) => {
|
|
63
80
|
if (manager === 'npm') {
|
|
64
81
|
return `npm run build`;
|
|
@@ -71,15 +88,44 @@ const getRenderCommand = (manager) => {
|
|
|
71
88
|
}
|
|
72
89
|
};
|
|
73
90
|
exports.getRenderCommand = getRenderCommand;
|
|
74
|
-
const
|
|
91
|
+
const getRunCommand = (manager) => {
|
|
75
92
|
if (manager === 'npm') {
|
|
76
|
-
return `npm run
|
|
93
|
+
return `npm run`;
|
|
77
94
|
}
|
|
78
95
|
if (manager === 'yarn') {
|
|
79
|
-
return `yarn run
|
|
96
|
+
return `yarn run`;
|
|
80
97
|
}
|
|
81
98
|
if (manager === 'pnpm') {
|
|
82
|
-
return `pnpm run
|
|
99
|
+
return `pnpm run`;
|
|
100
|
+
}
|
|
101
|
+
throw new TypeError('unknown package manager');
|
|
102
|
+
};
|
|
103
|
+
exports.getRunCommand = getRunCommand;
|
|
104
|
+
const getPackageManagerVersion = (manager) => {
|
|
105
|
+
const cmd = `${manager} -v`;
|
|
106
|
+
return new Promise((resolve, reject) => {
|
|
107
|
+
(0, child_process_1.exec)(cmd, (error, stdout, stderr) => {
|
|
108
|
+
if (error) {
|
|
109
|
+
reject(error);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (stderr) {
|
|
113
|
+
reject(stderr);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
resolve(stdout.trim());
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
exports.getPackageManagerVersion = getPackageManagerVersion;
|
|
121
|
+
const getPackageManagerVersionOrNull = async (manager) => {
|
|
122
|
+
try {
|
|
123
|
+
const version = await (0, exports.getPackageManagerVersion)(manager);
|
|
124
|
+
return version;
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
console.warn(`Could not determine the version of ${manager}.`);
|
|
128
|
+
return null;
|
|
83
129
|
}
|
|
84
130
|
};
|
|
85
|
-
exports.
|
|
131
|
+
exports.getPackageManagerVersionOrNull = getPackageManagerVersionOrNull;
|
package/dist/prompts.d.ts
CHANGED
|
File without changes
|
package/dist/prompts.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/select-template.js
CHANGED
|
File without changes
|
package/dist/strip-ansi.d.ts
CHANGED
|
File without changes
|
package/dist/strip-ansi.js
CHANGED
|
File without changes
|
package/dist/templates.d.ts
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
org: string;
|
|
5
|
-
repoName: string;
|
|
6
|
-
homePageLabel: string;
|
|
7
|
-
longerDescription: string;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type DynamicTemplate = {
|
|
3
|
+
type: 'video';
|
|
8
4
|
promoVideo: {
|
|
9
5
|
muxId: string;
|
|
10
6
|
width: number;
|
|
11
7
|
height: number;
|
|
12
8
|
};
|
|
13
|
-
|
|
9
|
+
} | {
|
|
10
|
+
type: 'image';
|
|
11
|
+
promoBanner: {
|
|
12
|
+
src: string;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
14
16
|
};
|
|
17
|
+
export declare type Template = {
|
|
18
|
+
shortName: string;
|
|
19
|
+
description: string;
|
|
20
|
+
org: string;
|
|
21
|
+
repoName: string;
|
|
22
|
+
homePageLabel: string;
|
|
23
|
+
longerDescription: React.ReactNode;
|
|
24
|
+
cliId: 'hello-world' | 'javascript' | 'blank' | 'next' | 'remix' | 'three' | 'still' | 'tts' | 'gtts' | 'audiogram' | 'skia' | 'tailwind' | 'overlay';
|
|
25
|
+
defaultBranch: string;
|
|
26
|
+
} & DynamicTemplate;
|
|
15
27
|
export declare const FEATURED_TEMPLATES: Template[];
|
|
28
|
+
export {};
|