create-video 1.6.0-alpha.f9744b4b → 2.0.3-lambda.460
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 +41 -0
- package/bin.js +9 -0
- package/dist/copy-template.js +2 -2
- package/dist/copy-template.js.map +1 -1
- package/dist/init.d.ts +1 -2
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +237 -62
- package/dist/init.js.map +1 -1
- package/dist/log.d.ts +20 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +27 -0
- package/dist/log.js.map +1 -0
- package/dist/prompts.d.ts +19 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +102 -0
- package/dist/prompts.js.map +1 -0
- package/index.js +5 -0
- package/package.json +15 -10
- package/_template/.github/workflows/render-video.yml +0 -29
- package/_template/.vscode/settings.json +0 -10
- package/_template/Dockerfile +0 -39
- package/_template/README.md +0 -49
- package/_template/_dockerignore +0 -1
- package/_template/_eslintrc +0 -3
- package/_template/_gitignore +0 -3
- package/_template/_prettierrc +0 -14
- package/_template/package.json +0 -31
- package/_template/remotion.config.ts +0 -5
- package/_template/server.tsx +0 -98
- package/_template/src/HelloWorld/Arc.tsx +0 -46
- package/_template/src/HelloWorld/Atom.tsx +0 -30
- package/_template/src/HelloWorld/Logo.tsx +0 -85
- package/_template/src/HelloWorld/Subtitle.tsx +0 -30
- package/_template/src/HelloWorld/Title.tsx +0 -48
- package/_template/src/HelloWorld/config.ts +0 -2
- package/_template/src/HelloWorld.tsx +0 -39
- package/_template/src/Video.tsx +0 -39
- package/_template/src/index.tsx +0 -4
- package/_template/tsconfig.json +0 -14
package/LICENSE.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Remotion License
|
|
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.
|
|
4
|
+
|
|
5
|
+
- [Free license](#free-license)
|
|
6
|
+
- [Company license](#company-license)
|
|
7
|
+
|
|
8
|
+
## Free license
|
|
9
|
+
|
|
10
|
+
Copyright © 2021 [Jonny Burger](https://jonny.io)
|
|
11
|
+
|
|
12
|
+
### Eligibility
|
|
13
|
+
|
|
14
|
+
You are eligible to use Remotion for free if you are:
|
|
15
|
+
|
|
16
|
+
- an individual
|
|
17
|
+
- a for-profit organisation with up to 3 employees
|
|
18
|
+
- a non-profit or not-for-profit organisation
|
|
19
|
+
- evaluating whether Remotion is a good fit, and are not yet using it in a commercial way
|
|
20
|
+
|
|
21
|
+
### Allowed use cases
|
|
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.
|
|
24
|
+
|
|
25
|
+
### Disallowed use cases
|
|
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.
|
|
28
|
+
|
|
29
|
+
### Warranty notice
|
|
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.
|
|
32
|
+
|
|
33
|
+
### Support
|
|
34
|
+
|
|
35
|
+
Support is provided on a best-we-can-do basis via GitHub Issues.
|
|
36
|
+
|
|
37
|
+
## Company license
|
|
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.
|
|
40
|
+
|
|
41
|
+
Visit [companies.remotion.dev](https://companies.remotion.dev) for pricing and to buy a license.
|
package/bin.js
ADDED
package/dist/copy-template.js
CHANGED
|
@@ -3,15 +3,15 @@ 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 path_1 = __importDefault(require("path"));
|
|
7
6
|
const execa_1 = __importDefault(require("execa"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const xns_1 = __importDefault(require("xns"));
|
|
9
9
|
const dotfiles_1 = require("./dotfiles");
|
|
10
10
|
xns_1.default(async () => {
|
|
11
11
|
await execa_1.default('rm', ['-rf', dotfiles_1.templateFolderName]);
|
|
12
12
|
await execa_1.default('git', [
|
|
13
13
|
'clone',
|
|
14
|
-
'https://github.com/
|
|
14
|
+
'https://github.com/remotion-dev/template',
|
|
15
15
|
dotfiles_1.templateFolderName,
|
|
16
16
|
]);
|
|
17
17
|
await execa_1.default('rm', ['-r', path_1.default.join(dotfiles_1.templateFolderName, '.git')]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-template.js","sourceRoot":"","sources":["../src/copy-template.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"copy-template.js","sourceRoot":"","sources":["../src/copy-template.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,gDAAwB;AACxB,8CAAsB;AACtB,yCAAkE;AAElE,aAAG,CAAC,KAAK,IAAI,EAAE;IACd,MAAM,eAAK,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,6BAAkB,CAAC,CAAC,CAAC;IAC/C,MAAM,eAAK,CAAC,KAAK,EAAE;QAClB,OAAO;QACP,0CAA0C;QAC1C,6BAAkB;KAClB,CAAC,CAAC;IACH,MAAM,eAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,cAAI,CAAC,IAAI,CAAC,6BAAkB,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACjE,MAAM,6BAAkB,CAAC,6BAAkB,CAAC,CAAC;IAC7C,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC,CAAC"}
|
package/dist/init.d.ts
CHANGED
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAmMA,eAAO,MAAM,IAAI,qBAkFhB,CAAC"}
|
package/dist/init.js
CHANGED
|
@@ -1,78 +1,253 @@
|
|
|
1
|
-
#! /usr/bin/env node
|
|
2
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
3
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
23
|
};
|
|
6
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.init = void 0;
|
|
7
26
|
const chalk_1 = __importDefault(require("chalk"));
|
|
27
|
+
const degit_1 = __importDefault(require("degit"));
|
|
8
28
|
const execa_1 = __importDefault(require("execa"));
|
|
9
|
-
const
|
|
29
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
30
|
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
32
|
+
const log_1 = require("./log");
|
|
33
|
+
const prompts_1 = __importStar(require("./prompts"));
|
|
34
|
+
const FEATURED_TEMPLATES = [
|
|
35
|
+
{
|
|
36
|
+
shortName: 'Hello World',
|
|
37
|
+
name: 'remotion-dev/template-helloworld',
|
|
38
|
+
description: 'The default starter template (recommended)',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
shortName: 'Blank',
|
|
42
|
+
name: 'remotion-dev/template-empty',
|
|
43
|
+
description: 'Nothing except an empty canvas',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
shortName: 'Hello World (Javascript)',
|
|
47
|
+
name: 'remotion-dev/template-helloworld-javascript',
|
|
48
|
+
description: 'The default starter template in plain JS',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
shortName: 'React Three Fiber',
|
|
52
|
+
name: 'remotion-dev/template-three',
|
|
53
|
+
description: 'Remotion + React Three Fiber Starter Template',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
shortName: 'Still images',
|
|
57
|
+
name: 'remotion-dev/template-still',
|
|
58
|
+
description: 'Dynamic PNG/JPEG template with built-in server',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
shortName: 'Text To Speech',
|
|
62
|
+
name: 'FelippeChemello/Remotion-TTS-Example',
|
|
63
|
+
description: 'Turns text into speech and makes a video',
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
function padEnd(str, width) {
|
|
67
|
+
// Pulled from commander for overriding
|
|
68
|
+
const len = Math.max(0, width - (0, strip_ansi_1.default)(str).length);
|
|
69
|
+
return str + Array(len + 1).join(' ');
|
|
70
|
+
}
|
|
71
|
+
function validateName(name) {
|
|
72
|
+
if (typeof name !== 'string' || name === '') {
|
|
73
|
+
return 'The project name can not be empty.';
|
|
74
|
+
}
|
|
75
|
+
if (!/^[a-z0-9@.\-_]+$/i.test(name)) {
|
|
76
|
+
return 'The project name can only contain URL-friendly characters (alphanumeric and @ . - _)';
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
function assertValidName(folderName) {
|
|
81
|
+
const validation = validateName(folderName);
|
|
82
|
+
if (typeof validation === 'string') {
|
|
83
|
+
throw new Error(`Cannot create an app named ${chalk_1.default.red(`"${folderName}"`)}. ${validation}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async function assertFolderEmptyAsync(projectRoot, folderName) {
|
|
87
|
+
const conflicts = fs_extra_1.default
|
|
88
|
+
.readdirSync(projectRoot)
|
|
89
|
+
.filter((file) => !/\.iml$/.test(file));
|
|
90
|
+
if (conflicts.length) {
|
|
91
|
+
const message = 'Try using a new directory name, or moving these files.';
|
|
92
|
+
log_1.Log.newLine();
|
|
93
|
+
log_1.Log.error(message);
|
|
94
|
+
log_1.Log.newLine();
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const shouldUseYarn = () => {
|
|
24
99
|
var _a, _b;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
100
|
+
return Boolean(((_a = process.env.npm_execpath) === null || _a === void 0 ? void 0 : _a.includes('yarn.js')) ||
|
|
101
|
+
((_b = process.env.npm_config_user_agent) === null || _b === void 0 ? void 0 : _b.includes('yarn')));
|
|
102
|
+
};
|
|
103
|
+
const isGitExecutableAvailable = async () => {
|
|
104
|
+
try {
|
|
105
|
+
await (0, execa_1.default)('git', ['--version']);
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
if (e.errno === 'ENOENT') {
|
|
110
|
+
log_1.Log.warn('Unable to find `git` command. `git` not in PATH.');
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const initGitRepoAsync = async (root, flags = { silent: false, commit: true }) => {
|
|
116
|
+
// let's see if we're in a git tree
|
|
117
|
+
try {
|
|
118
|
+
await (0, execa_1.default)('git', ['rev-parse', '--is-inside-work-tree'], {
|
|
119
|
+
cwd: root,
|
|
120
|
+
});
|
|
121
|
+
!flags.silent &&
|
|
122
|
+
log_1.Log.info('New project is already inside of a git repo, skipping git init.');
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
if (e.errno === 'ENOENT') {
|
|
126
|
+
!flags.silent &&
|
|
127
|
+
log_1.Log.warn('Unable to initialize git repo. `git` not in PATH.');
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// not in git tree, so let's init
|
|
132
|
+
try {
|
|
133
|
+
await (0, execa_1.default)('git', ['init'], { cwd: root });
|
|
134
|
+
!flags.silent && log_1.Log.info('Initialized a git repository.');
|
|
135
|
+
if (flags.commit) {
|
|
136
|
+
await (0, execa_1.default)('git', ['add', '--all'], { cwd: root, stdio: 'ignore' });
|
|
137
|
+
await (0, execa_1.default)('git', ['commit', '-m', 'Create a new Remotion video'], {
|
|
138
|
+
cwd: root,
|
|
139
|
+
stdio: 'ignore',
|
|
140
|
+
});
|
|
141
|
+
await (0, execa_1.default)('git', ['branch', '-M', 'main'], {
|
|
142
|
+
cwd: root,
|
|
143
|
+
stdio: 'ignore',
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
log_1.Log.verbose('git error:', e);
|
|
150
|
+
// no-op -- this is just a convenience and we don't care if it fails
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const resolveProjectRootAsync = async () => {
|
|
155
|
+
let projectName = '';
|
|
156
|
+
try {
|
|
157
|
+
const { answer } = await (0, prompts_1.default)({
|
|
158
|
+
type: 'text',
|
|
159
|
+
name: 'answer',
|
|
160
|
+
message: 'What would you like to name your video?',
|
|
161
|
+
initial: 'my-video',
|
|
162
|
+
validate: (name) => {
|
|
163
|
+
const validation = validateName(path_1.default.basename(path_1.default.resolve(name)));
|
|
164
|
+
if (typeof validation === 'string') {
|
|
165
|
+
return 'Invalid project name: ' + validation;
|
|
166
|
+
}
|
|
167
|
+
return true;
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
if (typeof answer === 'string') {
|
|
171
|
+
projectName = answer.trim();
|
|
31
172
|
}
|
|
32
|
-
|
|
33
|
-
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
// Handle the aborted message in a custom way.
|
|
176
|
+
if (error.code !== 'ABORTED') {
|
|
177
|
+
throw error;
|
|
34
178
|
}
|
|
35
179
|
}
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
180
|
+
const projectRoot = path_1.default.resolve(projectName);
|
|
181
|
+
const folderName = path_1.default.basename(projectRoot);
|
|
182
|
+
assertValidName(folderName);
|
|
183
|
+
await fs_extra_1.default.ensureDir(projectRoot);
|
|
184
|
+
await assertFolderEmptyAsync(projectRoot, folderName);
|
|
185
|
+
return [projectRoot, folderName];
|
|
186
|
+
};
|
|
187
|
+
const init = async () => {
|
|
188
|
+
var _a, _b, _c, _d;
|
|
189
|
+
const [projectRoot, folderName] = await resolveProjectRootAsync();
|
|
190
|
+
await isGitExecutableAvailable();
|
|
191
|
+
const descriptionColumn = Math.max(...FEATURED_TEMPLATES.map((t) => typeof t === 'object' ? t.shortName.length : 0)) + 2;
|
|
192
|
+
const template = await (0, prompts_1.selectAsync)({
|
|
193
|
+
message: 'Choose a template:',
|
|
194
|
+
optionsPerPage: 20,
|
|
195
|
+
choices: FEATURED_TEMPLATES.map((template) => {
|
|
196
|
+
if (typeof template === 'string') {
|
|
197
|
+
return prompts_1.default.separator(template);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
return {
|
|
201
|
+
value: template.name,
|
|
202
|
+
title: chalk_1.default.bold(padEnd(template.shortName, descriptionColumn)) +
|
|
203
|
+
template.description.trim(),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}),
|
|
207
|
+
}, {});
|
|
208
|
+
try {
|
|
209
|
+
const emitter = (0, degit_1.default)(`https://github.com/${template}`);
|
|
210
|
+
await emitter.clone(projectRoot);
|
|
211
|
+
log_1.Log.info(`Cloned template into ${projectRoot}`);
|
|
212
|
+
}
|
|
213
|
+
catch (e) {
|
|
214
|
+
log_1.Log.error('Error with template cloning. Aborting');
|
|
215
|
+
process.exit(1);
|
|
216
|
+
}
|
|
217
|
+
log_1.Log.info(`Created project at ${chalk_1.default.blue(folderName)}. Installing dependencies...`);
|
|
218
|
+
if (shouldUseYarn()) {
|
|
219
|
+
log_1.Log.info('> yarn');
|
|
220
|
+
const promise = (0, execa_1.default)('yarn', [], {
|
|
221
|
+
cwd: projectRoot,
|
|
222
|
+
});
|
|
223
|
+
(_a = promise.stderr) === null || _a === void 0 ? void 0 : _a.pipe(process.stderr);
|
|
224
|
+
(_b = promise.stdout) === null || _b === void 0 ? void 0 : _b.pipe(process.stdout);
|
|
225
|
+
await promise;
|
|
52
226
|
}
|
|
53
227
|
else {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
228
|
+
log_1.Log.info('> npm install');
|
|
229
|
+
const promise = (0, execa_1.default)('npm', ['install'], {
|
|
230
|
+
cwd: projectRoot,
|
|
231
|
+
});
|
|
232
|
+
(_c = promise.stderr) === null || _c === void 0 ? void 0 : _c.pipe(process.stderr);
|
|
233
|
+
(_d = promise.stdout) === null || _d === void 0 ? void 0 : _d.pipe(process.stdout);
|
|
234
|
+
await promise;
|
|
235
|
+
}
|
|
236
|
+
await initGitRepoAsync(projectRoot, {
|
|
237
|
+
silent: false,
|
|
238
|
+
commit: true,
|
|
62
239
|
});
|
|
63
|
-
(
|
|
64
|
-
(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
console.log('Enjoy Remotion!');
|
|
77
|
-
});
|
|
240
|
+
log_1.Log.info(`Welcome to ${chalk_1.default.blue('Remotion')}!`);
|
|
241
|
+
log_1.Log.info(`✨ Your video has been created at ${chalk_1.default.blue(folderName)}.\n`);
|
|
242
|
+
log_1.Log.info('Get started by running');
|
|
243
|
+
log_1.Log.info(chalk_1.default.blue(`cd ${folderName}`));
|
|
244
|
+
log_1.Log.info(chalk_1.default.blue(shouldUseYarn() ? 'yarn start' : 'npm start'));
|
|
245
|
+
log_1.Log.info('');
|
|
246
|
+
log_1.Log.info('To render an MP4 video, run');
|
|
247
|
+
log_1.Log.info(chalk_1.default.blue(shouldUseYarn() ? 'yarn build' : 'npm run build'));
|
|
248
|
+
log_1.Log.info('');
|
|
249
|
+
log_1.Log.info('Read the documentation at', chalk_1.default.underline('https://remotion.dev'));
|
|
250
|
+
log_1.Log.info('Enjoy Remotion!');
|
|
251
|
+
};
|
|
252
|
+
exports.init = init;
|
|
78
253
|
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,kDAA0B;AAC1B,kDAA0B;AAC1B,wDAA0B;AAC1B,gDAAwB;AACxB,4DAAmC;AACnC,+BAA0B;AAC1B,qDAA+C;AAQ/C,MAAM,kBAAkB,GAAgB;IACvC;QACC,SAAS,EAAE,aAAa;QACxB,IAAI,EAAE,kCAAkC;QACxC,WAAW,EAAE,4CAA4C;KACzD;IACD;QACC,SAAS,EAAE,OAAO;QAClB,IAAI,EAAE,6BAA6B;QACnC,WAAW,EAAE,gCAAgC;KAC7C;IACD;QACC,SAAS,EAAE,0BAA0B;QACrC,IAAI,EAAE,6CAA6C;QACnD,WAAW,EAAE,0CAA0C;KACvD;IACD;QACC,SAAS,EAAE,mBAAmB;QAC9B,IAAI,EAAE,6BAA6B;QACnC,WAAW,EAAE,+CAA+C;KAC5D;IACD;QACC,SAAS,EAAE,cAAc;QACzB,IAAI,EAAE,6BAA6B;QACnC,WAAW,EAAE,gDAAgD;KAC7D;IACD;QACC,SAAS,EAAE,gBAAgB;QAC3B,IAAI,EAAE,sCAAsC;QAC5C,WAAW,EAAE,0CAA0C;KACvD;CACD,CAAC;AAEF,SAAS,MAAM,CAAC,GAAW,EAAE,KAAa;IACzC,uCAAuC;IACvC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,IAAA,oBAAS,EAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IACvD,OAAO,GAAG,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IA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chalk from 'chalk';
|
|
2
|
+
export declare const Log: {
|
|
3
|
+
chalk: chalk.Chalk & chalk.ChalkFunction & {
|
|
4
|
+
supportsColor: false | chalk.ColorSupport;
|
|
5
|
+
Level: chalk.Level;
|
|
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
|
+
ForegroundColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
|
|
8
|
+
BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright";
|
|
9
|
+
Modifiers: "reset" | "bold" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "visible";
|
|
10
|
+
stderr: chalk.Chalk & {
|
|
11
|
+
supportsColor: false | chalk.ColorSupport;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
verbose: (message?: any, ...optionalParams: any[]) => void;
|
|
15
|
+
info: (message?: any, ...optionalParams: any[]) => void;
|
|
16
|
+
warn: (message?: any, ...optionalParams: any[]) => void;
|
|
17
|
+
error: (message?: any, ...optionalParams: any[]) => void;
|
|
18
|
+
newLine: () => void;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;CAiBf,CAAC"}
|
package/dist/log.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Log = void 0;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
exports.Log = {
|
|
10
|
+
chalk: chalk_1.default,
|
|
11
|
+
verbose: (...args) => {
|
|
12
|
+
return console.log(chalk_1.default.blueBright(...args));
|
|
13
|
+
},
|
|
14
|
+
info: (...args) => {
|
|
15
|
+
return console.log(...args);
|
|
16
|
+
},
|
|
17
|
+
warn: (...args) => {
|
|
18
|
+
return console.warn(chalk_1.default.yellow(...args));
|
|
19
|
+
},
|
|
20
|
+
error: (...args) => {
|
|
21
|
+
return console.error(chalk_1.default.red(...args));
|
|
22
|
+
},
|
|
23
|
+
newLine: () => {
|
|
24
|
+
return console.log();
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=log.js.map
|
package/dist/log.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;;;;AAE/B,kDAA0B;AAEb,QAAA,GAAG,GAAG;IAClB,KAAK,EAAE,eAAK;IACZ,OAAO,EAAE,CAAC,GAAG,IAAoC,EAAE,EAAE;QACpD,OAAO,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,EAAE,CAAC,GAAG,IAAoC,EAAE,EAAE;QACjD,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,EAAE,CAAC,GAAG,IAAoC,EAAE,EAAE;QACjD,OAAO,OAAO,CAAC,IAAI,CAAC,eAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,KAAK,EAAE,CAAC,GAAG,IAAoC,EAAE,EAAE;QAClD,OAAO,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,EAAE,GAAG,EAAE;QACb,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;IACtB,CAAC;CACD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import prompts, { Options, PromptObject } from 'prompts';
|
|
2
|
+
export declare type Question<V extends string = string> = PromptObject<V> & {
|
|
3
|
+
optionsPerPage?: number;
|
|
4
|
+
};
|
|
5
|
+
export declare type NamelessQuestion = Omit<Question<'value'>, 'name' | 'type'>;
|
|
6
|
+
declare type PromptOptions = {
|
|
7
|
+
nonInteractiveHelp?: string;
|
|
8
|
+
} & Options;
|
|
9
|
+
declare function prompt(questions: Question | Question[], { nonInteractiveHelp, ...options }?: PromptOptions): Promise<prompts.Answers<string>>;
|
|
10
|
+
declare namespace prompt {
|
|
11
|
+
var separator: (title: string) => {
|
|
12
|
+
title: string;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
value: undefined;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export default prompt;
|
|
18
|
+
export declare function selectAsync(questions: NamelessQuestion, options?: PromptOptions): Promise<unknown>;
|
|
19
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AAEvD,oBAAY,QAAQ,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG;IACnE,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AACF,oBAAY,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AACxE,aAAK,aAAa,GAAG;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,OAAO,CAAC;AAE7D,iBAAwB,MAAM,CAC7B,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAAE,EAChC,EAAC,kBAAkB,EAAE,GAAG,OAAO,EAAC,GAAE,aAAkB,oCASpD;kBAXuB,MAAM;;;;;;;eAAN,MAAM;AAmB9B,wBAAsB,WAAW,CAChC,SAAS,EAAE,gBAAgB,EAC3B,OAAO,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,OAAO,CAAC,CAsFlB"}
|
package/dist/prompts.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
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.selectAsync = void 0;
|
|
7
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
8
|
+
function prompt(questions, { nonInteractiveHelp, ...options } = {}) {
|
|
9
|
+
questions = Array.isArray(questions) ? questions : [questions];
|
|
10
|
+
return (0, prompts_1.default)(questions, {
|
|
11
|
+
onCancel() {
|
|
12
|
+
throw new Error();
|
|
13
|
+
},
|
|
14
|
+
...options,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.default = prompt;
|
|
18
|
+
prompt.separator = (title) => ({
|
|
19
|
+
title,
|
|
20
|
+
disabled: true,
|
|
21
|
+
value: undefined,
|
|
22
|
+
});
|
|
23
|
+
async function selectAsync(questions, options) {
|
|
24
|
+
const { value } = await prompt({
|
|
25
|
+
limit: 11,
|
|
26
|
+
...questions,
|
|
27
|
+
// @ts-ignore: onRender not in the types
|
|
28
|
+
onRender() {
|
|
29
|
+
if (this.firstRender) {
|
|
30
|
+
// Ensure the initial state isn't on a disabled item.
|
|
31
|
+
while (this.choices[this.cursor].disabled) {
|
|
32
|
+
this.cursor++;
|
|
33
|
+
if (this.cursor > this.choices.length - 1)
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
this.fire();
|
|
37
|
+
// Without this, the value will be `0` instead of a string.
|
|
38
|
+
this.value = (this.choices[this.cursor] || {}).value;
|
|
39
|
+
// Support up arrow and `k` key -- no looping
|
|
40
|
+
this.up = () => {
|
|
41
|
+
let next = this.cursor;
|
|
42
|
+
while (true) {
|
|
43
|
+
if (next <= 0)
|
|
44
|
+
break;
|
|
45
|
+
next--;
|
|
46
|
+
if (!this.choices[next].disabled)
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
if (!this.choices[next].disabled && next !== this.cursor) {
|
|
50
|
+
this.moveCursor(next);
|
|
51
|
+
this.render();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.bell();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
// Support down arrow and `j` key -- no looping
|
|
58
|
+
this.down = () => {
|
|
59
|
+
let next = this.cursor;
|
|
60
|
+
while (true) {
|
|
61
|
+
if (next >= this.choices.length - 1)
|
|
62
|
+
break;
|
|
63
|
+
next++;
|
|
64
|
+
if (!this.choices[next].disabled)
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
if (!this.choices[next].disabled && next !== this.cursor) {
|
|
68
|
+
this.moveCursor(next);
|
|
69
|
+
this.render();
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.bell();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
// Support tab -- looping
|
|
76
|
+
this.next = () => {
|
|
77
|
+
let next = this.cursor;
|
|
78
|
+
let i = 0;
|
|
79
|
+
while (i < this.choices.length) {
|
|
80
|
+
i++;
|
|
81
|
+
next = (next + 1) % this.choices.length;
|
|
82
|
+
if (!this.choices[next].disabled)
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
if (!this.choices[next].disabled) {
|
|
86
|
+
this.moveCursor(next);
|
|
87
|
+
this.render();
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
// unexpected
|
|
91
|
+
this.bell();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
name: 'value',
|
|
97
|
+
type: 'select',
|
|
98
|
+
}, options);
|
|
99
|
+
return value !== null && value !== void 0 ? value : null;
|
|
100
|
+
}
|
|
101
|
+
exports.selectAsync = selectAsync;
|
|
102
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAuD;AAQvD,SAAwB,MAAM,CAC7B,SAAgC,EAChC,EAAC,kBAAkB,EAAE,GAAG,OAAO,KAAmB,EAAE;IAEpD,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC/D,OAAO,IAAA,iBAAO,EAAC,SAAS,EAAE;QACzB,QAAQ;YACP,MAAM,IAAI,KAAK,EAAE,CAAC;QACnB,CAAC;QACD,GAAG,OAAO;KACV,CAAC,CAAC;AACJ,CAAC;AAXD,yBAWC;AAED,MAAM,CAA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