@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,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderMediaSubcommand = exports.RENDER_MEDIA_SUBCOMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const render_media_on_cloudrun_1 = require("../../../api/render-media-on-cloudrun");
|
|
6
|
+
// import {validateMaxRetries} from '../../../shared/validate-retries';
|
|
7
|
+
const config_1 = require("@remotion/cli/config");
|
|
8
|
+
const renderer_1 = require("@remotion/renderer");
|
|
9
|
+
const download_file_1 = require("../../../api/download-file");
|
|
10
|
+
const validate_serveurl_1 = require("../../../shared/validate-serveurl");
|
|
11
|
+
const args_1 = require("../../args");
|
|
12
|
+
const log_1 = require("../../log");
|
|
13
|
+
const renderArgsCheck_1 = require("./helpers/renderArgsCheck");
|
|
14
|
+
exports.RENDER_MEDIA_SUBCOMMAND = 'media';
|
|
15
|
+
const renderMediaSubcommand = async (args, remotionRoot) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const { serveUrl, cloudRunUrl, outName, forceBucketName, downloadName, privacy, region, } = await (0, renderArgsCheck_1.renderArgsCheck)(exports.RENDER_MEDIA_SUBCOMMAND, args);
|
|
18
|
+
const { codec, reason: codecReason } = cli_1.CliInternals.getFinalOutputCodec({
|
|
19
|
+
cliFlag: cli_1.CliInternals.parsedCli.codec,
|
|
20
|
+
downloadName,
|
|
21
|
+
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
22
|
+
configFile: (_a = config_1.ConfigInternals.getOutputCodecOrUndefined()) !== null && _a !== void 0 ? _a : null,
|
|
23
|
+
uiCodec: null,
|
|
24
|
+
});
|
|
25
|
+
const imageFormat = args_1.parsedCloudrunCli['image-format'];
|
|
26
|
+
const audioCodec = args_1.parsedCloudrunCli['audio-codec'];
|
|
27
|
+
const { chromiumOptions, crf, envVariables, frameRange, inputProps, logLevel, puppeteerTimeout, pixelFormat, proResProfile, jpegQuality, scale, everyNthFrame, numberOfGifLoops, muted, audioBitrate, videoBitrate, height, width, browserExecutable, port, } = await cli_1.CliInternals.getCliOptions({
|
|
28
|
+
type: 'series',
|
|
29
|
+
isLambda: true,
|
|
30
|
+
remotionRoot,
|
|
31
|
+
});
|
|
32
|
+
let composition = args[1];
|
|
33
|
+
if (!composition) {
|
|
34
|
+
log_1.Log.info('No compositions passed. Fetching compositions...');
|
|
35
|
+
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
36
|
+
const server = renderer_1.RenderInternals.prepareServer({
|
|
37
|
+
concurrency: 1,
|
|
38
|
+
indent: false,
|
|
39
|
+
port,
|
|
40
|
+
remotionRoot,
|
|
41
|
+
verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
|
|
42
|
+
webpackConfigOrServeUrl: serveUrl,
|
|
43
|
+
});
|
|
44
|
+
const { compositionId } = await cli_1.CliInternals.getCompositionWithDimensionOverride({
|
|
45
|
+
args,
|
|
46
|
+
compositionIdFromUi: null,
|
|
47
|
+
browserExecutable,
|
|
48
|
+
chromiumOptions,
|
|
49
|
+
envVariables,
|
|
50
|
+
height,
|
|
51
|
+
indent: false,
|
|
52
|
+
inputProps,
|
|
53
|
+
port,
|
|
54
|
+
puppeteerInstance: undefined,
|
|
55
|
+
serveUrlOrWebpackUrl: serveUrl,
|
|
56
|
+
timeoutInMilliseconds: puppeteerTimeout,
|
|
57
|
+
verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
|
|
58
|
+
width,
|
|
59
|
+
server: await server,
|
|
60
|
+
});
|
|
61
|
+
composition = compositionId;
|
|
62
|
+
}
|
|
63
|
+
// Todo: Check cloudRunUrl is valid, as the error message is obtuse
|
|
64
|
+
cli_1.CliInternals.Log.info(cli_1.CliInternals.chalk.gray(`
|
|
65
|
+
Cloud Run Service URL = ${cloudRunUrl}
|
|
66
|
+
Region = ${region}
|
|
67
|
+
Type = media
|
|
68
|
+
Composition = ${composition}
|
|
69
|
+
Codec = ${codec}
|
|
70
|
+
Output Bucket = ${forceBucketName}
|
|
71
|
+
Output File = ${outName !== null && outName !== void 0 ? outName : 'out.mp4'}
|
|
72
|
+
Output File Privacy = ${privacy}
|
|
73
|
+
${downloadName ? ` Downloaded File = ${downloadName}` : ''}
|
|
74
|
+
`.trim()));
|
|
75
|
+
log_1.Log.info();
|
|
76
|
+
const renderStart = Date.now();
|
|
77
|
+
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
78
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
79
|
+
cancelSignal: null,
|
|
80
|
+
updatesDontOverwrite: false,
|
|
81
|
+
indent: false,
|
|
82
|
+
});
|
|
83
|
+
const renderProgress = {
|
|
84
|
+
doneIn: null,
|
|
85
|
+
progress: 0,
|
|
86
|
+
};
|
|
87
|
+
const updateProgress = () => {
|
|
88
|
+
progressBar.update([
|
|
89
|
+
`Rendering on Cloud Run: `,
|
|
90
|
+
cli_1.CliInternals.makeProgressBar(renderProgress.progress),
|
|
91
|
+
`${renderProgress.doneIn === null ? 'Rendering' : 'Rendered'}`,
|
|
92
|
+
renderProgress.doneIn === null
|
|
93
|
+
? `${Math.round(renderProgress.progress * 100)}%`
|
|
94
|
+
: cli_1.CliInternals.chalk.gray(`${renderProgress.doneIn}ms`),
|
|
95
|
+
].join(' '), false);
|
|
96
|
+
};
|
|
97
|
+
const updateRenderProgress = (progress) => {
|
|
98
|
+
renderProgress.progress = progress;
|
|
99
|
+
updateProgress();
|
|
100
|
+
};
|
|
101
|
+
const res = await (0, render_media_on_cloudrun_1.renderMediaOnCloudrun)({
|
|
102
|
+
cloudRunUrl,
|
|
103
|
+
serveUrl,
|
|
104
|
+
region,
|
|
105
|
+
inputProps,
|
|
106
|
+
codec: codec,
|
|
107
|
+
imageFormat,
|
|
108
|
+
crf: crf !== null && crf !== void 0 ? crf : undefined,
|
|
109
|
+
envVariables,
|
|
110
|
+
pixelFormat,
|
|
111
|
+
proResProfile,
|
|
112
|
+
jpegQuality,
|
|
113
|
+
composition,
|
|
114
|
+
privacy,
|
|
115
|
+
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : undefined,
|
|
116
|
+
outName,
|
|
117
|
+
chromiumOptions,
|
|
118
|
+
scale,
|
|
119
|
+
numberOfGifLoops,
|
|
120
|
+
everyNthFrame,
|
|
121
|
+
muted,
|
|
122
|
+
audioBitrate,
|
|
123
|
+
videoBitrate,
|
|
124
|
+
forceHeight: height,
|
|
125
|
+
forceWidth: width,
|
|
126
|
+
audioCodec,
|
|
127
|
+
forceBucketName,
|
|
128
|
+
updateRenderProgress,
|
|
129
|
+
logLevel: config_1.ConfigInternals.Logging.getLogLevel(),
|
|
130
|
+
});
|
|
131
|
+
renderProgress.doneIn = Date.now() - renderStart;
|
|
132
|
+
updateProgress();
|
|
133
|
+
log_1.Log.info(`
|
|
134
|
+
|
|
135
|
+
`);
|
|
136
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`
|
|
137
|
+
${res.publicUrl ? `Public URL = ${decodeURIComponent(res.publicUrl)}` : ``}
|
|
138
|
+
Cloud Storage Uri = ${res.cloudStorageUri}
|
|
139
|
+
Size (KB) = ${Math.round(Number(res.size) / 1000)}
|
|
140
|
+
Bucket Name = ${res.bucketName}
|
|
141
|
+
Privacy = ${res.privacy}
|
|
142
|
+
Render ID = ${res.renderId}
|
|
143
|
+
Codec = ${codec} (${codecReason})
|
|
144
|
+
`.trim()));
|
|
145
|
+
if (downloadName) {
|
|
146
|
+
log_1.Log.info('');
|
|
147
|
+
log_1.Log.info('downloading file...');
|
|
148
|
+
const destination = await (0, download_file_1.downloadFile)({
|
|
149
|
+
bucketName: res.bucketName,
|
|
150
|
+
gsutilURI: res.cloudStorageUri,
|
|
151
|
+
downloadName,
|
|
152
|
+
});
|
|
153
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`Downloaded file to ${destination}!`));
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
exports.renderMediaSubcommand = renderMediaSubcommand;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderStillSubcommand = exports.RENDER_STILL_SUBCOMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const config_1 = require("@remotion/cli/config");
|
|
6
|
+
const renderer_1 = require("@remotion/renderer");
|
|
7
|
+
const download_file_1 = require("../../../api/download-file");
|
|
8
|
+
const render_still_on_cloudrun_1 = require("../../../api/render-still-on-cloudrun");
|
|
9
|
+
const validate_serveurl_1 = require("../../../shared/validate-serveurl");
|
|
10
|
+
const log_1 = require("../../log");
|
|
11
|
+
const renderArgsCheck_1 = require("./helpers/renderArgsCheck");
|
|
12
|
+
exports.RENDER_STILL_SUBCOMMAND = 'still';
|
|
13
|
+
const renderStillSubcommand = async (args, remotionRoot) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const { serveUrl, cloudRunUrl, outName, forceBucketName, privacy, downloadName, region, } = await (0, renderArgsCheck_1.renderArgsCheck)(exports.RENDER_STILL_SUBCOMMAND, args);
|
|
16
|
+
const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout, jpegQuality, stillFrame, scale, height, width, browserExecutable, port, } = await cli_1.CliInternals.getCliOptions({
|
|
17
|
+
type: 'still',
|
|
18
|
+
isLambda: true,
|
|
19
|
+
remotionRoot,
|
|
20
|
+
});
|
|
21
|
+
let composition = args[1];
|
|
22
|
+
if (!composition) {
|
|
23
|
+
log_1.Log.info('No compositions passed. Fetching compositions...');
|
|
24
|
+
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
25
|
+
const server = renderer_1.RenderInternals.prepareServer({
|
|
26
|
+
concurrency: 1,
|
|
27
|
+
indent: false,
|
|
28
|
+
port,
|
|
29
|
+
remotionRoot,
|
|
30
|
+
verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
|
|
31
|
+
webpackConfigOrServeUrl: serveUrl,
|
|
32
|
+
});
|
|
33
|
+
const { compositionId } = await cli_1.CliInternals.getCompositionWithDimensionOverride({
|
|
34
|
+
args,
|
|
35
|
+
compositionIdFromUi: null,
|
|
36
|
+
indent: false,
|
|
37
|
+
serveUrlOrWebpackUrl: serveUrl,
|
|
38
|
+
verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
|
|
39
|
+
browserExecutable,
|
|
40
|
+
chromiumOptions,
|
|
41
|
+
envVariables,
|
|
42
|
+
inputProps,
|
|
43
|
+
port,
|
|
44
|
+
puppeteerInstance: undefined,
|
|
45
|
+
timeoutInMilliseconds: puppeteerTimeout,
|
|
46
|
+
height,
|
|
47
|
+
width,
|
|
48
|
+
server: await server,
|
|
49
|
+
});
|
|
50
|
+
composition = compositionId;
|
|
51
|
+
}
|
|
52
|
+
const { format: imageFormat, source: imageFormatReason } = cli_1.CliInternals.determineFinalStillImageFormat({
|
|
53
|
+
downloadName,
|
|
54
|
+
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
55
|
+
cliFlag: (_a = cli_1.CliInternals.parsedCli['image-format']) !== null && _a !== void 0 ? _a : null,
|
|
56
|
+
isLambda: true,
|
|
57
|
+
fromUi: null,
|
|
58
|
+
configImageFormat: (_b = config_1.ConfigInternals.getUserPreferredStillImageFormat()) !== null && _b !== void 0 ? _b : null,
|
|
59
|
+
});
|
|
60
|
+
log_1.Log.verbose(`Image format: (${imageFormat}), ${imageFormatReason}`);
|
|
61
|
+
// Todo: Check cloudRunUrl is valid, as the error message is obtuse
|
|
62
|
+
cli_1.CliInternals.Log.info(cli_1.CliInternals.chalk.gray(`
|
|
63
|
+
Cloud Run Service URL = ${cloudRunUrl}
|
|
64
|
+
Region = ${region}
|
|
65
|
+
Type = still
|
|
66
|
+
Composition = ${composition}
|
|
67
|
+
Output Bucket = ${forceBucketName}
|
|
68
|
+
Output File = ${outName !== null && outName !== void 0 ? outName : 'out.png'}
|
|
69
|
+
Output File Privacy = ${privacy}
|
|
70
|
+
${downloadName ? ` Downloaded File = ${downloadName}` : ''}
|
|
71
|
+
`.trim()));
|
|
72
|
+
log_1.Log.info();
|
|
73
|
+
const renderStart = Date.now();
|
|
74
|
+
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
75
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
76
|
+
cancelSignal: null,
|
|
77
|
+
updatesDontOverwrite: false,
|
|
78
|
+
indent: false,
|
|
79
|
+
});
|
|
80
|
+
let doneIn = null;
|
|
81
|
+
const updateProgress = (newline) => {
|
|
82
|
+
progressBar.update([
|
|
83
|
+
`Rendering on Cloud Run:`,
|
|
84
|
+
`${doneIn === null ? '...' : `Rendered in ${doneIn}ms`}`,
|
|
85
|
+
].join(' '), newline);
|
|
86
|
+
};
|
|
87
|
+
const res = await (0, render_still_on_cloudrun_1.renderStillOnCloudrun)({
|
|
88
|
+
cloudRunUrl,
|
|
89
|
+
serveUrl,
|
|
90
|
+
region,
|
|
91
|
+
inputProps,
|
|
92
|
+
imageFormat,
|
|
93
|
+
composition,
|
|
94
|
+
privacy,
|
|
95
|
+
envVariables,
|
|
96
|
+
frame: stillFrame,
|
|
97
|
+
jpegQuality,
|
|
98
|
+
chromiumOptions,
|
|
99
|
+
scale,
|
|
100
|
+
forceHeight: height,
|
|
101
|
+
forceWidth: width,
|
|
102
|
+
forceBucketName,
|
|
103
|
+
outName,
|
|
104
|
+
logLevel: config_1.ConfigInternals.Logging.getLogLevel(),
|
|
105
|
+
});
|
|
106
|
+
doneIn = Date.now() - renderStart;
|
|
107
|
+
updateProgress(true);
|
|
108
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`Cloud Storage Uri = ${res.cloudStorageUri}`));
|
|
109
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`Render ID = ${res.renderId}`));
|
|
110
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`${Math.round(Number(res.size) / 1000)} KB, Privacy: ${res.privacy}, Bucket: ${res.bucketName}`));
|
|
111
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blue(`○ ${res.publicUrl}`));
|
|
112
|
+
if (downloadName) {
|
|
113
|
+
log_1.Log.info('');
|
|
114
|
+
log_1.Log.info('downloading file...');
|
|
115
|
+
const destination = await (0, download_file_1.downloadFile)({
|
|
116
|
+
bucketName: res.bucketName,
|
|
117
|
+
gsutilURI: res.cloudStorageUri,
|
|
118
|
+
downloadName,
|
|
119
|
+
});
|
|
120
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`Downloaded file to ${destination}!`));
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
exports.renderStillSubcommand = renderStillSubcommand;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cloudRunDeploySubcommand = exports.CLOUD_RUN_DEPLOY_SUBCOMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const version_1 = require("remotion/version");
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
const deploy_service_1 = require("../../../api/deploy-service");
|
|
8
|
+
const constants_1 = require("../../../shared/constants");
|
|
9
|
+
const generate_service_name_1 = require("../../../shared/generate-service-name");
|
|
10
|
+
const validate_gcp_region_1 = require("../../../shared/validate-gcp-region");
|
|
11
|
+
const validate_image_remotion_version_1 = require("../../../shared/validate-image-remotion-version");
|
|
12
|
+
const args_1 = require("../../args");
|
|
13
|
+
const get_gcp_region_1 = require("../../get-gcp-region");
|
|
14
|
+
const quit_1 = require("../../helpers/quit");
|
|
15
|
+
const log_1 = require("../../log");
|
|
16
|
+
exports.CLOUD_RUN_DEPLOY_SUBCOMMAND = 'deploy';
|
|
17
|
+
const cloudRunDeploySubcommand = async () => {
|
|
18
|
+
var _a, _b, _c, _d, _e;
|
|
19
|
+
const region = (0, get_gcp_region_1.getGcpRegion)();
|
|
20
|
+
const projectID = process.env.REMOTION_GCP_PROJECT_ID;
|
|
21
|
+
const memoryLimit = String((_a = args_1.parsedCloudrunCli.memoryLimit) !== null && _a !== void 0 ? _a : '2Gi');
|
|
22
|
+
const cpuLimit = String((_b = args_1.parsedCloudrunCli.cpuLimit) !== null && _b !== void 0 ? _b : '1.0');
|
|
23
|
+
const minInstances = String((_c = args_1.parsedCloudrunCli.minInstances) !== null && _c !== void 0 ? _c : constants_1.DEFAULT_MIN_INSTANCES);
|
|
24
|
+
const maxInstances = String((_d = args_1.parsedCloudrunCli.maxInstances) !== null && _d !== void 0 ? _d : constants_1.DEFAULT_MAX_INSTANCES);
|
|
25
|
+
const timeoutSeconds = (_e = args_1.parsedCloudrunCli.timeoutSeconds) !== null && _e !== void 0 ? _e : constants_1.DEFAULT_TIMEOUT;
|
|
26
|
+
if (!cli_1.CliInternals.quietFlagProvided()) {
|
|
27
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`
|
|
28
|
+
Validating Deployment of Cloud Run Service:
|
|
29
|
+
|
|
30
|
+
${[
|
|
31
|
+
'Remotion Version: '.padEnd(_1.LEFT_COL, ' ') + ' ' + version_1.VERSION,
|
|
32
|
+
'Memory Limit: '.padEnd(_1.LEFT_COL, ' ') + ' ' + memoryLimit,
|
|
33
|
+
'CPU Limit: '.padEnd(_1.LEFT_COL, ' ') + ' ' + cpuLimit,
|
|
34
|
+
'Minimum Instances: '.padEnd(_1.LEFT_COL, ' ') + ' ' + minInstances,
|
|
35
|
+
'Maximum Instances: '.padEnd(_1.LEFT_COL, ' ') + ' ' + maxInstances,
|
|
36
|
+
'CPU Limit: '.padEnd(_1.LEFT_COL, ' ') + ' ' + cpuLimit,
|
|
37
|
+
'Timeout: '.padEnd(_1.LEFT_COL, ' ') + ' ' + timeoutSeconds,
|
|
38
|
+
'Project Name: '.padEnd(_1.LEFT_COL, ' ') + ' ' + projectID,
|
|
39
|
+
'Region: '.padEnd(_1.LEFT_COL, ' ') + ' ' + region,
|
|
40
|
+
].join('\n')}
|
|
41
|
+
`.trim()));
|
|
42
|
+
log_1.Log.info();
|
|
43
|
+
}
|
|
44
|
+
(0, validate_gcp_region_1.validateGcpRegion)(region);
|
|
45
|
+
await (0, validate_image_remotion_version_1.validateImageRemotionVersion)();
|
|
46
|
+
if (projectID === undefined) {
|
|
47
|
+
log_1.Log.error(`REMOTION_GCP_PROJECT_ID not found in the .env file.`);
|
|
48
|
+
(0, quit_1.quit)(0);
|
|
49
|
+
}
|
|
50
|
+
// if no existing service, deploy new service
|
|
51
|
+
if (!cli_1.CliInternals.quietFlagProvided()) {
|
|
52
|
+
log_1.Log.info(cli_1.CliInternals.chalk.white('\nDeploying Cloud Run Service...'));
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const deployResult = await (0, deploy_service_1.deployService)({
|
|
56
|
+
performImageVersionValidation: false,
|
|
57
|
+
memoryLimit,
|
|
58
|
+
cpuLimit,
|
|
59
|
+
timeoutSeconds,
|
|
60
|
+
projectID,
|
|
61
|
+
region,
|
|
62
|
+
});
|
|
63
|
+
if (!deployResult.fullName) {
|
|
64
|
+
log_1.Log.error('full service name not returned from Cloud Run API.');
|
|
65
|
+
throw new Error(JSON.stringify(deployResult));
|
|
66
|
+
}
|
|
67
|
+
if (!deployResult.shortName) {
|
|
68
|
+
log_1.Log.error('short service name not returned from Cloud Run API.');
|
|
69
|
+
throw new Error(JSON.stringify(deployResult));
|
|
70
|
+
}
|
|
71
|
+
if (!deployResult.alreadyExists && !deployResult.uri) {
|
|
72
|
+
log_1.Log.error('service uri not returned from Cloud Run API.');
|
|
73
|
+
}
|
|
74
|
+
const consoleUrl = `https://console.cloud.google.com/run/detail/${region}/${deployResult.shortName}/logs`;
|
|
75
|
+
if (deployResult.alreadyExists) {
|
|
76
|
+
log_1.Log.info();
|
|
77
|
+
if (cli_1.CliInternals.quietFlagProvided()) {
|
|
78
|
+
cli_1.CliInternals.Log.info(deployResult.shortName);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`
|
|
82
|
+
Service already exists, skipping deployment;
|
|
83
|
+
|
|
84
|
+
${(0, _1.displayServiceInfo)({
|
|
85
|
+
serviceName: deployResult.shortName,
|
|
86
|
+
timeoutInSeconds: timeoutSeconds,
|
|
87
|
+
memoryLimit,
|
|
88
|
+
cpuLimit,
|
|
89
|
+
remotionVersion: version_1.VERSION,
|
|
90
|
+
uri: deployResult.uri,
|
|
91
|
+
region,
|
|
92
|
+
consoleUrl,
|
|
93
|
+
})}
|
|
94
|
+
`.trim()));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
log_1.Log.info();
|
|
99
|
+
if (cli_1.CliInternals.quietFlagProvided()) {
|
|
100
|
+
cli_1.CliInternals.Log.info(deployResult.shortName);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`
|
|
104
|
+
Cloud Run Deployed!
|
|
105
|
+
|
|
106
|
+
${(0, _1.displayServiceInfo)({
|
|
107
|
+
serviceName: deployResult.shortName,
|
|
108
|
+
timeoutInSeconds: timeoutSeconds,
|
|
109
|
+
memoryLimit,
|
|
110
|
+
cpuLimit,
|
|
111
|
+
remotionVersion: version_1.VERSION,
|
|
112
|
+
uri: deployResult.uri,
|
|
113
|
+
region,
|
|
114
|
+
consoleUrl,
|
|
115
|
+
})}
|
|
116
|
+
`.trim()));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
log_1.Log.error(cli_1.CliInternals.chalk.red(`Failed to deploy service - ${(0, generate_service_name_1.generateServiceName)({
|
|
122
|
+
memoryLimit,
|
|
123
|
+
cpuLimit,
|
|
124
|
+
timeoutSeconds,
|
|
125
|
+
})}.`));
|
|
126
|
+
throw e;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
exports.cloudRunDeploySubcommand = cloudRunDeploySubcommand;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ServiceInfo } from '../../../api/get-service-info';
|
|
2
|
+
export declare const SERVICES_COMMAND = "services";
|
|
3
|
+
export declare const LEFT_COL = 20;
|
|
4
|
+
export declare const displayServiceInfo: (service: ServiceInfo) => string;
|
|
5
|
+
export declare const servicesCommand: (args: string[]) => Promise<void> | undefined;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.servicesCommand = exports.displayServiceInfo = exports.LEFT_COL = exports.SERVICES_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 deploy_1 = require("./deploy");
|
|
9
|
+
const ls_1 = require("./ls");
|
|
10
|
+
const rm_1 = require("./rm");
|
|
11
|
+
const rmall_1 = require("./rmall");
|
|
12
|
+
exports.SERVICES_COMMAND = 'services';
|
|
13
|
+
exports.LEFT_COL = 20;
|
|
14
|
+
const displayServiceInfo = (service) => {
|
|
15
|
+
return [
|
|
16
|
+
'Service name: '.padEnd(exports.LEFT_COL, ' ') + ' ' + service.serviceName,
|
|
17
|
+
'Version: '.padEnd(exports.LEFT_COL, ' ') + ' ' + service.remotionVersion,
|
|
18
|
+
'CPU Limit: '.padEnd(exports.LEFT_COL, ' ') + ' ' + service.cpuLimit,
|
|
19
|
+
'Memory Limit: '.padEnd(exports.LEFT_COL, ' ') + ' ' + service.memoryLimit,
|
|
20
|
+
'Timeout: '.padEnd(exports.LEFT_COL, ' ') + ' ' + service.timeoutInSeconds + 'sec',
|
|
21
|
+
'Region: '.padEnd(exports.LEFT_COL, ' ') + ' ' + service.region,
|
|
22
|
+
'Service URL: '.padEnd(exports.LEFT_COL, ' ') + ' ' + service.uri,
|
|
23
|
+
'GCP Console URL: '.padEnd(exports.LEFT_COL, ' ') + ' ' + service.consoleUrl,
|
|
24
|
+
].join('\n');
|
|
25
|
+
};
|
|
26
|
+
exports.displayServiceInfo = displayServiceInfo;
|
|
27
|
+
const printCloudRunHelp = () => {
|
|
28
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.SERVICES_COMMAND} <subcommand>`);
|
|
29
|
+
log_1.Log.info();
|
|
30
|
+
log_1.Log.info('Available subcommands:');
|
|
31
|
+
cli_1.CliInternals.Log.info('');
|
|
32
|
+
cli_1.CliInternals.Log.info(`${constants_1.BINARY_NAME} ${exports.SERVICES_COMMAND} ${ls_1.SERVICES_LS_SUBCOMMAND}`);
|
|
33
|
+
cli_1.CliInternals.Log.info(cli_1.CliInternals.chalk.gray('Lists the services currently deployed'));
|
|
34
|
+
log_1.Log.info('');
|
|
35
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.SERVICES_COMMAND} ${deploy_1.CLOUD_RUN_DEPLOY_SUBCOMMAND}`);
|
|
36
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray('Deploy a new Cloud Run service'));
|
|
37
|
+
cli_1.CliInternals.Log.info('');
|
|
38
|
+
cli_1.CliInternals.Log.info(`${constants_1.BINARY_NAME} ${exports.SERVICES_COMMAND} ${rm_1.SERVICES_RM_SUBCOMMAND} <service-name>`);
|
|
39
|
+
cli_1.CliInternals.Log.info(cli_1.CliInternals.chalk.gray('Delete a Cloud Run service'));
|
|
40
|
+
cli_1.CliInternals.Log.info('');
|
|
41
|
+
cli_1.CliInternals.Log.info(`${constants_1.BINARY_NAME} ${exports.SERVICES_COMMAND} ${rmall_1.SERVICES_RMALL_SUBCOMMAND}`);
|
|
42
|
+
cli_1.CliInternals.Log.info(cli_1.CliInternals.chalk.gray('Delete all services in selected region'));
|
|
43
|
+
};
|
|
44
|
+
const servicesCommand = (args) => {
|
|
45
|
+
if (args[0] === ls_1.SERVICES_LS_SUBCOMMAND) {
|
|
46
|
+
return (0, ls_1.servicesLsCommand)();
|
|
47
|
+
}
|
|
48
|
+
if (args[0] === rm_1.SERVICES_RM_SUBCOMMAND) {
|
|
49
|
+
return (0, rm_1.servicesRmCommand)(args.slice(1));
|
|
50
|
+
}
|
|
51
|
+
if (args[0] === rmall_1.SERVICES_RMALL_SUBCOMMAND) {
|
|
52
|
+
return (0, rmall_1.servicesRmallCommand)();
|
|
53
|
+
}
|
|
54
|
+
if (args[0] === deploy_1.CLOUD_RUN_DEPLOY_SUBCOMMAND) {
|
|
55
|
+
return (0, deploy_1.cloudRunDeploySubcommand)();
|
|
56
|
+
}
|
|
57
|
+
if (args[0]) {
|
|
58
|
+
log_1.Log.error(`Subcommand ${args[0]} not found.`);
|
|
59
|
+
printCloudRunHelp();
|
|
60
|
+
(0, quit_1.quit)(1);
|
|
61
|
+
}
|
|
62
|
+
printCloudRunHelp();
|
|
63
|
+
};
|
|
64
|
+
exports.servicesCommand = servicesCommand;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.servicesLsCommand = exports.SERVICES_LS_SUBCOMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const get_services_1 = require("../../../api/get-services");
|
|
7
|
+
const get_gcp_region_1 = require("../../get-gcp-region");
|
|
8
|
+
const log_1 = require("../../log");
|
|
9
|
+
exports.SERVICES_LS_SUBCOMMAND = 'ls';
|
|
10
|
+
const servicesLsCommand = async () => {
|
|
11
|
+
const region = (0, get_gcp_region_1.getGcpRegion)();
|
|
12
|
+
const fetchingOutput = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
13
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
14
|
+
cancelSignal: null,
|
|
15
|
+
updatesDontOverwrite: false,
|
|
16
|
+
indent: false,
|
|
17
|
+
});
|
|
18
|
+
fetchingOutput.update(`Getting services in ${region}...`, false);
|
|
19
|
+
const services = await (0, get_services_1.getServices)({
|
|
20
|
+
region,
|
|
21
|
+
compatibleOnly: false,
|
|
22
|
+
});
|
|
23
|
+
if (cli_1.CliInternals.quietFlagProvided()) {
|
|
24
|
+
if (services.length === 0) {
|
|
25
|
+
log_1.Log.info('()');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
log_1.Log.info(services.map((f) => f.serviceName).join(' '));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
fetchingOutput.update('Getting service info...', false);
|
|
32
|
+
const pluralized = services.length === 1 ? 'service' : 'services';
|
|
33
|
+
fetchingOutput.update(`${services.length} ${pluralized} in ${region}`, false);
|
|
34
|
+
log_1.Log.info();
|
|
35
|
+
for (const service of services) {
|
|
36
|
+
log_1.Log.info();
|
|
37
|
+
log_1.Log.info((0, _1.displayServiceInfo)(service));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.servicesLsCommand = servicesLsCommand;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.servicesRmCommand = exports.SERVICES_RM_SUBCOMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const delete_service_1 = require("../../../api/delete-service");
|
|
6
|
+
const get_service_info_1 = require("../../../api/get-service-info");
|
|
7
|
+
const constants_1 = require("../../../shared/constants");
|
|
8
|
+
const get_gcp_region_1 = require("../../get-gcp-region");
|
|
9
|
+
const confirm_1 = require("../../helpers/confirm");
|
|
10
|
+
const quit_1 = require("../../helpers/quit");
|
|
11
|
+
const log_1 = require("../../log");
|
|
12
|
+
const index_1 = require("./index");
|
|
13
|
+
const ls_1 = require("./ls");
|
|
14
|
+
exports.SERVICES_RM_SUBCOMMAND = 'rm';
|
|
15
|
+
const servicesRmCommand = async (args) => {
|
|
16
|
+
if (args.length === 0) {
|
|
17
|
+
log_1.Log.error('No service name passed.');
|
|
18
|
+
log_1.Log.error('Pass another argument which is the name of the service you would like to remove.');
|
|
19
|
+
log_1.Log.info(`You can run \`${constants_1.BINARY_NAME} ${index_1.SERVICES_COMMAND} ${ls_1.SERVICES_LS_SUBCOMMAND}\` to see a list of deployed Cloud Run services.`);
|
|
20
|
+
(0, quit_1.quit)(1);
|
|
21
|
+
}
|
|
22
|
+
if (args[0] === '()') {
|
|
23
|
+
log_1.Log.info('No services to remove.');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const region = (0, get_gcp_region_1.getGcpRegion)();
|
|
27
|
+
for (const serviceName of args) {
|
|
28
|
+
const infoOutput = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
29
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
30
|
+
cancelSignal: null,
|
|
31
|
+
updatesDontOverwrite: false,
|
|
32
|
+
indent: false,
|
|
33
|
+
});
|
|
34
|
+
infoOutput.update('Getting service info...', false);
|
|
35
|
+
const info = await (0, get_service_info_1.getServiceInfo)({
|
|
36
|
+
region,
|
|
37
|
+
serviceName,
|
|
38
|
+
});
|
|
39
|
+
infoOutput.update((0, index_1.displayServiceInfo)(info), false);
|
|
40
|
+
log_1.Log.info();
|
|
41
|
+
const confirmDelete = await (0, confirm_1.confirmCli)({
|
|
42
|
+
delMessage: 'Delete? (Y/n)',
|
|
43
|
+
allowForceFlag: true,
|
|
44
|
+
});
|
|
45
|
+
if (!confirmDelete) {
|
|
46
|
+
log_1.Log.info(`Skipping service - ${info.serviceName}.`);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const output = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
50
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
51
|
+
cancelSignal: null,
|
|
52
|
+
updatesDontOverwrite: false,
|
|
53
|
+
indent: false,
|
|
54
|
+
});
|
|
55
|
+
output.update('Deleting...', false);
|
|
56
|
+
await (0, delete_service_1.deleteService)({
|
|
57
|
+
serviceName,
|
|
58
|
+
region,
|
|
59
|
+
});
|
|
60
|
+
output.update('Deleted!\n', false);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.servicesRmCommand = servicesRmCommand;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.servicesRmallCommand = exports.SERVICES_RMALL_SUBCOMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const delete_service_1 = require("../../../api/delete-service");
|
|
6
|
+
const get_services_1 = require("../../../api/get-services");
|
|
7
|
+
const get_gcp_region_1 = require("../../get-gcp-region");
|
|
8
|
+
const confirm_1 = require("../../helpers/confirm");
|
|
9
|
+
const log_1 = require("../../log");
|
|
10
|
+
const index_1 = require("./index");
|
|
11
|
+
exports.SERVICES_RMALL_SUBCOMMAND = 'rmall';
|
|
12
|
+
const servicesRmallCommand = async () => {
|
|
13
|
+
const region = (0, get_gcp_region_1.getGcpRegion)();
|
|
14
|
+
const fetchingOutput = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
15
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
16
|
+
cancelSignal: null,
|
|
17
|
+
updatesDontOverwrite: false,
|
|
18
|
+
indent: false,
|
|
19
|
+
});
|
|
20
|
+
fetchingOutput.update(`Getting services in ${region}...`, false);
|
|
21
|
+
const services = await (0, get_services_1.getServices)({
|
|
22
|
+
region,
|
|
23
|
+
compatibleOnly: false,
|
|
24
|
+
});
|
|
25
|
+
const pluralized = services.length === 1 ? 'service' : 'services';
|
|
26
|
+
fetchingOutput.update(`${services.length} ${pluralized} in ${region}`, false);
|
|
27
|
+
log_1.Log.info();
|
|
28
|
+
log_1.Log.info();
|
|
29
|
+
for (const serv of services) {
|
|
30
|
+
log_1.Log.info((0, index_1.displayServiceInfo)(serv));
|
|
31
|
+
log_1.Log.info();
|
|
32
|
+
const confirmDelete = await (0, confirm_1.confirmCli)({
|
|
33
|
+
delMessage: 'Delete? (Y/n)',
|
|
34
|
+
allowForceFlag: true,
|
|
35
|
+
});
|
|
36
|
+
if (!confirmDelete) {
|
|
37
|
+
log_1.Log.info(`Skipping service - ${serv.serviceName}.`);
|
|
38
|
+
log_1.Log.info();
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const output = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
42
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
43
|
+
cancelSignal: null,
|
|
44
|
+
updatesDontOverwrite: false,
|
|
45
|
+
indent: false,
|
|
46
|
+
});
|
|
47
|
+
output.update('Deleting...', false);
|
|
48
|
+
await (0, delete_service_1.deleteService)({ region: serv.region, serviceName: serv.serviceName });
|
|
49
|
+
output.update('Deleted!\n', false);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.servicesRmallCommand = servicesRmallCommand;
|