@remotion/cloudrun 4.1.0-alpha2
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/.turbo/turbo-build.log +13 -0
- package/LICENSE.md +41 -0
- package/dist/admin/bundle-installer.d.ts +1 -0
- package/dist/admin/bundle-installer.js +32 -0
- package/dist/admin/bundle-renderLogic.d.ts +1 -0
- package/dist/admin/bundle-renderLogic.js +39 -0
- package/dist/api/check-if-service-exists.d.ts +18 -0
- package/dist/api/check-if-service-exists.js +50 -0
- package/dist/api/create-bucket.d.ts +13 -0
- package/dist/api/create-bucket.js +18 -0
- package/dist/api/delete-service.d.ts +12 -0
- package/dist/api/delete-service.js +19 -0
- package/dist/api/delete-site.d.ts +13 -0
- package/dist/api/delete-site.js +30 -0
- package/dist/api/deploy-service.d.ts +28 -0
- package/dist/api/deploy-service.js +90 -0
- package/dist/api/deploy-site.d.ts +35 -0
- package/dist/api/deploy-site.js +78 -0
- package/dist/api/download-file.d.ts +13 -0
- package/dist/api/download-file.js +30 -0
- package/dist/api/get-buckets.d.ts +10 -0
- package/dist/api/get-buckets.js +23 -0
- package/dist/api/get-or-create-bucket.d.ts +17 -0
- package/dist/api/get-or-create-bucket.js +42 -0
- package/dist/api/get-regions.d.ts +7 -0
- package/dist/api/get-regions.js +13 -0
- package/dist/api/get-service-info.d.ts +23 -0
- package/dist/api/get-service-info.js +36 -0
- package/dist/api/get-services.d.ts +14 -0
- package/dist/api/get-services.js +49 -0
- package/dist/api/get-sites.d.ts +23 -0
- package/dist/api/get-sites.js +49 -0
- package/dist/api/helpers/IService.d.ts +2 -0
- package/dist/api/helpers/IService.js +2 -0
- package/dist/api/helpers/construct-service-deploy-request.d.ts +32 -0
- package/dist/api/helpers/construct-service-deploy-request.js +36 -0
- package/dist/api/helpers/get-auth-client-for-url.d.ts +1 -0
- package/dist/api/helpers/get-auth-client-for-url.js +15 -0
- package/dist/api/helpers/get-cloud-run-client.d.ts +2 -0
- package/dist/api/helpers/get-cloud-run-client.js +15 -0
- package/dist/api/helpers/get-cloud-storage-client.d.ts +2 -0
- package/dist/api/helpers/get-cloud-storage-client.js +14 -0
- package/dist/api/helpers/get-cloudrun-endpoint.d.ts +14 -0
- package/dist/api/helpers/get-cloudrun-endpoint.js +36 -0
- package/dist/api/helpers/get-resource-manager-client.d.ts +2 -0
- package/dist/api/helpers/get-resource-manager-client.js +15 -0
- package/dist/api/iam-validation/testPermissions.d.ts +20 -0
- package/dist/api/iam-validation/testPermissions.js +48 -0
- package/dist/api/render-media-on-cloudrun.d.ts +70 -0
- package/dist/api/render-media-on-cloudrun.js +115 -0
- package/dist/api/render-still-on-cloudrun.d.ts +47 -0
- package/dist/api/render-still-on-cloudrun.js +68 -0
- package/dist/api/speculate-service-name.d.ts +13 -0
- package/dist/api/speculate-service-name.js +20 -0
- package/dist/api/upload-dir.d.ts +18 -0
- package/dist/api/upload-dir.js +81 -0
- package/dist/cli/args.d.ts +19 -0
- package/dist/cli/args.js +11 -0
- package/dist/cli/commands/permissions.d.ts +2 -0
- package/dist/cli/commands/permissions.js +23 -0
- package/dist/cli/commands/regions.d.ts +2 -0
- package/dist/cli/commands/regions.js +10 -0
- package/dist/cli/commands/render/helpers/renderArgsCheck.d.ts +9 -0
- package/dist/cli/commands/render/helpers/renderArgsCheck.js +75 -0
- package/dist/cli/commands/render/index.d.ts +2 -0
- package/dist/cli/commands/render/index.js +36 -0
- package/dist/cli/commands/render/renderMedia.d.ts +2 -0
- package/dist/cli/commands/render/renderMedia.js +156 -0
- package/dist/cli/commands/render/renderStill.d.ts +2 -0
- package/dist/cli/commands/render/renderStill.js +123 -0
- package/dist/cli/commands/services/deploy.d.ts +2 -0
- package/dist/cli/commands/services/deploy.js +129 -0
- package/dist/cli/commands/services/index.d.ts +5 -0
- package/dist/cli/commands/services/index.js +64 -0
- package/dist/cli/commands/services/ls.d.ts +2 -0
- package/dist/cli/commands/services/ls.js +40 -0
- package/dist/cli/commands/services/rm.d.ts +2 -0
- package/dist/cli/commands/services/rm.js +63 -0
- package/dist/cli/commands/services/rmall.d.ts +2 -0
- package/dist/cli/commands/services/rmall.js +52 -0
- package/dist/cli/commands/sites/create.d.ts +2 -0
- package/dist/cli/commands/sites/create.js +138 -0
- package/dist/cli/commands/sites/index.d.ts +4 -0
- package/dist/cli/commands/sites/index.js +60 -0
- package/dist/cli/commands/sites/ls.d.ts +2 -0
- package/dist/cli/commands/sites/ls.js +40 -0
- package/dist/cli/commands/sites/rm.d.ts +2 -0
- package/dist/cli/commands/sites/rm.js +59 -0
- package/dist/cli/commands/sites/rmall.d.ts +2 -0
- package/dist/cli/commands/sites/rmall.js +38 -0
- package/dist/cli/get-gcp-region.d.ts +2 -0
- package/dist/cli/get-gcp-region.js +19 -0
- package/dist/cli/help.d.ts +1 -0
- package/dist/cli/help.js +34 -0
- package/dist/cli/helpers/confirm.d.ts +4 -0
- package/dist/cli/helpers/confirm.js +12 -0
- package/dist/cli/helpers/date-string.d.ts +1 -0
- package/dist/cli/helpers/date-string.js +9 -0
- package/dist/cli/helpers/progress-bar.d.ts +23 -0
- package/dist/cli/helpers/progress-bar.js +81 -0
- package/dist/cli/helpers/quit.d.ts +1 -0
- package/dist/cli/helpers/quit.js +7 -0
- package/dist/cli/helpers/yes-or-no.d.ts +4 -0
- package/dist/cli/helpers/yes-or-no.js +44 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +52 -0
- package/dist/cli/log.d.ts +21 -0
- package/dist/cli/log.js +5 -0
- package/dist/defaults.d.ts +1 -0
- package/dist/defaults.js +17 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +31 -0
- package/dist/internals.d.ts +3 -0
- package/dist/internals.js +7 -0
- package/dist/pricing/gcp-regions.d.ts +5 -0
- package/dist/pricing/gcp-regions.js +77 -0
- package/dist/regions.d.ts +2 -0
- package/dist/regions.js +5 -0
- package/dist/shared/bundle-site.d.ts +2 -0
- package/dist/shared/bundle-site.js +5 -0
- package/dist/shared/constants.d.ts +13 -0
- package/dist/shared/constants.js +18 -0
- package/dist/shared/convert-to-serve-url.d.ts +4 -0
- package/dist/shared/convert-to-serve-url.js +14 -0
- package/dist/shared/docs-url.d.ts +1 -0
- package/dist/shared/docs-url.js +4 -0
- package/dist/shared/generate-service-name.d.ts +5 -0
- package/dist/shared/generate-service-name.js +20 -0
- package/dist/shared/get-etag.d.ts +1 -0
- package/dist/shared/get-etag.js +24 -0
- package/dist/shared/get-storage-operations.d.ts +10 -0
- package/dist/shared/get-storage-operations.js +36 -0
- package/dist/shared/make-storage-key.d.ts +1 -0
- package/dist/shared/make-storage-key.js +11 -0
- package/dist/shared/make-storage-url.d.ts +4 -0
- package/dist/shared/make-storage-url.js +7 -0
- package/dist/shared/random-hash.d.ts +3 -0
- package/dist/shared/random-hash.js +14 -0
- package/dist/shared/read-dir.d.ts +9 -0
- package/dist/shared/read-dir.js +57 -0
- package/dist/shared/sa-permissions.json +60 -0
- package/dist/shared/service-version-string.d.ts +1 -0
- package/dist/shared/service-version-string.js +8 -0
- package/dist/shared/validate-bucketname.d.ts +8 -0
- package/dist/shared/validate-bucketname.js +35 -0
- package/dist/shared/validate-cloudrun-url.d.ts +1 -0
- package/dist/shared/validate-cloudrun-url.js +10 -0
- package/dist/shared/validate-gcp-codec.d.ts +4 -0
- package/dist/shared/validate-gcp-codec.js +29 -0
- package/dist/shared/validate-gcp-region.d.ts +2 -0
- package/dist/shared/validate-gcp-region.js +10 -0
- package/dist/shared/validate-image-remotion-version.d.ts +1 -0
- package/dist/shared/validate-image-remotion-version.js +26 -0
- package/dist/shared/validate-privacy.d.ts +2 -0
- package/dist/shared/validate-privacy.js +12 -0
- package/dist/shared/validate-project-id.d.ts +1 -0
- package/dist/shared/validate-project-id.js +17 -0
- package/dist/shared/validate-region.d.ts +1 -0
- package/dist/shared/validate-region.js +15 -0
- package/dist/shared/validate-retries.d.ts +1 -0
- package/dist/shared/validate-retries.js +21 -0
- package/dist/shared/validate-serveurl.d.ts +1 -0
- package/dist/shared/validate-serveurl.js +30 -0
- package/dist/shared/validate-service-name.d.ts +1 -0
- package/dist/shared/validate-service-name.js +9 -0
- package/dist/shared/validate-site-name.d.ts +1 -0
- package/dist/shared/validate-site-name.js +17 -0
- package/package.json +59 -0
- package/readme.md +306 -0
- package/readmeImages/createSA.png +0 -0
- package/readmeImages/downloadEnv.jpg +0 -0
- package/readmeImages/downloadEnvFolder.png +0 -0
- package/readmeImages/saRole.png +0 -0
- package/readmeImages/selectCloudShell.jpg +0 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sitesCreateSubcommand = exports.SITES_CREATE_SUBCOMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const config_1 = require("@remotion/cli/config");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const remotion_1 = require("remotion");
|
|
8
|
+
const _1 = require(".");
|
|
9
|
+
const deploy_site_1 = require("../../../api/deploy-site");
|
|
10
|
+
const get_or_create_bucket_1 = require("../../../api/get-or-create-bucket");
|
|
11
|
+
const constants_1 = require("../../../shared/constants");
|
|
12
|
+
const validate_site_name_1 = require("../../../shared/validate-site-name");
|
|
13
|
+
const args_1 = require("../../args");
|
|
14
|
+
const get_gcp_region_1 = require("../../get-gcp-region");
|
|
15
|
+
const progress_bar_1 = require("../../helpers/progress-bar");
|
|
16
|
+
const quit_1 = require("../../helpers/quit");
|
|
17
|
+
const log_1 = require("../../log");
|
|
18
|
+
exports.SITES_CREATE_SUBCOMMAND = 'create';
|
|
19
|
+
const sitesCreateSubcommand = async (args, remotionRoot) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const { file, reason } = cli_1.CliInternals.findEntryPoint(args, remotionRoot);
|
|
22
|
+
if (!file) {
|
|
23
|
+
log_1.Log.error('No entry file passed.');
|
|
24
|
+
log_1.Log.info('Pass an additional argument specifying the entry file of your Remotion project:');
|
|
25
|
+
log_1.Log.info();
|
|
26
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} deploy <entry-file.ts>`);
|
|
27
|
+
(0, quit_1.quit)(1);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
log_1.Log.verbose('Entry point:', file, 'Reason:', reason);
|
|
31
|
+
if (!(0, fs_1.existsSync)(file)) {
|
|
32
|
+
log_1.Log.error(`No file exists at ${file}. Make sure the path exists and try again.`);
|
|
33
|
+
(0, quit_1.quit)(1);
|
|
34
|
+
}
|
|
35
|
+
if ((0, fs_1.lstatSync)(file).isDirectory()) {
|
|
36
|
+
log_1.Log.error(`You passed a path ${file} but it is a directory. Pass a file instead.`);
|
|
37
|
+
(0, quit_1.quit)(1);
|
|
38
|
+
}
|
|
39
|
+
const desiredSiteName = (_a = args_1.parsedCloudrunCli['site-name']) !== null && _a !== void 0 ? _a : undefined;
|
|
40
|
+
if (desiredSiteName !== undefined) {
|
|
41
|
+
(0, validate_site_name_1.validateSiteName)(desiredSiteName);
|
|
42
|
+
}
|
|
43
|
+
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
44
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
45
|
+
cancelSignal: null,
|
|
46
|
+
updatesDontOverwrite: false,
|
|
47
|
+
indent: false,
|
|
48
|
+
});
|
|
49
|
+
const multiProgress = {
|
|
50
|
+
bundleProgress: {
|
|
51
|
+
doneIn: null,
|
|
52
|
+
progress: 0,
|
|
53
|
+
},
|
|
54
|
+
bucketProgress: {
|
|
55
|
+
doneIn: null,
|
|
56
|
+
creationState: 'Checking for existing bucket',
|
|
57
|
+
},
|
|
58
|
+
deployProgress: {
|
|
59
|
+
doneIn: null,
|
|
60
|
+
totalSize: null,
|
|
61
|
+
sizeUploaded: 0,
|
|
62
|
+
stats: null,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
const updateProgress = () => {
|
|
66
|
+
progressBar.update([
|
|
67
|
+
(0, progress_bar_1.makeBundleProgress)(multiProgress.bundleProgress),
|
|
68
|
+
(0, progress_bar_1.makeBucketProgress)(multiProgress.bucketProgress),
|
|
69
|
+
(0, progress_bar_1.makeDeployProgressBar)(multiProgress.deployProgress),
|
|
70
|
+
].join('\n'), false);
|
|
71
|
+
};
|
|
72
|
+
const bucketStart = Date.now();
|
|
73
|
+
const region = (0, get_gcp_region_1.getGcpRegion)();
|
|
74
|
+
const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
|
|
75
|
+
region,
|
|
76
|
+
updateBucketState: (state) => {
|
|
77
|
+
multiProgress.bucketProgress.creationState = state;
|
|
78
|
+
updateProgress();
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
multiProgress.bucketProgress.doneIn = Date.now() - bucketStart;
|
|
82
|
+
updateProgress();
|
|
83
|
+
const bundleStart = Date.now();
|
|
84
|
+
const { serveUrl, siteName, stats } = await (0, deploy_site_1.deploySite)({
|
|
85
|
+
entryPoint: file,
|
|
86
|
+
siteName: desiredSiteName,
|
|
87
|
+
bucketName,
|
|
88
|
+
options: {
|
|
89
|
+
onBundleProgress: (progress) => {
|
|
90
|
+
multiProgress.bundleProgress = {
|
|
91
|
+
progress,
|
|
92
|
+
doneIn: progress === 100 ? Date.now() - bundleStart : null,
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
onUploadProgress: (p) => {
|
|
96
|
+
multiProgress.deployProgress = {
|
|
97
|
+
sizeUploaded: p.sizeUploaded,
|
|
98
|
+
totalSize: p.totalSize,
|
|
99
|
+
doneIn: null,
|
|
100
|
+
stats: null,
|
|
101
|
+
};
|
|
102
|
+
updateProgress();
|
|
103
|
+
},
|
|
104
|
+
enableCaching: config_1.ConfigInternals.getWebpackCaching(),
|
|
105
|
+
webpackOverride: (_b = config_1.ConfigInternals.getWebpackOverrideFn()) !== null && _b !== void 0 ? _b : ((f) => f),
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
updateProgress();
|
|
109
|
+
const uploadStart = Date.now();
|
|
110
|
+
const uploadDuration = Date.now() - uploadStart;
|
|
111
|
+
multiProgress.deployProgress = {
|
|
112
|
+
sizeUploaded: 1,
|
|
113
|
+
totalSize: 1,
|
|
114
|
+
doneIn: uploadDuration,
|
|
115
|
+
stats: {
|
|
116
|
+
addedFiles: stats.uploadedFiles,
|
|
117
|
+
removedFiles: stats.deletedFiles,
|
|
118
|
+
untouchedFiles: stats.untouchedFiles,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
updateProgress();
|
|
122
|
+
log_1.Log.info();
|
|
123
|
+
log_1.Log.info();
|
|
124
|
+
log_1.Log.info('Deployed to GCP Storage!');
|
|
125
|
+
log_1.Log.info();
|
|
126
|
+
log_1.Log.info((0, _1.displaySiteInfo)({
|
|
127
|
+
bucketName,
|
|
128
|
+
id: siteName,
|
|
129
|
+
serveUrl,
|
|
130
|
+
bucketRegion: region,
|
|
131
|
+
}));
|
|
132
|
+
log_1.Log.info();
|
|
133
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright('ℹ️ If you make changes to your code, you need to redeploy the site. You can overwrite the existing site by running:'));
|
|
134
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(['npx remotion cloudrun sites create', args[0], `--site-name=${siteName}`]
|
|
135
|
+
.filter(remotion_1.Internals.truthy)
|
|
136
|
+
.join(' ')));
|
|
137
|
+
};
|
|
138
|
+
exports.sitesCreateSubcommand = sitesCreateSubcommand;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sitesCommand = exports.displaySiteInfo = exports.SITES_COMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const constants_1 = require("../../../shared/constants");
|
|
6
|
+
const quit_1 = require("../../helpers/quit");
|
|
7
|
+
const log_1 = require("../../log");
|
|
8
|
+
const create_1 = require("./create");
|
|
9
|
+
const ls_1 = require("./ls");
|
|
10
|
+
const rm_1 = require("./rm");
|
|
11
|
+
const rmall_1 = require("./rmall");
|
|
12
|
+
exports.SITES_COMMAND = 'sites';
|
|
13
|
+
const displaySiteInfo = (site) => {
|
|
14
|
+
const LEFT_COL = 16;
|
|
15
|
+
return [
|
|
16
|
+
'Site: '.padEnd(LEFT_COL, ' ') + ' ' + site.id,
|
|
17
|
+
'Bucket: '.padEnd(LEFT_COL, ' ') + ' ' + site.bucketName,
|
|
18
|
+
'Region: '.padEnd(LEFT_COL, ' ') + ' ' + site.bucketRegion,
|
|
19
|
+
'Serve Url: '.padEnd(LEFT_COL, ' ') + ' ' + site.serveUrl,
|
|
20
|
+
].join('\n');
|
|
21
|
+
};
|
|
22
|
+
exports.displaySiteInfo = displaySiteInfo;
|
|
23
|
+
const printSitesHelp = () => {
|
|
24
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.SITES_COMMAND} <subcommand>`);
|
|
25
|
+
log_1.Log.info();
|
|
26
|
+
log_1.Log.info('Available subcommands:');
|
|
27
|
+
log_1.Log.info('');
|
|
28
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.SITES_COMMAND} ${create_1.SITES_CREATE_SUBCOMMAND}`);
|
|
29
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray('Creates a new site based on a Remotion project'));
|
|
30
|
+
cli_1.CliInternals.Log.info();
|
|
31
|
+
cli_1.CliInternals.Log.info(`${constants_1.BINARY_NAME} ${exports.SITES_COMMAND} ${ls_1.SITES_LS_SUBCOMMAND}`);
|
|
32
|
+
cli_1.CliInternals.Log.info(cli_1.CliInternals.chalk.gray('Lists the sites currently deployed'));
|
|
33
|
+
cli_1.CliInternals.Log.info();
|
|
34
|
+
cli_1.CliInternals.Log.info(`${constants_1.BINARY_NAME} ${exports.SITES_COMMAND} ${rm_1.SITES_RM_COMMAND} <site-id>`);
|
|
35
|
+
cli_1.CliInternals.Log.info(cli_1.CliInternals.chalk.gray('Remove a site from the Cloud Storage bucket.'));
|
|
36
|
+
cli_1.CliInternals.Log.info();
|
|
37
|
+
cli_1.CliInternals.Log.info(`${constants_1.BINARY_NAME} ${exports.SITES_COMMAND} ${rmall_1.SITES_RMALL_COMMAND}`);
|
|
38
|
+
cli_1.CliInternals.Log.info(cli_1.CliInternals.chalk.gray('Remove all sites from the Cloud Storage bucket.'));
|
|
39
|
+
};
|
|
40
|
+
const sitesCommand = (args, remotionRoot) => {
|
|
41
|
+
if (args[0] === ls_1.SITES_LS_SUBCOMMAND) {
|
|
42
|
+
return (0, ls_1.sitesLsSubcommand)();
|
|
43
|
+
}
|
|
44
|
+
if (args[0] === rm_1.SITES_RM_COMMAND) {
|
|
45
|
+
return (0, rm_1.sitesRmSubcommand)(args.slice(1));
|
|
46
|
+
}
|
|
47
|
+
if (args[0] === rmall_1.SITES_RMALL_COMMAND) {
|
|
48
|
+
return (0, rmall_1.sitesRmallSubcommand)();
|
|
49
|
+
}
|
|
50
|
+
if (args[0] === create_1.SITES_CREATE_SUBCOMMAND) {
|
|
51
|
+
return (0, create_1.sitesCreateSubcommand)(args.slice(1), remotionRoot);
|
|
52
|
+
}
|
|
53
|
+
if (args[0]) {
|
|
54
|
+
log_1.Log.error(`Subcommand ${args[0]} not found.`);
|
|
55
|
+
printSitesHelp();
|
|
56
|
+
(0, quit_1.quit)(1);
|
|
57
|
+
}
|
|
58
|
+
printSitesHelp();
|
|
59
|
+
};
|
|
60
|
+
exports.sitesCommand = sitesCommand;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sitesLsSubcommand = exports.SITES_LS_SUBCOMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const get_sites_1 = require("../../../api/get-sites");
|
|
7
|
+
const args_1 = require("../../args");
|
|
8
|
+
const get_gcp_region_1 = require("../../get-gcp-region");
|
|
9
|
+
const log_1 = require("../../log");
|
|
10
|
+
exports.SITES_LS_SUBCOMMAND = 'ls';
|
|
11
|
+
const sitesLsSubcommand = async () => {
|
|
12
|
+
// check if --allRegions flag is provided
|
|
13
|
+
// if so, list all sites
|
|
14
|
+
// else, list only the sites that are in the current project
|
|
15
|
+
const allRegions = args_1.parsedCloudrunCli['all-regions'];
|
|
16
|
+
const region = allRegions ? 'all regions' : (0, get_gcp_region_1.getGcpRegion)();
|
|
17
|
+
const { sites, buckets } = await (0, get_sites_1.getSites)(region);
|
|
18
|
+
if (buckets.length > 1 && !cli_1.CliInternals.quietFlagProvided() && !allRegions) {
|
|
19
|
+
log_1.Log.warn(`Warning: You have more than one Remotion Cloud Storage bucket in ${region}, but only one is needed. This can lead to conflicts. Remove all but one of them.`);
|
|
20
|
+
}
|
|
21
|
+
const sitesPluralized = sites.length === 1 ? 'site' : 'sites';
|
|
22
|
+
if (!cli_1.CliInternals.quietFlagProvided()) {
|
|
23
|
+
log_1.Log.info(`${sites.length} ${sitesPluralized} in ${region}, in the ${process.env.REMOTION_GCP_PROJECT_ID} project.`);
|
|
24
|
+
}
|
|
25
|
+
if (cli_1.CliInternals.quietFlagProvided()) {
|
|
26
|
+
if (sites.length === 0) {
|
|
27
|
+
log_1.Log.info('()');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
return log_1.Log.info(sites.map((s) => s.id).join(' '));
|
|
31
|
+
}
|
|
32
|
+
if (sites.length > 0) {
|
|
33
|
+
log_1.Log.info();
|
|
34
|
+
for (const site of sites) {
|
|
35
|
+
log_1.Log.info((0, _1.displaySiteInfo)(site));
|
|
36
|
+
log_1.Log.info();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.sitesLsSubcommand = sitesLsSubcommand;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sitesRmSubcommand = exports.SITES_RM_COMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const delete_site_1 = require("../../../api/delete-site");
|
|
7
|
+
const get_sites_1 = require("../../../api/get-sites");
|
|
8
|
+
const constants_1 = require("../../../shared/constants");
|
|
9
|
+
const get_gcp_region_1 = require("../../get-gcp-region");
|
|
10
|
+
const confirm_1 = require("../../helpers/confirm");
|
|
11
|
+
const quit_1 = require("../../helpers/quit");
|
|
12
|
+
const log_1 = require("../../log");
|
|
13
|
+
const ls_1 = require("./ls");
|
|
14
|
+
exports.SITES_RM_COMMAND = 'rm';
|
|
15
|
+
const sitesRmSubcommand = async (args) => {
|
|
16
|
+
if (args.length === 0) {
|
|
17
|
+
log_1.Log.error('No site name was passed. Run the command again and pass another argument <site-name>.');
|
|
18
|
+
log_1.Log.error(`To get a list of sites, run \`${constants_1.BINARY_NAME} ${_1.SITES_COMMAND} ${ls_1.SITES_LS_SUBCOMMAND}\``);
|
|
19
|
+
(0, quit_1.quit)(1);
|
|
20
|
+
}
|
|
21
|
+
if (args[0] === '()') {
|
|
22
|
+
log_1.Log.info('No sites to remove.');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const region = (0, get_gcp_region_1.getGcpRegion)();
|
|
26
|
+
const infoOutput = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
27
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
28
|
+
cancelSignal: null,
|
|
29
|
+
updatesDontOverwrite: false,
|
|
30
|
+
indent: false,
|
|
31
|
+
});
|
|
32
|
+
infoOutput.update(`Checking ${region} for sites...`, false);
|
|
33
|
+
const deployedSites = await (0, get_sites_1.getSites)(region);
|
|
34
|
+
for (const siteName of args) {
|
|
35
|
+
infoOutput.update('Getting site info...', false);
|
|
36
|
+
const site = deployedSites.sites.find((s) => s.id === siteName.trim());
|
|
37
|
+
if (!site) {
|
|
38
|
+
infoOutput.update('', false);
|
|
39
|
+
throw new Error(`${siteName.trim()} was not found in ${region}.`);
|
|
40
|
+
}
|
|
41
|
+
infoOutput.update((0, _1.displaySiteInfo)(site), false);
|
|
42
|
+
log_1.Log.info();
|
|
43
|
+
log_1.Log.info();
|
|
44
|
+
const confirmDelete = await (0, confirm_1.confirmCli)({
|
|
45
|
+
delMessage: 'Delete? (Y/n)',
|
|
46
|
+
allowForceFlag: true,
|
|
47
|
+
});
|
|
48
|
+
if (!confirmDelete) {
|
|
49
|
+
log_1.Log.info('Aborting.');
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
await (0, delete_site_1.deleteSite)({
|
|
53
|
+
bucketName: site.bucketName,
|
|
54
|
+
siteName,
|
|
55
|
+
});
|
|
56
|
+
log_1.Log.info(`Deleted site ${siteName} from bucket ${site.bucketName}.`);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.sitesRmSubcommand = sitesRmSubcommand;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sitesRmallSubcommand = exports.SITES_RMALL_COMMAND = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const delete_site_1 = require("../../../api/delete-site");
|
|
6
|
+
const get_sites_1 = require("../../../api/get-sites");
|
|
7
|
+
const args_1 = require("../../args");
|
|
8
|
+
const get_gcp_region_1 = require("../../get-gcp-region");
|
|
9
|
+
const confirm_1 = require("../../helpers/confirm");
|
|
10
|
+
const log_1 = require("../../log");
|
|
11
|
+
exports.SITES_RMALL_COMMAND = 'rmall';
|
|
12
|
+
const sitesRmallSubcommand = async () => {
|
|
13
|
+
const allRegions = args_1.parsedCloudrunCli['all-regions'];
|
|
14
|
+
const region = allRegions ? 'all regions' : (0, get_gcp_region_1.getGcpRegion)();
|
|
15
|
+
log_1.Log.info(`Retrieving sites in ${region}.`);
|
|
16
|
+
const deployedSites = await (0, get_sites_1.getSites)(region);
|
|
17
|
+
for (const site of deployedSites.sites) {
|
|
18
|
+
log_1.Log.info();
|
|
19
|
+
log_1.Log.info((0, _1.displaySiteInfo)(site));
|
|
20
|
+
log_1.Log.info();
|
|
21
|
+
const confirmDelete = await (0, confirm_1.confirmCli)({
|
|
22
|
+
delMessage: 'Delete? (Y/n)',
|
|
23
|
+
allowForceFlag: true,
|
|
24
|
+
});
|
|
25
|
+
if (!confirmDelete) {
|
|
26
|
+
log_1.Log.info(`Skipping site - ${site.id}.`);
|
|
27
|
+
log_1.Log.info();
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
await (0, delete_site_1.deleteSite)({
|
|
31
|
+
bucketName: site.bucketName,
|
|
32
|
+
siteName: site.id,
|
|
33
|
+
});
|
|
34
|
+
log_1.Log.info(`Deleted site ${site.id} from bucket ${site.bucketName}.`);
|
|
35
|
+
log_1.Log.info();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.sitesRmallSubcommand = sitesRmallSubcommand;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGcpRegion = void 0;
|
|
4
|
+
const constants_1 = require("../shared/constants");
|
|
5
|
+
const validate_gcp_region_1 = require("../shared/validate-gcp-region");
|
|
6
|
+
const args_1 = require("./args");
|
|
7
|
+
const getGcpRegion = () => {
|
|
8
|
+
if (args_1.parsedCloudrunCli.region) {
|
|
9
|
+
(0, validate_gcp_region_1.validateGcpRegion)(args_1.parsedCloudrunCli.region);
|
|
10
|
+
return args_1.parsedCloudrunCli.region;
|
|
11
|
+
}
|
|
12
|
+
const envVariable = process.env.REMOTION_GCP_REGION;
|
|
13
|
+
if (envVariable) {
|
|
14
|
+
(0, validate_gcp_region_1.validateGcpRegion)(envVariable);
|
|
15
|
+
return envVariable;
|
|
16
|
+
}
|
|
17
|
+
return constants_1.DEFAULT_REGION;
|
|
18
|
+
};
|
|
19
|
+
exports.getGcpRegion = getGcpRegion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const printHelp: () => void;
|
package/dist/cli/help.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.printHelp = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const constants_1 = require("../shared/constants");
|
|
6
|
+
const permissions_1 = require("./commands/permissions");
|
|
7
|
+
const regions_1 = require("./commands/regions");
|
|
8
|
+
const render_1 = require("./commands/render");
|
|
9
|
+
const services_1 = require("./commands/services");
|
|
10
|
+
const sites_1 = require("./commands/sites");
|
|
11
|
+
const log_1 = require("./log");
|
|
12
|
+
const packagejson = require('../../package.json');
|
|
13
|
+
const printHelp = () => {
|
|
14
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${packagejson.version} © ${new Date().getFullYear()} The Remotion developers`);
|
|
15
|
+
log_1.Log.info();
|
|
16
|
+
log_1.Log.info('Available commands:');
|
|
17
|
+
log_1.Log.info('');
|
|
18
|
+
log_1.Log.info();
|
|
19
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${render_1.RENDER_COMMAND}`);
|
|
20
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray('Render Remotion media/still on GCP Cloud Run.'));
|
|
21
|
+
log_1.Log.info();
|
|
22
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${services_1.SERVICES_COMMAND}`);
|
|
23
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray('Deploy and manage Cloud Run services on GCP.'));
|
|
24
|
+
log_1.Log.info();
|
|
25
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${sites_1.SITES_COMMAND}`);
|
|
26
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray('Deploy and manage Remotion projects.'));
|
|
27
|
+
log_1.Log.info();
|
|
28
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${permissions_1.PERMISSIONS_COMMAND}`);
|
|
29
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray('View and validate required GCP permissions.'));
|
|
30
|
+
log_1.Log.info();
|
|
31
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${regions_1.REGIONS_COMMAND}`);
|
|
32
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray('Show the list of GCP regions supported.'));
|
|
33
|
+
};
|
|
34
|
+
exports.printHelp = printHelp;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.confirmCli = void 0;
|
|
4
|
+
const args_1 = require("../args");
|
|
5
|
+
const yes_or_no_1 = require("./yes-or-no");
|
|
6
|
+
const confirmCli = ({ delMessage, allowForceFlag, }) => {
|
|
7
|
+
if (allowForceFlag && args_1.forceFlagProvided) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
return (0, yes_or_no_1.yesOrNo)({ question: delMessage, defaultValue: true });
|
|
11
|
+
};
|
|
12
|
+
exports.confirmCli = confirmCli;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const dateString: (date: Date) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dateString = void 0;
|
|
4
|
+
const dateString = (date) => date.getFullYear() +
|
|
5
|
+
'-' +
|
|
6
|
+
String(date.getMonth() + 1).padStart(2, '0') +
|
|
7
|
+
'-' +
|
|
8
|
+
String(date.getDate()).padStart(2, '0');
|
|
9
|
+
exports.dateString = dateString;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare type BundleProgress = {
|
|
2
|
+
progress: number;
|
|
3
|
+
doneIn: number | null;
|
|
4
|
+
};
|
|
5
|
+
export declare const makeBundleProgress: ({ progress, doneIn }: BundleProgress) => string;
|
|
6
|
+
export declare type BucketCreationProgress = {
|
|
7
|
+
creationState: 'Checking for existing bucket' | 'Creating new bucket' | 'Created bucket' | 'Using existing bucket';
|
|
8
|
+
doneIn: number | null;
|
|
9
|
+
};
|
|
10
|
+
export declare const makeBucketProgress: ({ creationState, doneIn, }: BucketCreationProgress) => string;
|
|
11
|
+
declare type UploadStats = {
|
|
12
|
+
addedFiles: number;
|
|
13
|
+
removedFiles: number;
|
|
14
|
+
untouchedFiles: number;
|
|
15
|
+
};
|
|
16
|
+
export declare type DeployToStorageProgress = {
|
|
17
|
+
sizeUploaded: number;
|
|
18
|
+
totalSize: number | null;
|
|
19
|
+
doneIn: number | null;
|
|
20
|
+
stats: UploadStats | null;
|
|
21
|
+
};
|
|
22
|
+
export declare const makeDeployProgressBar: ({ sizeUploaded, totalSize, doneIn, stats, }: DeployToStorageProgress) => string;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeDeployProgressBar = exports.makeBucketProgress = exports.makeBundleProgress = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
6
|
+
const makeBundleProgress = ({ progress, doneIn }) => {
|
|
7
|
+
return [
|
|
8
|
+
`(1/3)`,
|
|
9
|
+
cli_1.CliInternals.makeProgressBar(progress / 100),
|
|
10
|
+
`${doneIn === null ? 'Bundling' : 'Bundled'} video`,
|
|
11
|
+
doneIn === null
|
|
12
|
+
? `${Math.round(progress)}%`
|
|
13
|
+
: cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
|
|
14
|
+
].join(' ');
|
|
15
|
+
};
|
|
16
|
+
exports.makeBundleProgress = makeBundleProgress;
|
|
17
|
+
const makeBucketProgress = ({ creationState, doneIn, }) => {
|
|
18
|
+
let progress = 0;
|
|
19
|
+
let statesFinished = 0;
|
|
20
|
+
switch (creationState) {
|
|
21
|
+
case 'Checking for existing bucket':
|
|
22
|
+
progress = 1;
|
|
23
|
+
break;
|
|
24
|
+
case 'Creating new bucket':
|
|
25
|
+
progress = 2 / 3;
|
|
26
|
+
statesFinished = 2;
|
|
27
|
+
break;
|
|
28
|
+
case 'Created bucket':
|
|
29
|
+
progress = 3 / 3;
|
|
30
|
+
statesFinished = 3;
|
|
31
|
+
break;
|
|
32
|
+
case 'Using existing bucket':
|
|
33
|
+
progress = 3 / 3;
|
|
34
|
+
statesFinished = 3;
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
progress = 0;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
return [
|
|
41
|
+
`(2/3)`,
|
|
42
|
+
cli_1.CliInternals.makeProgressBar(progress),
|
|
43
|
+
creationState,
|
|
44
|
+
doneIn === null
|
|
45
|
+
? `${statesFinished} / ${3}`
|
|
46
|
+
: cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
|
|
47
|
+
].join(' ');
|
|
48
|
+
};
|
|
49
|
+
exports.makeBucketProgress = makeBucketProgress;
|
|
50
|
+
const makeUploadDiff = ({ stats }) => {
|
|
51
|
+
if (!stats) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
if (stats.addedFiles === 0 && stats.removedFiles === 0) {
|
|
55
|
+
return cli_1.CliInternals.chalk.gray(`(Unchanged)`);
|
|
56
|
+
}
|
|
57
|
+
const total = stats.addedFiles + stats.removedFiles;
|
|
58
|
+
return cli_1.CliInternals.chalk.gray(`(${[
|
|
59
|
+
stats.addedFiles ? `+${stats.addedFiles}` : null,
|
|
60
|
+
stats.removedFiles ? `-${stats.removedFiles}` : null,
|
|
61
|
+
]
|
|
62
|
+
.filter(remotion_1.Internals.truthy)
|
|
63
|
+
.join(',')} ${total === 1 ? 'file' : 'files'})`);
|
|
64
|
+
};
|
|
65
|
+
const makeDeployProgressBar = ({ sizeUploaded, totalSize, doneIn, stats, }) => {
|
|
66
|
+
const progress = totalSize === null ? 0 : sizeUploaded / totalSize;
|
|
67
|
+
return [
|
|
68
|
+
`(3/3)`,
|
|
69
|
+
cli_1.CliInternals.makeProgressBar(progress),
|
|
70
|
+
`${doneIn === null ? 'Uploading' : 'Uploaded'} to GCP Storage Bucket`,
|
|
71
|
+
doneIn === null
|
|
72
|
+
? typeof totalSize === 'number'
|
|
73
|
+
? `${cli_1.CliInternals.formatBytes(sizeUploaded)}/${cli_1.CliInternals.formatBytes(totalSize)}`
|
|
74
|
+
: ''
|
|
75
|
+
: cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
|
|
76
|
+
makeUploadDiff({ stats }),
|
|
77
|
+
]
|
|
78
|
+
.filter(remotion_1.Internals.truthy)
|
|
79
|
+
.join(' ');
|
|
80
|
+
};
|
|
81
|
+
exports.makeDeployProgressBar = makeDeployProgressBar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const quit: (exitCode: number) => never;
|
|
@@ -0,0 +1,44 @@
|
|
|
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.yesOrNo = void 0;
|
|
7
|
+
const readline_1 = __importDefault(require("readline"));
|
|
8
|
+
const options = {
|
|
9
|
+
yes: ['yes', 'y'],
|
|
10
|
+
no: ['no', 'n'],
|
|
11
|
+
};
|
|
12
|
+
function defaultInvalidHandler({ yesValues, noValues, }) {
|
|
13
|
+
process.stdout.write('\nInvalid Response.\n');
|
|
14
|
+
process.stdout.write('Answer either yes : (' + yesValues.join(', ') + ') \n');
|
|
15
|
+
process.stdout.write('Or no: (' + noValues.join(', ') + ') \n\n');
|
|
16
|
+
}
|
|
17
|
+
const yesOrNo = ({ question, defaultValue, }) => {
|
|
18
|
+
const invalid = defaultInvalidHandler;
|
|
19
|
+
const yesValues = options.yes.map((v) => v.toLowerCase());
|
|
20
|
+
const noValues = options.no.map((v) => v.toLowerCase());
|
|
21
|
+
const rl = readline_1.default.createInterface({
|
|
22
|
+
input: process.stdin,
|
|
23
|
+
output: process.stdout,
|
|
24
|
+
});
|
|
25
|
+
return new Promise((resolve) => {
|
|
26
|
+
rl.question(question + ' ', async (answer) => {
|
|
27
|
+
rl.close();
|
|
28
|
+
const cleaned = answer.trim().toLowerCase();
|
|
29
|
+
if (cleaned === '' && defaultValue !== null)
|
|
30
|
+
return resolve(defaultValue);
|
|
31
|
+
if (yesValues.indexOf(cleaned) >= 0)
|
|
32
|
+
return resolve(true);
|
|
33
|
+
if (noValues.indexOf(cleaned) >= 0)
|
|
34
|
+
return resolve(false);
|
|
35
|
+
invalid({ question, yesValues, noValues });
|
|
36
|
+
const result = await (0, exports.yesOrNo)({
|
|
37
|
+
question,
|
|
38
|
+
defaultValue,
|
|
39
|
+
});
|
|
40
|
+
resolve(result);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
exports.yesOrNo = yesOrNo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const executeCommand: (args: string[], remotionRoot: string) => Promise<void>;
|