create-video 4.0.213 → 4.0.215
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/dist/add-tailwind.d.ts +4 -0
- package/dist/add-tailwind.js +69 -0
- package/dist/ask-tailwind.d.ts +1 -0
- package/dist/ask-tailwind.js +19 -0
- package/dist/degit.js +2 -2
- package/dist/hyperlinks/is-supported.js +1 -2
- package/dist/init.d.ts +3 -3
- package/dist/init.js +29 -62
- package/dist/log.d.ts +3 -3
- package/dist/log.js +1 -1
- package/dist/mkdirp.js +1 -2
- package/dist/open-in-editor-flow.js +1 -2
- package/dist/open-in-editor.d.ts +1 -1
- package/dist/open-in-editor.js +4 -4
- package/dist/patch-package-json.d.ts +3 -2
- package/dist/patch-package-json.js +10 -4
- package/dist/pkg-managers.d.ts +1 -2
- package/dist/pkg-managers.js +14 -23
- package/dist/prompts.d.ts +3 -10
- package/dist/prompts.js +5 -12
- package/dist/resolve-project-root.d.ts +4 -4
- package/dist/resolve-project-root.js +10 -1
- package/dist/select-template.d.ts +1 -0
- package/dist/select-template.js +11 -43
- package/dist/templates.d.ts +4 -2
- package/dist/templates.js +45 -19
- package/dist/test/git-status.test.js +5 -5
- package/dist/test/patch-package-json.test.js +7 -6
- package/dist/validate-name.js +1 -2
- package/package.json +3 -4
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const addTailwindStyleCss: (projectRoot: string) => void;
|
|
2
|
+
export declare const addTailwindConfigJs: (projectRoot: string) => void;
|
|
3
|
+
export declare const addTailwindRootCss: (projectRoot: string) => void;
|
|
4
|
+
export declare const addTailwindToConfig: (projectRoot: string) => void;
|
|
@@ -0,0 +1,69 @@
|
|
|
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.addTailwindToConfig = exports.addTailwindRootCss = exports.addTailwindConfigJs = exports.addTailwindStyleCss = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const addTailwindStyleCss = (projectRoot) => {
|
|
10
|
+
const styleFile = path_1.default.join(projectRoot, 'src', 'tailwind.css');
|
|
11
|
+
fs_1.default.writeFileSync(styleFile, `@tailwind base;
|
|
12
|
+
@tailwind components;
|
|
13
|
+
@tailwind utilities;
|
|
14
|
+
`);
|
|
15
|
+
};
|
|
16
|
+
exports.addTailwindStyleCss = addTailwindStyleCss;
|
|
17
|
+
const addTailwindConfigJs = (projectRoot) => {
|
|
18
|
+
const tailwindConfigFile = path_1.default.join(projectRoot, 'tailwind.config.js');
|
|
19
|
+
fs_1.default.writeFileSync(tailwindConfigFile, `/* eslint-env node */
|
|
20
|
+
module.exports = {
|
|
21
|
+
content: ["./src/**/*.{ts,tsx,js,jsx}"],
|
|
22
|
+
theme: {
|
|
23
|
+
extend: {},
|
|
24
|
+
},
|
|
25
|
+
plugins: [],
|
|
26
|
+
};
|
|
27
|
+
`);
|
|
28
|
+
};
|
|
29
|
+
exports.addTailwindConfigJs = addTailwindConfigJs;
|
|
30
|
+
const addTailwindRootCss = (projectRoot) => {
|
|
31
|
+
const rootFileTsx = path_1.default.join(projectRoot, 'src', 'Root.tsx');
|
|
32
|
+
const rootFileJsx = path_1.default.join(projectRoot, 'src', 'Root.jsx');
|
|
33
|
+
const rootFile = fs_1.default.existsSync(rootFileTsx) ? rootFileTsx : rootFileJsx;
|
|
34
|
+
if (!fs_1.default.existsSync(rootFile)) {
|
|
35
|
+
throw new Error('No Root file found');
|
|
36
|
+
}
|
|
37
|
+
const root = fs_1.default.readFileSync(rootFile, 'utf-8');
|
|
38
|
+
const newFile = `import './tailwind.css';\n${root}`;
|
|
39
|
+
fs_1.default.writeFileSync(rootFile, newFile);
|
|
40
|
+
};
|
|
41
|
+
exports.addTailwindRootCss = addTailwindRootCss;
|
|
42
|
+
const addTailwindToConfig = (projectRoot) => {
|
|
43
|
+
const configFileTs = path_1.default.join(projectRoot, 'remotion.config.ts');
|
|
44
|
+
const configFileJs = path_1.default.join(projectRoot, 'remotion.config.js');
|
|
45
|
+
const configFile = fs_1.default.existsSync(configFileTs) ? configFileTs : configFileJs;
|
|
46
|
+
if (!fs_1.default.existsSync(configFile)) {
|
|
47
|
+
throw new Error('No remotion.config.ts file found');
|
|
48
|
+
}
|
|
49
|
+
const config = fs_1.default.readFileSync(configFile, 'utf-8');
|
|
50
|
+
const lines = config.trim().split('\n');
|
|
51
|
+
let lineNo = 0;
|
|
52
|
+
let lastImportLine = 0;
|
|
53
|
+
for (const line of lines) {
|
|
54
|
+
if (line.startsWith('import ')) {
|
|
55
|
+
lastImportLine = lineNo;
|
|
56
|
+
}
|
|
57
|
+
lineNo++;
|
|
58
|
+
}
|
|
59
|
+
const headerLines = lines.slice(0, lastImportLine + 1);
|
|
60
|
+
const tailLines = lines.slice(lastImportLine + 1);
|
|
61
|
+
const newLines = [
|
|
62
|
+
...headerLines,
|
|
63
|
+
`import { enableTailwind } from '@remotion/tailwind';`,
|
|
64
|
+
...tailLines,
|
|
65
|
+
'Config.overrideWebpackConfig(enableTailwind);',
|
|
66
|
+
];
|
|
67
|
+
fs_1.default.writeFileSync(configFile, newLines.join('\n') + '\n');
|
|
68
|
+
};
|
|
69
|
+
exports.addTailwindToConfig = addTailwindToConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const askTailwind: () => Promise<boolean>;
|
|
@@ -0,0 +1,19 @@
|
|
|
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.askTailwind = void 0;
|
|
7
|
+
const prompts_1 = __importDefault(require("./prompts"));
|
|
8
|
+
const askTailwind = async () => {
|
|
9
|
+
const { answer } = await (0, prompts_1.default)({
|
|
10
|
+
type: 'toggle',
|
|
11
|
+
name: 'answer',
|
|
12
|
+
message: 'Add TailwindCSS?',
|
|
13
|
+
initial: true,
|
|
14
|
+
active: 'Yes',
|
|
15
|
+
inactive: 'No',
|
|
16
|
+
});
|
|
17
|
+
return answer;
|
|
18
|
+
};
|
|
19
|
+
exports.askTailwind = askTailwind;
|
package/dist/degit.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.degit =
|
|
6
|
+
exports.degit = void 0;
|
|
7
|
+
exports.fetch = fetch;
|
|
7
8
|
const https_1 = __importDefault(require("https"));
|
|
8
9
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
10
|
const node_os_1 = require("node:os");
|
|
@@ -33,7 +34,6 @@ function fetch(url, dest) {
|
|
|
33
34
|
.on('error', reject);
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
|
-
exports.fetch = fetch;
|
|
37
37
|
function untar(file, dest) {
|
|
38
38
|
return tar_1.default.extract({
|
|
39
39
|
file,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// From https://github.com/jamestalmage/supports-hyperlinks/blob/master/index.js
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.supportsHyperlink =
|
|
4
|
+
exports.supportsHyperlink = supportsHyperlink;
|
|
5
5
|
// MIT License
|
|
6
6
|
// Copyright (c) James Talmage <james@talmage.io> (github.com/jamestalmage)
|
|
7
7
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
@@ -72,4 +72,3 @@ function supportsHyperlink() {
|
|
|
72
72
|
}
|
|
73
73
|
return false;
|
|
74
74
|
}
|
|
75
|
-
exports.supportsHyperlink = supportsHyperlink;
|
package/dist/init.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const checkGitAvailability: (cwd: string, commandToCheck: string, argsToCheck: string[]) => Promise<{
|
|
2
|
-
type:
|
|
2
|
+
type: "no-git-repo";
|
|
3
3
|
} | {
|
|
4
|
-
type:
|
|
4
|
+
type: "is-git-repo";
|
|
5
5
|
location: string;
|
|
6
6
|
} | {
|
|
7
|
-
type:
|
|
7
|
+
type: "git-not-installed";
|
|
8
8
|
}>;
|
|
9
9
|
export declare const init: () => Promise<void>;
|
package/dist/init.js
CHANGED
|
@@ -7,7 +7,9 @@ exports.init = exports.checkGitAvailability = void 0;
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const execa_1 = __importDefault(require("execa"));
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const add_tailwind_1 = require("./add-tailwind");
|
|
10
11
|
const add_yarn2_support_1 = require("./add-yarn2-support");
|
|
12
|
+
const ask_tailwind_1 = require("./ask-tailwind");
|
|
11
13
|
const degit_1 = require("./degit");
|
|
12
14
|
const latest_remotion_version_1 = require("./latest-remotion-version");
|
|
13
15
|
const log_1 = require("./log");
|
|
@@ -65,10 +67,10 @@ const getGitStatus = async (root) => {
|
|
|
65
67
|
}
|
|
66
68
|
};
|
|
67
69
|
const init = async () => {
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
]);
|
|
70
|
+
log_1.Log.info(`Welcome to ${chalk_1.default.blue('Remotion')}!`);
|
|
71
|
+
const { projectRoot, folderName } = await (0, resolve_project_root_1.resolveProjectRoot)();
|
|
72
|
+
log_1.Log.info();
|
|
73
|
+
const result = await (0, exports.checkGitAvailability)(projectRoot, 'git', ['--version']);
|
|
72
74
|
if (result.type === 'git-not-installed') {
|
|
73
75
|
log_1.Log.error('Git is not installed or not in the path. Install Git to continue.');
|
|
74
76
|
process.exit(1);
|
|
@@ -79,13 +81,12 @@ const init = async () => {
|
|
|
79
81
|
question: `You are already inside a Git repo (${node_path_1.default.resolve(result.location)}).\nThis might lead to a Git Submodule being created. Do you want to continue? (y/N):`,
|
|
80
82
|
});
|
|
81
83
|
if (!should) {
|
|
82
|
-
log_1.Log.error('Aborting.');
|
|
83
84
|
process.exit(1);
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
const [projectRoot, folderName] = await (0, resolve_project_root_1.resolveProjectRoot)();
|
|
87
87
|
const latestRemotionVersionPromise = (0, latest_remotion_version_1.getLatestRemotionVersion)();
|
|
88
88
|
const selectedTemplate = await (0, select_template_1.selectTemplate)();
|
|
89
|
+
const shouldOverrideTailwind = selectedTemplate ? await (0, ask_tailwind_1.askTailwind)() : false;
|
|
89
90
|
const pkgManager = (0, pkg_managers_1.selectPackageManager)();
|
|
90
91
|
const pkgManagerVersion = await (0, pkg_managers_1.getPackageManagerVersionOrNull)(pkgManager);
|
|
91
92
|
try {
|
|
@@ -95,14 +96,19 @@ const init = async () => {
|
|
|
95
96
|
dest: projectRoot,
|
|
96
97
|
});
|
|
97
98
|
(0, patch_readme_1.patchReadmeMd)(projectRoot, pkgManager, selectedTemplate);
|
|
99
|
+
if (shouldOverrideTailwind) {
|
|
100
|
+
(0, add_tailwind_1.addTailwindStyleCss)(projectRoot);
|
|
101
|
+
(0, add_tailwind_1.addTailwindToConfig)(projectRoot);
|
|
102
|
+
(0, add_tailwind_1.addTailwindConfigJs)(projectRoot);
|
|
103
|
+
(0, add_tailwind_1.addTailwindRootCss)(projectRoot);
|
|
104
|
+
}
|
|
98
105
|
const latestVersion = await latestRemotionVersionPromise;
|
|
99
106
|
(0, patch_package_json_1.patchPackageJson)({
|
|
100
107
|
projectRoot,
|
|
101
108
|
projectName: folderName,
|
|
102
109
|
latestRemotionVersion: latestVersion,
|
|
103
|
-
packageManager:
|
|
104
|
-
|
|
105
|
-
: null,
|
|
110
|
+
packageManager: pkgManager,
|
|
111
|
+
addTailwind: shouldOverrideTailwind,
|
|
106
112
|
});
|
|
107
113
|
}
|
|
108
114
|
catch (e) {
|
|
@@ -110,69 +116,30 @@ const init = async () => {
|
|
|
110
116
|
log_1.Log.error('Error with template cloning. Aborting');
|
|
111
117
|
process.exit(1);
|
|
112
118
|
}
|
|
113
|
-
log_1.Log.info(`Copied ${chalk_1.default.blueBright(selectedTemplate.shortName)} to ${chalk_1.default.blueBright(folderName)}. Installing dependencies...`);
|
|
114
119
|
(0, add_yarn2_support_1.createYarnYmlFile)({
|
|
115
120
|
pkgManager,
|
|
116
121
|
pkgManagerVersion,
|
|
117
122
|
projectRoot,
|
|
118
123
|
});
|
|
119
|
-
if (pkgManager === 'yarn') {
|
|
120
|
-
log_1.Log.info('> yarn');
|
|
121
|
-
const promise = (0, execa_1.default)('yarn', [], {
|
|
122
|
-
cwd: projectRoot,
|
|
123
|
-
stdio: 'inherit',
|
|
124
|
-
env: { ...process.env, ADBLOCK: '1', DISABLE_OPENCOLLECTIVE: '1' },
|
|
125
|
-
});
|
|
126
|
-
(_a = promise.stderr) === null || _a === void 0 ? void 0 : _a.pipe(process.stderr);
|
|
127
|
-
(_b = promise.stdout) === null || _b === void 0 ? void 0 : _b.pipe(process.stdout);
|
|
128
|
-
await promise;
|
|
129
|
-
}
|
|
130
|
-
else if (pkgManager === 'pnpm') {
|
|
131
|
-
log_1.Log.info('> pnpm i');
|
|
132
|
-
const promise = (0, execa_1.default)('pnpm', ['i'], {
|
|
133
|
-
cwd: projectRoot,
|
|
134
|
-
stdio: 'inherit',
|
|
135
|
-
env: { ...process.env, ADBLOCK: '1', DISABLE_OPENCOLLECTIVE: '1' },
|
|
136
|
-
});
|
|
137
|
-
(_c = promise.stderr) === null || _c === void 0 ? void 0 : _c.pipe(process.stderr);
|
|
138
|
-
(_d = promise.stdout) === null || _d === void 0 ? void 0 : _d.pipe(process.stdout);
|
|
139
|
-
await promise;
|
|
140
|
-
}
|
|
141
|
-
else if (pkgManager === 'bun') {
|
|
142
|
-
log_1.Log.info('> bun install');
|
|
143
|
-
const promise = (0, execa_1.default)('bun', ['install'], {
|
|
144
|
-
cwd: projectRoot,
|
|
145
|
-
stdio: 'inherit',
|
|
146
|
-
env: { ...process.env, ADBLOCK: '1', DISABLE_OPENCOLLECTIVE: '1' },
|
|
147
|
-
});
|
|
148
|
-
(_e = promise.stderr) === null || _e === void 0 ? void 0 : _e.pipe(process.stderr);
|
|
149
|
-
(_f = promise.stdout) === null || _f === void 0 ? void 0 : _f.pipe(process.stdout);
|
|
150
|
-
await promise;
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
log_1.Log.info('> npm install');
|
|
154
|
-
const promise = (0, execa_1.default)('npm', ['install', '--no-fund', '--no-audit'], {
|
|
155
|
-
stdio: 'inherit',
|
|
156
|
-
cwd: projectRoot,
|
|
157
|
-
env: { ...process.env, ADBLOCK: '1', DISABLE_OPENCOLLECTIVE: '1' },
|
|
158
|
-
});
|
|
159
|
-
(_g = promise.stderr) === null || _g === void 0 ? void 0 : _g.pipe(process.stderr);
|
|
160
|
-
(_h = promise.stdout) === null || _h === void 0 ? void 0 : _h.pipe(process.stdout);
|
|
161
|
-
await promise;
|
|
162
|
-
}
|
|
163
124
|
await getGitStatus(projectRoot);
|
|
125
|
+
const relativeToCurrent = node_path_1.default.relative(process.cwd(), projectRoot);
|
|
126
|
+
const cdToFolder = relativeToCurrent.startsWith('.')
|
|
127
|
+
? projectRoot
|
|
128
|
+
: relativeToCurrent;
|
|
164
129
|
log_1.Log.info();
|
|
165
|
-
log_1.Log.info(`
|
|
166
|
-
log_1.Log.info(
|
|
167
|
-
|
|
168
|
-
log_1.Log.info('
|
|
169
|
-
log_1.Log.info(chalk_1.default.
|
|
170
|
-
log_1.Log.info(chalk_1.default.
|
|
130
|
+
log_1.Log.info(`Copied ${chalk_1.default.blue(selectedTemplate.shortName)} to ${chalk_1.default.blue(cdToFolder)}.`);
|
|
131
|
+
log_1.Log.info();
|
|
132
|
+
log_1.Log.info('Get started by running:');
|
|
133
|
+
log_1.Log.info(' ' + chalk_1.default.blue(`cd ${cdToFolder}`));
|
|
134
|
+
log_1.Log.info(' ' + chalk_1.default.blue((0, pkg_managers_1.getInstallCommand)(pkgManager)));
|
|
135
|
+
log_1.Log.info(' ' + chalk_1.default.blue((0, pkg_managers_1.getDevCommand)(pkgManager, selectedTemplate)));
|
|
171
136
|
log_1.Log.info('');
|
|
172
|
-
log_1.Log.info('To render a video, run');
|
|
173
|
-
log_1.Log.info(chalk_1.default.
|
|
137
|
+
log_1.Log.info('To render a video, run:');
|
|
138
|
+
log_1.Log.info(' ' + chalk_1.default.blue((0, pkg_managers_1.getRenderCommand)(pkgManager)));
|
|
174
139
|
log_1.Log.info('');
|
|
175
140
|
log_1.Log.info('Docs to get you started:', chalk_1.default.underline('https://www.remotion.dev/docs/the-fundamentals'));
|
|
141
|
+
log_1.Log.info();
|
|
142
|
+
await (0, open_in_editor_flow_1.openInEditorFlow)(projectRoot);
|
|
176
143
|
log_1.Log.info('Enjoy Remotion!');
|
|
177
144
|
};
|
|
178
145
|
exports.init = init;
|
package/dist/log.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
export declare const Log: {
|
|
3
3
|
chalk: chalk.Chalk & chalk.ChalkFunction & {
|
|
4
|
-
supportsColor:
|
|
4
|
+
supportsColor: chalk.ColorSupport | false;
|
|
5
5
|
Level: chalk.Level;
|
|
6
6
|
Color: ("black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright") | ("bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright");
|
|
7
7
|
ForegroundColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
|
|
8
8
|
BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright";
|
|
9
|
-
Modifiers: "
|
|
9
|
+
Modifiers: "bold" | "reset" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "visible";
|
|
10
10
|
stderr: chalk.Chalk & {
|
|
11
|
-
supportsColor:
|
|
11
|
+
supportsColor: chalk.ColorSupport | false;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
verbose: (...args: Parameters<typeof console.log>) => void;
|
package/dist/log.js
CHANGED
|
@@ -9,7 +9,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
9
9
|
exports.Log = {
|
|
10
10
|
chalk: chalk_1.default,
|
|
11
11
|
verbose: (...args) => {
|
|
12
|
-
return console.log(chalk_1.default.
|
|
12
|
+
return console.log(chalk_1.default.blue(...args));
|
|
13
13
|
},
|
|
14
14
|
info: (...args) => {
|
|
15
15
|
return console.log(...args);
|
package/dist/mkdirp.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.mkdirp =
|
|
6
|
+
exports.mkdirp = mkdirp;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
function mkdirp(dir) {
|
|
@@ -19,4 +19,3 @@ function mkdirp(dir) {
|
|
|
19
19
|
throw err;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
exports.mkdirp = mkdirp;
|
|
@@ -17,7 +17,7 @@ const openInEditorFlow = async (projectRoot) => {
|
|
|
17
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
|
-
question: `💻
|
|
20
|
+
question: `💻 Open in ${displayName}? (Y/n):`,
|
|
21
21
|
});
|
|
22
22
|
if (should) {
|
|
23
23
|
await (0, open_in_editor_1.launchEditor)({
|
|
@@ -39,7 +39,6 @@ const openInEditorFlow = async (projectRoot) => {
|
|
|
39
39
|
lineNumber: 1,
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
log_1.Log.info(`Opened in ${displayName}.`);
|
|
43
42
|
}
|
|
44
43
|
log_1.Log.info();
|
|
45
44
|
};
|
package/dist/open-in-editor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const isVsCodeDerivative: (editor: Editor) =>
|
|
1
|
+
export declare const isVsCodeDerivative: (editor: Editor) => editor is "code" | "code-insiders" | "vscodium" | "Code.exe" | "Code - Insiders.exe" | "VSCodium.exe";
|
|
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
4
|
export declare const getDisplayNameForEditor: (editor: Editor) => string;
|
package/dist/open-in-editor.js
CHANGED
|
@@ -27,7 +27,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.
|
|
30
|
+
exports.getDisplayNameForEditor = exports.isVsCodeDerivative = void 0;
|
|
31
|
+
exports.isTerminalEditor = isTerminalEditor;
|
|
32
|
+
exports.guessEditor = guessEditor;
|
|
33
|
+
exports.launchEditor = launchEditor;
|
|
31
34
|
const node_child_process_1 = __importStar(require("node:child_process"));
|
|
32
35
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
33
36
|
const node_os_1 = __importDefault(require("node:os"));
|
|
@@ -53,7 +56,6 @@ function isTerminalEditor(editor) {
|
|
|
53
56
|
return false;
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
|
-
exports.isTerminalEditor = isTerminalEditor;
|
|
57
59
|
const editorNames = [
|
|
58
60
|
'atom',
|
|
59
61
|
'/Applications/Atom Beta.app/Contents/MacOS/Atom Beta',
|
|
@@ -384,7 +386,6 @@ async function guessEditor() {
|
|
|
384
386
|
}
|
|
385
387
|
return [];
|
|
386
388
|
}
|
|
387
|
-
exports.guessEditor = guessEditor;
|
|
388
389
|
let _childProcess = null;
|
|
389
390
|
async function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow, }) {
|
|
390
391
|
if (!node_fs_1.default.existsSync(fileName)) {
|
|
@@ -478,4 +479,3 @@ async function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNew
|
|
|
478
479
|
});
|
|
479
480
|
return true;
|
|
480
481
|
}
|
|
481
|
-
exports.launchEditor = launchEditor;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { PackageManager } from './pkg-managers';
|
|
2
|
-
export declare const patchPackageJson: ({ projectRoot, projectName, latestRemotionVersion, packageManager, }: {
|
|
2
|
+
export declare const patchPackageJson: ({ projectRoot, projectName, latestRemotionVersion, packageManager, addTailwind, }: {
|
|
3
3
|
projectRoot: string;
|
|
4
4
|
projectName: string;
|
|
5
5
|
latestRemotionVersion: string;
|
|
6
|
-
packageManager:
|
|
6
|
+
packageManager: PackageManager;
|
|
7
|
+
addTailwind: boolean;
|
|
7
8
|
}, { getPackageJson, setPackageJson, }?: {
|
|
8
9
|
getPackageJson?: ((filename: string) => string) | undefined;
|
|
9
10
|
setPackageJson?: ((filename: string, content: string) => void) | undefined;
|
|
@@ -7,7 +7,7 @@ exports.patchPackageJson = void 0;
|
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const list_of_remotion_packages_1 = require("./list-of-remotion-packages");
|
|
10
|
-
const patchPackageJson = ({ projectRoot, projectName, latestRemotionVersion, packageManager, }, { getPackageJson = (filename) => node_fs_1.default.readFileSync(filename, 'utf-8'), setPackageJson = (filename, content) => node_fs_1.default.writeFileSync(filename, content), } = {}) => {
|
|
10
|
+
const patchPackageJson = ({ projectRoot, projectName, latestRemotionVersion, packageManager, addTailwind, }, { getPackageJson = (filename) => node_fs_1.default.readFileSync(filename, 'utf-8'), setPackageJson = (filename, content) => node_fs_1.default.writeFileSync(filename, content), } = {}) => {
|
|
11
11
|
const fileName = node_path_1.default.join(projectRoot, 'package.json');
|
|
12
12
|
const contents = getPackageJson(fileName);
|
|
13
13
|
const packageJson = JSON.parse(contents);
|
|
@@ -35,16 +35,22 @@ const patchPackageJson = ({ projectRoot, projectName, latestRemotionVersion, pac
|
|
|
35
35
|
};
|
|
36
36
|
// update scripts to use "remotionb" instead of "remotion" if Bun is used
|
|
37
37
|
// matching '@' as well to prevent conflicts with similarly named packages.
|
|
38
|
-
const newScripts =
|
|
38
|
+
const newScripts = packageManager.startsWith('bun')
|
|
39
39
|
? updateScripts(scripts)
|
|
40
40
|
: scripts;
|
|
41
|
+
const newDependenciesWithTailwind = addTailwind
|
|
42
|
+
? {
|
|
43
|
+
...newDependencies,
|
|
44
|
+
'@remotion/tailwind': latestRemotionVersion,
|
|
45
|
+
}
|
|
46
|
+
: newDependencies;
|
|
41
47
|
const newPackageJson = JSON.stringify({
|
|
42
48
|
name: projectName,
|
|
43
49
|
...others,
|
|
44
|
-
dependencies:
|
|
50
|
+
dependencies: newDependenciesWithTailwind,
|
|
45
51
|
devDependencies: newDevDependencies,
|
|
46
52
|
scripts: newScripts,
|
|
47
|
-
...(
|
|
53
|
+
...(addTailwind ? { sideEffects: ['*.css'] } : {}),
|
|
48
54
|
}, undefined, 2);
|
|
49
55
|
setPackageJson(fileName, newPackageJson);
|
|
50
56
|
};
|
package/dist/pkg-managers.d.ts
CHANGED
|
@@ -2,9 +2,8 @@ import type { Template } from './templates';
|
|
|
2
2
|
export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';
|
|
3
3
|
export declare const selectPackageManager: () => PackageManager;
|
|
4
4
|
export declare const getInstallCommand: (manager: PackageManager) => "yarn" | "npm i" | "pnpm i" | "bun install" | undefined;
|
|
5
|
-
export declare const getRenderCommand: (manager: PackageManager) => "npm run build" | "yarn build" | "pnpm build" | "bun run build" | undefined;
|
|
6
5
|
export declare const getRunCommand: (manager: PackageManager) => "npm run" | "yarn run" | "pnpm run" | "bun run";
|
|
6
|
+
export declare const getRenderCommand: (manager: PackageManager) => "npx remotion render" | "yarn remotion render" | "pnpm exec remotion render" | "bunx remotion render";
|
|
7
7
|
export declare const getDevCommand: (manager: PackageManager, template: Template) => string | undefined;
|
|
8
|
-
export declare const getRenderCommandForTemplate: (manager: PackageManager, template: Template) => string | undefined;
|
|
9
8
|
export declare const getPackageManagerVersion: (manager: PackageManager) => Promise<string>;
|
|
10
9
|
export declare const getPackageManagerVersionOrNull: (manager: PackageManager) => Promise<string | null>;
|
package/dist/pkg-managers.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.getPackageManagerVersionOrNull = exports.getPackageManagerVersion = exports.
|
|
6
|
+
exports.getPackageManagerVersionOrNull = exports.getPackageManagerVersion = exports.getDevCommand = exports.getRenderCommand = exports.getRunCommand = exports.getInstallCommand = exports.selectPackageManager = void 0;
|
|
7
7
|
const node_child_process_1 = require("node:child_process");
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const shouldUseBun = () => {
|
|
@@ -76,37 +76,38 @@ const getStartCommand = (manager) => {
|
|
|
76
76
|
return `bun start`;
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
|
-
const
|
|
79
|
+
const getRunCommand = (manager) => {
|
|
80
80
|
if (manager === 'npm') {
|
|
81
|
-
return `npm run
|
|
81
|
+
return `npm run`;
|
|
82
82
|
}
|
|
83
83
|
if (manager === 'yarn') {
|
|
84
|
-
return `yarn
|
|
84
|
+
return `yarn run`;
|
|
85
85
|
}
|
|
86
86
|
if (manager === 'pnpm') {
|
|
87
|
-
return `pnpm
|
|
87
|
+
return `pnpm run`;
|
|
88
88
|
}
|
|
89
89
|
if (manager === 'bun') {
|
|
90
|
-
return `bun run
|
|
90
|
+
return `bun run`;
|
|
91
91
|
}
|
|
92
|
+
throw new TypeError('unknown package manager');
|
|
92
93
|
};
|
|
93
|
-
exports.
|
|
94
|
-
const
|
|
94
|
+
exports.getRunCommand = getRunCommand;
|
|
95
|
+
const getRenderCommand = (manager) => {
|
|
95
96
|
if (manager === 'npm') {
|
|
96
|
-
return `
|
|
97
|
+
return `npx remotion render`;
|
|
97
98
|
}
|
|
98
99
|
if (manager === 'yarn') {
|
|
99
|
-
return `yarn
|
|
100
|
+
return `yarn remotion render`;
|
|
100
101
|
}
|
|
101
102
|
if (manager === 'pnpm') {
|
|
102
|
-
return `pnpm
|
|
103
|
+
return `pnpm exec remotion render`;
|
|
103
104
|
}
|
|
104
105
|
if (manager === 'bun') {
|
|
105
|
-
return `
|
|
106
|
+
return `bunx remotion render`;
|
|
106
107
|
}
|
|
107
108
|
throw new TypeError('unknown package manager');
|
|
108
109
|
};
|
|
109
|
-
exports.
|
|
110
|
+
exports.getRenderCommand = getRenderCommand;
|
|
110
111
|
const getDevCommand = (manager, template) => {
|
|
111
112
|
if (template.cliId === 'remix' ||
|
|
112
113
|
template.cliId === 'next' ||
|
|
@@ -117,16 +118,6 @@ const getDevCommand = (manager, template) => {
|
|
|
117
118
|
return getStartCommand(manager);
|
|
118
119
|
};
|
|
119
120
|
exports.getDevCommand = getDevCommand;
|
|
120
|
-
const getRenderCommandForTemplate = (manager, template) => {
|
|
121
|
-
if (template.cliId === 'remix') {
|
|
122
|
-
return `${(0, exports.getRunCommand)(manager)} remotion:render`;
|
|
123
|
-
}
|
|
124
|
-
if (template.cliId === 'still') {
|
|
125
|
-
return `${(0, exports.getRunCommand)(manager)} render`;
|
|
126
|
-
}
|
|
127
|
-
return (0, exports.getRenderCommand)(manager);
|
|
128
|
-
};
|
|
129
|
-
exports.getRenderCommandForTemplate = getRenderCommandForTemplate;
|
|
130
121
|
const getPackageManagerVersion = (manager) => {
|
|
131
122
|
const cmd = `${manager} -v`;
|
|
132
123
|
return new Promise((resolve, reject) => {
|
package/dist/prompts.d.ts
CHANGED
|
@@ -7,13 +7,6 @@ export type NamelessQuestion = Omit<Question<'value'>, 'name' | 'type'>;
|
|
|
7
7
|
type PromptOptions = {
|
|
8
8
|
nonInteractiveHelp?: string;
|
|
9
9
|
} & Options;
|
|
10
|
-
|
|
11
|
-
declare
|
|
12
|
-
|
|
13
|
-
title: string;
|
|
14
|
-
disabled: boolean;
|
|
15
|
-
value: undefined;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export default prompt;
|
|
19
|
-
export declare function selectAsync(questions: NamelessQuestion, options?: PromptOptions): Promise<unknown>;
|
|
10
|
+
export default function prompt(questions: Question, { nonInteractiveHelp, ...options }?: PromptOptions): Promise<prompts.Answers<string>>;
|
|
11
|
+
export declare function selectAsync(questions: NamelessQuestion): Promise<unknown>;
|
|
12
|
+
export {};
|
package/dist/prompts.js
CHANGED
|
@@ -3,24 +3,18 @@ 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.default = prompt;
|
|
7
|
+
exports.selectAsync = selectAsync;
|
|
7
8
|
const prompts_1 = __importDefault(require("prompts"));
|
|
8
9
|
function prompt(questions, { nonInteractiveHelp, ...options } = {}) {
|
|
9
|
-
|
|
10
|
-
return (0, prompts_1.default)(questions, {
|
|
10
|
+
return (0, prompts_1.default)([questions], {
|
|
11
11
|
onCancel() {
|
|
12
12
|
throw new Error();
|
|
13
13
|
},
|
|
14
14
|
...options,
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
prompt.separator = (title) => ({
|
|
19
|
-
title,
|
|
20
|
-
disabled: true,
|
|
21
|
-
value: undefined,
|
|
22
|
-
});
|
|
23
|
-
async function selectAsync(questions, options) {
|
|
17
|
+
async function selectAsync(questions) {
|
|
24
18
|
const { value } = await prompt({
|
|
25
19
|
limit: 11,
|
|
26
20
|
...questions,
|
|
@@ -100,7 +94,6 @@ async function selectAsync(questions, options) {
|
|
|
100
94
|
},
|
|
101
95
|
name: 'value',
|
|
102
96
|
type: 'select',
|
|
103
|
-
}
|
|
97
|
+
});
|
|
104
98
|
return value !== null && value !== void 0 ? value : null;
|
|
105
99
|
}
|
|
106
|
-
exports.selectAsync = selectAsync;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const resolveProjectRoot: () => Promise<
|
|
2
|
-
string
|
|
3
|
-
string
|
|
4
|
-
|
|
1
|
+
export declare const resolveProjectRoot: () => Promise<{
|
|
2
|
+
projectRoot: string;
|
|
3
|
+
folderName: string;
|
|
4
|
+
}>;
|
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.resolveProjectRoot = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_os_1 = require("node:os");
|
|
9
10
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
11
|
const log_1 = require("./log");
|
|
11
12
|
const mkdirp_1 = require("./mkdirp");
|
|
12
13
|
const prompts_1 = __importDefault(require("./prompts"));
|
|
14
|
+
const select_template_1 = require("./select-template");
|
|
13
15
|
const validate_name_1 = require("./validate-name");
|
|
14
16
|
function assertValidName(folderName) {
|
|
15
17
|
const validation = (0, validate_name_1.validateName)(folderName);
|
|
@@ -31,6 +33,13 @@ function assertFolderEmptyAsync(projectRoot) {
|
|
|
31
33
|
return { exists: false };
|
|
32
34
|
}
|
|
33
35
|
const resolveProjectRoot = async () => {
|
|
36
|
+
if ((0, select_template_1.isTmpFlagSelected)()) {
|
|
37
|
+
log_1.Log.info('Creating the video in a temporary directory.');
|
|
38
|
+
const randomName = `remotion-video-${Math.random().toString(36).slice(2)}`;
|
|
39
|
+
const randomRoot = node_path_1.default.join((0, node_os_1.tmpdir)(), randomName);
|
|
40
|
+
(0, mkdirp_1.mkdirp)(randomRoot);
|
|
41
|
+
return { projectRoot: randomRoot, folderName: randomName };
|
|
42
|
+
}
|
|
34
43
|
let projectName = '';
|
|
35
44
|
try {
|
|
36
45
|
const { answer } = await (0, prompts_1.default)({
|
|
@@ -63,6 +72,6 @@ const resolveProjectRoot = async () => {
|
|
|
63
72
|
if (assertFolderEmptyAsync(projectRoot).exists) {
|
|
64
73
|
return (0, exports.resolveProjectRoot)();
|
|
65
74
|
}
|
|
66
|
-
return
|
|
75
|
+
return { projectRoot, folderName };
|
|
67
76
|
};
|
|
68
77
|
exports.resolveProjectRoot = resolveProjectRoot;
|
package/dist/select-template.js
CHANGED
|
@@ -1,47 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.selectTemplate = void 0;
|
|
6
|
+
exports.selectTemplate = exports.isTmpFlagSelected = void 0;
|
|
30
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
31
8
|
const minimist_1 = __importDefault(require("minimist"));
|
|
32
9
|
const make_link_1 = require("./hyperlinks/make-link");
|
|
33
|
-
const prompts_1 =
|
|
34
|
-
const strip_ansi_1 = require("./strip-ansi");
|
|
10
|
+
const prompts_1 = require("./prompts");
|
|
35
11
|
const templates_1 = require("./templates");
|
|
36
12
|
const parsed = (0, minimist_1.default)(process.argv.slice(2), {
|
|
37
|
-
boolean: templates_1.FEATURED_TEMPLATES.map((f) => f.cliId),
|
|
13
|
+
boolean: [...templates_1.FEATURED_TEMPLATES.map((f) => f.cliId), 'tmp'],
|
|
38
14
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const len = Math.max(0, width - (0, strip_ansi_1.stripAnsi)(str).length);
|
|
42
|
-
return str + Array(len + 1).join(' ');
|
|
43
|
-
}
|
|
44
|
-
const descriptionColumn = Math.max(...templates_1.FEATURED_TEMPLATES.map((t) => typeof t === 'object' ? t.shortName.length : 0)) + 2;
|
|
15
|
+
const isTmpFlagSelected = () => parsed.tmp;
|
|
16
|
+
exports.isTmpFlagSelected = isTmpFlagSelected;
|
|
45
17
|
const selectTemplate = async () => {
|
|
46
18
|
const isFlagSelected = templates_1.FEATURED_TEMPLATES.find((f) => {
|
|
47
19
|
return parsed[f.cliId];
|
|
@@ -49,23 +21,19 @@ const selectTemplate = async () => {
|
|
|
49
21
|
if (isFlagSelected) {
|
|
50
22
|
return isFlagSelected;
|
|
51
23
|
}
|
|
52
|
-
|
|
24
|
+
return (await (0, prompts_1.selectAsync)({
|
|
53
25
|
message: 'Choose a template:',
|
|
54
26
|
optionsPerPage: 20,
|
|
55
27
|
choices: templates_1.FEATURED_TEMPLATES.map((template) => {
|
|
56
|
-
if (typeof template === 'string') {
|
|
57
|
-
return prompts_1.default.separator(template);
|
|
58
|
-
}
|
|
59
28
|
return {
|
|
60
29
|
value: template,
|
|
61
|
-
title: chalk_1.default.
|
|
62
|
-
text:
|
|
30
|
+
title: `${chalk_1.default.blue(template.shortName)}${chalk_1.default.reset(` ${chalk_1.default.gray(template.description.trim())} ${chalk_1.default.gray((0, make_link_1.makeHyperlink)({
|
|
31
|
+
text: '(?)',
|
|
63
32
|
url: `https://remotion.dev/templates/${template.cliId}`,
|
|
64
|
-
fallback:
|
|
65
|
-
})
|
|
33
|
+
fallback: '',
|
|
34
|
+
}))}`)}`,
|
|
66
35
|
};
|
|
67
36
|
}),
|
|
68
|
-
}
|
|
69
|
-
return selectedTemplate;
|
|
37
|
+
}));
|
|
70
38
|
};
|
|
71
39
|
exports.selectTemplate = selectTemplate;
|
package/dist/templates.d.ts
CHANGED
|
@@ -21,10 +21,12 @@ export type Template = {
|
|
|
21
21
|
repoName: string;
|
|
22
22
|
homePageLabel: string;
|
|
23
23
|
longerDescription: React.ReactNode;
|
|
24
|
-
cliId: 'hello-world' | 'javascript' | 'blank' | 'next' | 'next-tailwind' | 'next-pages-dir' | 'remix' | 'three' | 'still' | 'tts' | 'google-tts' | 'audiogram' | 'skia' | '
|
|
24
|
+
cliId: 'hello-world' | 'javascript' | 'blank' | 'next' | 'next-tailwind' | 'next-pages-dir' | 'remix' | 'three' | 'still' | 'tts' | 'google-tts' | 'audiogram' | 'skia' | 'overlay' | 'stargazer' | 'tiktok' | 'code-hike';
|
|
25
25
|
defaultBranch: string;
|
|
26
26
|
featuredOnHomePage: string | null;
|
|
27
|
-
previewURL
|
|
27
|
+
previewURL: string | null;
|
|
28
|
+
templateInMonorepo: string;
|
|
29
|
+
allowEnableTailwind: boolean;
|
|
28
30
|
} & DynamicTemplate;
|
|
29
31
|
export declare const FEATURED_TEMPLATES: Template[];
|
|
30
32
|
export {};
|
package/dist/templates.js
CHANGED
|
@@ -5,7 +5,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
function truthy(value) {
|
|
6
6
|
return Boolean(value);
|
|
7
7
|
}
|
|
8
|
-
// Note that this page is statically analyzed by extract-articles.mjs
|
|
9
8
|
exports.FEATURED_TEMPLATES = [
|
|
10
9
|
{
|
|
11
10
|
homePageLabel: 'Hello World',
|
|
@@ -24,6 +23,8 @@ exports.FEATURED_TEMPLATES = [
|
|
|
24
23
|
defaultBranch: 'main',
|
|
25
24
|
featuredOnHomePage: 'Hello World',
|
|
26
25
|
previewURL: 'https://remotion-helloworld.vercel.app/?/HelloWorld',
|
|
26
|
+
templateInMonorepo: 'template-helloworld',
|
|
27
|
+
allowEnableTailwind: true,
|
|
27
28
|
},
|
|
28
29
|
{
|
|
29
30
|
homePageLabel: 'Next.js (App dir)',
|
|
@@ -41,6 +42,9 @@ exports.FEATURED_TEMPLATES = [
|
|
|
41
42
|
type: 'video',
|
|
42
43
|
defaultBranch: 'main',
|
|
43
44
|
featuredOnHomePage: 'Next.js',
|
|
45
|
+
previewURL: null,
|
|
46
|
+
templateInMonorepo: 'template-next-app',
|
|
47
|
+
allowEnableTailwind: false,
|
|
44
48
|
},
|
|
45
49
|
{
|
|
46
50
|
homePageLabel: 'Next.js (App dir + TailwindCSS)',
|
|
@@ -58,6 +62,9 @@ exports.FEATURED_TEMPLATES = [
|
|
|
58
62
|
type: 'video',
|
|
59
63
|
defaultBranch: 'main',
|
|
60
64
|
featuredOnHomePage: null,
|
|
65
|
+
previewURL: null,
|
|
66
|
+
templateInMonorepo: 'template-next-app-tailwind',
|
|
67
|
+
allowEnableTailwind: false,
|
|
61
68
|
},
|
|
62
69
|
{
|
|
63
70
|
homePageLabel: 'Next.js (Pages dir)',
|
|
@@ -75,6 +82,9 @@ exports.FEATURED_TEMPLATES = [
|
|
|
75
82
|
type: 'video',
|
|
76
83
|
defaultBranch: 'main',
|
|
77
84
|
featuredOnHomePage: null,
|
|
85
|
+
previewURL: null,
|
|
86
|
+
templateInMonorepo: 'template-next-pages',
|
|
87
|
+
allowEnableTailwind: false,
|
|
78
88
|
},
|
|
79
89
|
{
|
|
80
90
|
homePageLabel: 'Blank',
|
|
@@ -93,6 +103,8 @@ exports.FEATURED_TEMPLATES = [
|
|
|
93
103
|
defaultBranch: 'main',
|
|
94
104
|
featuredOnHomePage: 'Blank',
|
|
95
105
|
previewURL: 'https://template-empty.vercel.app/?/MyComp',
|
|
106
|
+
templateInMonorepo: 'template-blank',
|
|
107
|
+
allowEnableTailwind: true,
|
|
96
108
|
},
|
|
97
109
|
{
|
|
98
110
|
homePageLabel: 'JavaScript',
|
|
@@ -111,6 +123,8 @@ exports.FEATURED_TEMPLATES = [
|
|
|
111
123
|
defaultBranch: 'main',
|
|
112
124
|
featuredOnHomePage: 'JavaScript',
|
|
113
125
|
previewURL: 'https://template-helloworld-javascript.vercel.app/?/HelloWorld',
|
|
126
|
+
templateInMonorepo: 'template-javascript',
|
|
127
|
+
allowEnableTailwind: true,
|
|
114
128
|
},
|
|
115
129
|
{
|
|
116
130
|
homePageLabel: 'Remix',
|
|
@@ -128,6 +142,9 @@ exports.FEATURED_TEMPLATES = [
|
|
|
128
142
|
type: 'image',
|
|
129
143
|
defaultBranch: 'main',
|
|
130
144
|
featuredOnHomePage: null,
|
|
145
|
+
previewURL: null,
|
|
146
|
+
templateInMonorepo: 'template-remix',
|
|
147
|
+
allowEnableTailwind: false,
|
|
131
148
|
},
|
|
132
149
|
{
|
|
133
150
|
homePageLabel: '3D',
|
|
@@ -146,6 +163,8 @@ exports.FEATURED_TEMPLATES = [
|
|
|
146
163
|
defaultBranch: 'main',
|
|
147
164
|
featuredOnHomePage: null,
|
|
148
165
|
previewURL: 'https://template-three-remotion.vercel.app/',
|
|
166
|
+
templateInMonorepo: 'template-three',
|
|
167
|
+
allowEnableTailwind: false,
|
|
149
168
|
},
|
|
150
169
|
{
|
|
151
170
|
homePageLabel: 'Stills',
|
|
@@ -164,6 +183,8 @@ exports.FEATURED_TEMPLATES = [
|
|
|
164
183
|
defaultBranch: 'main',
|
|
165
184
|
featuredOnHomePage: null,
|
|
166
185
|
previewURL: 'https://template-still.vercel.app/?/PreviewCard',
|
|
186
|
+
templateInMonorepo: 'template-still',
|
|
187
|
+
allowEnableTailwind: false,
|
|
167
188
|
},
|
|
168
189
|
{
|
|
169
190
|
homePageLabel: 'Text-To-Speech (Azure)',
|
|
@@ -181,6 +202,9 @@ exports.FEATURED_TEMPLATES = [
|
|
|
181
202
|
type: 'video',
|
|
182
203
|
defaultBranch: 'master',
|
|
183
204
|
featuredOnHomePage: null,
|
|
205
|
+
previewURL: null,
|
|
206
|
+
templateInMonorepo: 'template-tts-azure',
|
|
207
|
+
allowEnableTailwind: false,
|
|
184
208
|
},
|
|
185
209
|
{
|
|
186
210
|
homePageLabel: 'Text-To-Speech (Google)',
|
|
@@ -198,6 +222,9 @@ exports.FEATURED_TEMPLATES = [
|
|
|
198
222
|
type: 'video',
|
|
199
223
|
defaultBranch: 'master',
|
|
200
224
|
featuredOnHomePage: null,
|
|
225
|
+
previewURL: null,
|
|
226
|
+
templateInMonorepo: 'template-tts-google',
|
|
227
|
+
allowEnableTailwind: false,
|
|
201
228
|
},
|
|
202
229
|
{
|
|
203
230
|
homePageLabel: 'Audiogram',
|
|
@@ -215,6 +242,9 @@ exports.FEATURED_TEMPLATES = [
|
|
|
215
242
|
type: 'video',
|
|
216
243
|
defaultBranch: 'main',
|
|
217
244
|
featuredOnHomePage: null,
|
|
245
|
+
previewURL: null,
|
|
246
|
+
templateInMonorepo: 'template-audiogram',
|
|
247
|
+
allowEnableTailwind: true,
|
|
218
248
|
},
|
|
219
249
|
{
|
|
220
250
|
homePageLabel: 'Skia',
|
|
@@ -232,24 +262,9 @@ exports.FEATURED_TEMPLATES = [
|
|
|
232
262
|
type: 'video',
|
|
233
263
|
defaultBranch: 'main',
|
|
234
264
|
featuredOnHomePage: null,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
shortName: 'Tailwind',
|
|
239
|
-
org: 'remotion-dev',
|
|
240
|
-
repoName: 'template-tailwind',
|
|
241
|
-
description: 'TypeScript and Tailwind starter',
|
|
242
|
-
longerDescription: 'A starter template with TypeScript and Tailwind already set up.',
|
|
243
|
-
promoVideo: {
|
|
244
|
-
muxId: 'OAe00WUpvsAyqAVSd4gehDCeWI81cI024RhTs9l2eB48w',
|
|
245
|
-
height: 720,
|
|
246
|
-
width: 1280,
|
|
247
|
-
},
|
|
248
|
-
cliId: 'tailwind',
|
|
249
|
-
type: 'video',
|
|
250
|
-
defaultBranch: 'main',
|
|
251
|
-
featuredOnHomePage: null,
|
|
252
|
-
previewURL: 'https://template-tailwind-remotion.vercel.app/?/MyComp',
|
|
265
|
+
previewURL: null,
|
|
266
|
+
templateInMonorepo: 'template-skia',
|
|
267
|
+
allowEnableTailwind: false,
|
|
253
268
|
},
|
|
254
269
|
{
|
|
255
270
|
homePageLabel: 'Overlay',
|
|
@@ -267,6 +282,9 @@ exports.FEATURED_TEMPLATES = [
|
|
|
267
282
|
type: 'video',
|
|
268
283
|
defaultBranch: 'main',
|
|
269
284
|
featuredOnHomePage: null,
|
|
285
|
+
previewURL: null,
|
|
286
|
+
templateInMonorepo: 'template-overlay',
|
|
287
|
+
allowEnableTailwind: true,
|
|
270
288
|
},
|
|
271
289
|
{
|
|
272
290
|
homePageLabel: 'Code Hike',
|
|
@@ -285,6 +303,8 @@ exports.FEATURED_TEMPLATES = [
|
|
|
285
303
|
defaultBranch: 'main',
|
|
286
304
|
featuredOnHomePage: null,
|
|
287
305
|
previewURL: 'https://template-code-hike.vercel.app/',
|
|
306
|
+
templateInMonorepo: 'template-code-hike',
|
|
307
|
+
allowEnableTailwind: false,
|
|
288
308
|
},
|
|
289
309
|
{
|
|
290
310
|
homePageLabel: 'Stargazer',
|
|
@@ -302,6 +322,9 @@ exports.FEATURED_TEMPLATES = [
|
|
|
302
322
|
type: 'video',
|
|
303
323
|
defaultBranch: 'main',
|
|
304
324
|
featuredOnHomePage: null,
|
|
325
|
+
previewURL: null,
|
|
326
|
+
templateInMonorepo: 'template-stargazer',
|
|
327
|
+
allowEnableTailwind: true,
|
|
305
328
|
},
|
|
306
329
|
{
|
|
307
330
|
homePageLabel: 'TikTok',
|
|
@@ -319,5 +342,8 @@ exports.FEATURED_TEMPLATES = [
|
|
|
319
342
|
type: 'video',
|
|
320
343
|
defaultBranch: 'main',
|
|
321
344
|
featuredOnHomePage: null,
|
|
345
|
+
previewURL: null,
|
|
346
|
+
templateInMonorepo: 'template-tiktok',
|
|
347
|
+
allowEnableTailwind: true,
|
|
322
348
|
},
|
|
323
349
|
].filter(truthy);
|
|
@@ -3,17 +3,17 @@ 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
|
+
const bun_test_1 = require("bun:test");
|
|
6
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
7
|
-
const vitest_1 = require("vitest");
|
|
8
8
|
const init_1 = require("../init");
|
|
9
|
-
(0,
|
|
9
|
+
(0, bun_test_1.test)('Get git status', async () => {
|
|
10
10
|
const status = await (0, init_1.checkGitAvailability)(process.cwd(), 'git', [
|
|
11
11
|
'--version',
|
|
12
12
|
]);
|
|
13
13
|
if (status.type !== 'is-git-repo') {
|
|
14
14
|
throw new Error('is git repo');
|
|
15
15
|
}
|
|
16
|
-
(0,
|
|
16
|
+
(0, bun_test_1.expect)(status.location ===
|
|
17
17
|
node_path_1.default.posix.join(__dirname, '..', '..', '..', '..').replace(/\\/g, '/') ||
|
|
18
18
|
status.location ===
|
|
19
19
|
node_path_1.default.join(__dirname, '..', '..', '..', '..').replace(/\\/g, '/') ||
|
|
@@ -22,7 +22,7 @@ const init_1 = require("../init");
|
|
|
22
22
|
throw new Error('is git repo');
|
|
23
23
|
}
|
|
24
24
|
const status2 = await (0, init_1.checkGitAvailability)(node_path_1.default.dirname(status.location), 'git', ['--version']);
|
|
25
|
-
(0,
|
|
25
|
+
(0, bun_test_1.expect)(status2).toEqual({ type: 'no-git-repo' });
|
|
26
26
|
const status3 = await (0, init_1.checkGitAvailability)(node_path_1.default.dirname(status.location), 'wronggitbinary', ['--version']);
|
|
27
|
-
(0,
|
|
27
|
+
(0, bun_test_1.expect)(status3).toEqual({ type: 'git-not-installed' });
|
|
28
28
|
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
4
|
const patch_package_json_1 = require("../patch-package-json");
|
|
5
5
|
const packageManagers = ['npm', 'pnpm', 'yarn', 'bun'];
|
|
6
6
|
for (const packageManager of packageManagers) {
|
|
7
|
-
(0,
|
|
7
|
+
(0, bun_test_1.test)(`Using ${packageManager} package manager provides the correct "packageManager" entry in package.json`, () => {
|
|
8
8
|
const latestRemotionVersion = '1.0.0';
|
|
9
|
-
const packageManagerVersion = '1.22.19';
|
|
10
9
|
const packageJson = {
|
|
11
10
|
name: 'my-video',
|
|
12
11
|
version: '1.0.0',
|
|
@@ -28,8 +27,9 @@ for (const packageManager of packageManagers) {
|
|
|
28
27
|
(0, patch_package_json_1.patchPackageJson)({
|
|
29
28
|
projectRoot: '/path/to/project',
|
|
30
29
|
latestRemotionVersion,
|
|
31
|
-
packageManager
|
|
30
|
+
packageManager,
|
|
32
31
|
projectName: 'my-video',
|
|
32
|
+
addTailwind: true,
|
|
33
33
|
}, {
|
|
34
34
|
getPackageJson: () => JSON.stringify(packageJson),
|
|
35
35
|
setPackageJson: (_, content) => {
|
|
@@ -37,7 +37,7 @@ for (const packageManager of packageManagers) {
|
|
|
37
37
|
},
|
|
38
38
|
});
|
|
39
39
|
const expectedStartScript = packageManager === 'bun' ? 'remotionb studio' : 'remotion studio';
|
|
40
|
-
(0,
|
|
40
|
+
(0, bun_test_1.expect)(newPackageJson).toEqual({
|
|
41
41
|
...packageJson,
|
|
42
42
|
scripts: {
|
|
43
43
|
start: expectedStartScript,
|
|
@@ -45,13 +45,14 @@ for (const packageManager of packageManagers) {
|
|
|
45
45
|
dependencies: {
|
|
46
46
|
...packageJson.dependencies,
|
|
47
47
|
'@remotion/cli': latestRemotionVersion,
|
|
48
|
+
'@remotion/tailwind': latestRemotionVersion,
|
|
48
49
|
remotion: latestRemotionVersion,
|
|
49
50
|
},
|
|
51
|
+
sideEffects: ['*.css'],
|
|
50
52
|
devDependencies: {
|
|
51
53
|
...packageJson.devDependencies,
|
|
52
54
|
'@remotion/eslint-config': latestRemotionVersion,
|
|
53
55
|
},
|
|
54
|
-
packageManager: `${packageManager}@${packageManagerVersion}`,
|
|
55
56
|
});
|
|
56
57
|
});
|
|
57
58
|
}
|
package/dist/validate-name.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateName =
|
|
3
|
+
exports.validateName = validateName;
|
|
4
4
|
function validateName(name) {
|
|
5
5
|
if (typeof name !== 'string' || name === '') {
|
|
6
6
|
return 'The project name can not be empty.';
|
|
@@ -10,4 +10,3 @@ function validateName(name) {
|
|
|
10
10
|
}
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
|
-
exports.validateName = validateName;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/create-video"
|
|
4
4
|
},
|
|
5
5
|
"name": "create-video",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.215",
|
|
7
7
|
"description": "Create a new Remotion project",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"bin": {
|
|
@@ -25,13 +25,12 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/minimist": "1.2.2",
|
|
27
27
|
"@types/prompts": "^2.0.12",
|
|
28
|
-
"@types/tar": "6.1.1"
|
|
29
|
-
"vitest": "0.31.1"
|
|
28
|
+
"@types/tar": "6.1.1"
|
|
30
29
|
},
|
|
31
30
|
"homepage": "https://remotion.dev/templates",
|
|
32
31
|
"scripts": {
|
|
33
32
|
"formatting": "prettier src --check",
|
|
34
33
|
"lint": "eslint src --ext ts,tsx",
|
|
35
|
-
"test": "
|
|
34
|
+
"test": "bun test src"
|
|
36
35
|
}
|
|
37
36
|
}
|