@strapi/cloud-cli 0.0.0-next.ec9b1b708d4d319f2b8b39d9397bd752d250d541 → 0.0.0-next.eedb036f0a7ac282d2a645d8a40625091bd28b1e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +43 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -13
- package/dist/index.mjs.map +1 -1
- package/dist/src/deploy-project/action.d.ts +1 -0
- package/dist/src/deploy-project/action.d.ts.map +1 -1
- package/dist/src/deploy-project/command.d.ts.map +1 -1
- package/dist/src/environment/link/action.d.ts.map +1 -1
- package/dist/src/services/cli-api.d.ts +8 -1
- package/dist/src/services/cli-api.d.ts.map +1 -1
- package/dist/src/types.d.ts +3 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
25
25
|
const crypto$1 = require("crypto");
|
|
26
26
|
const fse = require("fs-extra");
|
|
27
27
|
const inquirer = require("inquirer");
|
|
28
|
+
const boxen = require("boxen");
|
|
28
29
|
const path = require("path");
|
|
29
30
|
const chalk = require("chalk");
|
|
30
31
|
const axios = require("axios");
|
|
@@ -67,6 +68,7 @@ function _interopNamespace(e) {
|
|
|
67
68
|
const crypto__default = /* @__PURE__ */ _interopDefault(crypto$1);
|
|
68
69
|
const fse__namespace = /* @__PURE__ */ _interopNamespace(fse);
|
|
69
70
|
const inquirer__default = /* @__PURE__ */ _interopDefault(inquirer);
|
|
71
|
+
const boxen__default = /* @__PURE__ */ _interopDefault(boxen);
|
|
70
72
|
const path__namespace = /* @__PURE__ */ _interopNamespace(path);
|
|
71
73
|
const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
72
74
|
const axios__default = /* @__PURE__ */ _interopDefault(axios);
|
|
@@ -241,6 +243,7 @@ const scripts = {
|
|
|
241
243
|
const dependencies = {
|
|
242
244
|
"@strapi/utils": "5.4.0",
|
|
243
245
|
axios: "1.7.4",
|
|
246
|
+
boxen: "5.1.2",
|
|
244
247
|
chalk: "4.1.2",
|
|
245
248
|
"cli-progress": "3.12.0",
|
|
246
249
|
commander: "8.3.0",
|
|
@@ -1137,6 +1140,13 @@ const buildLogsServiceFactory = ({ logger }) => {
|
|
|
1137
1140
|
});
|
|
1138
1141
|
};
|
|
1139
1142
|
};
|
|
1143
|
+
const boxenOptions = {
|
|
1144
|
+
padding: 1,
|
|
1145
|
+
margin: 1,
|
|
1146
|
+
align: "center",
|
|
1147
|
+
borderColor: "yellow",
|
|
1148
|
+
borderStyle: "round"
|
|
1149
|
+
};
|
|
1140
1150
|
const QUIT_OPTION$2 = "Quit";
|
|
1141
1151
|
async function promptForEnvironment(environments) {
|
|
1142
1152
|
const choices = environments.map((env) => ({ name: env, value: env }));
|
|
@@ -1151,16 +1161,6 @@ async function promptForEnvironment(environments) {
|
|
|
1151
1161
|
if (selectedEnvironment === null) {
|
|
1152
1162
|
process.exit(1);
|
|
1153
1163
|
}
|
|
1154
|
-
const { confirm } = await inquirer__default.default.prompt([
|
|
1155
|
-
{
|
|
1156
|
-
type: "confirm",
|
|
1157
|
-
name: "confirm",
|
|
1158
|
-
message: `Do you want to proceed with deployment to ${chalk__default.default.cyan(selectedEnvironment)}?`
|
|
1159
|
-
}
|
|
1160
|
-
]);
|
|
1161
|
-
if (!confirm) {
|
|
1162
|
-
process.exit(1);
|
|
1163
|
-
}
|
|
1164
1164
|
return selectedEnvironment;
|
|
1165
1165
|
}
|
|
1166
1166
|
async function upload(ctx, project, token, maxProjectFileSize) {
|
|
@@ -1285,6 +1285,13 @@ async function getTargetEnvironment(ctx, opts, project, environments) {
|
|
|
1285
1285
|
}
|
|
1286
1286
|
return environments[0];
|
|
1287
1287
|
}
|
|
1288
|
+
function hasPendingOrLiveDeployment(environments, targetEnvironment) {
|
|
1289
|
+
const environment = environments.find((env) => env.name === targetEnvironment);
|
|
1290
|
+
if (!environment) {
|
|
1291
|
+
throw new Error(`Environment details ${targetEnvironment} not found.`);
|
|
1292
|
+
}
|
|
1293
|
+
return environment.hasPendingDeployment || environment.hasLiveDeployment || false;
|
|
1294
|
+
}
|
|
1288
1295
|
const action$5 = async (ctx, opts) => {
|
|
1289
1296
|
const { getValidToken } = await tokenServiceFactory(ctx);
|
|
1290
1297
|
const token = await getValidToken(ctx, promptLogin);
|
|
@@ -1296,13 +1303,17 @@ const action$5 = async (ctx, opts) => {
|
|
|
1296
1303
|
return;
|
|
1297
1304
|
}
|
|
1298
1305
|
const cloudApiService = await cloudApiFactory(ctx, token);
|
|
1306
|
+
let projectData;
|
|
1299
1307
|
let environments;
|
|
1308
|
+
let environmentsDetails;
|
|
1300
1309
|
try {
|
|
1301
1310
|
const {
|
|
1302
|
-
data: { data
|
|
1311
|
+
data: { data, metadata }
|
|
1303
1312
|
} = await cloudApiService.getProject({ name: project.name });
|
|
1304
|
-
|
|
1313
|
+
projectData = data;
|
|
1305
1314
|
environments = projectData.environments;
|
|
1315
|
+
environmentsDetails = projectData.environmentsDetails;
|
|
1316
|
+
const isProjectSuspended = projectData.suspendedAt;
|
|
1306
1317
|
if (isProjectSuspended) {
|
|
1307
1318
|
ctx.logger.log(
|
|
1308
1319
|
"\n Oops! This project has been suspended. \n\n Please reactivate it from the dashboard to continue deploying: "
|
|
@@ -1350,6 +1361,25 @@ Please link your local project to an existing Strapi Cloud project using the ${c
|
|
|
1350
1361
|
maxSize = 1e8;
|
|
1351
1362
|
}
|
|
1352
1363
|
project.targetEnvironment = await getTargetEnvironment(ctx, opts, project, environments);
|
|
1364
|
+
if (!opts.force) {
|
|
1365
|
+
const shouldDisplayWarning = hasPendingOrLiveDeployment(
|
|
1366
|
+
environmentsDetails,
|
|
1367
|
+
project.targetEnvironment
|
|
1368
|
+
);
|
|
1369
|
+
if (shouldDisplayWarning) {
|
|
1370
|
+
ctx.logger.log(boxen__default.default(cliConfig2.projectDeployment.confirmationText, boxenOptions));
|
|
1371
|
+
const { confirm } = await inquirer__default.default.prompt([
|
|
1372
|
+
{
|
|
1373
|
+
type: "confirm",
|
|
1374
|
+
name: "confirm",
|
|
1375
|
+
message: `Do you want to proceed with deployment to ${chalk__default.default.cyan(projectData.displayName)} on ${chalk__default.default.cyan(project.targetEnvironment)} environment?`
|
|
1376
|
+
}
|
|
1377
|
+
]);
|
|
1378
|
+
if (!confirm) {
|
|
1379
|
+
process.exit(1);
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1353
1383
|
const buildId = await upload(ctx, project, token, maxSize);
|
|
1354
1384
|
if (!buildId) {
|
|
1355
1385
|
return;
|
|
@@ -1403,7 +1433,7 @@ const runAction = (name2, action2) => (...args) => {
|
|
|
1403
1433
|
});
|
|
1404
1434
|
};
|
|
1405
1435
|
const command$7 = ({ ctx }) => {
|
|
1406
|
-
return commander.createCommand("cloud:deploy").alias("deploy").description("Deploy a Strapi Cloud project").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").option("-e, --env <name>", "Specify the environment to deploy").action((opts) => runAction("deploy", action$5)(ctx, opts));
|
|
1436
|
+
return commander.createCommand("cloud:deploy").alias("deploy").description("Deploy a Strapi Cloud project").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").option("-f, --force", "Skip confirmation to deploy").option("-e, --env <name>", "Specify the environment to deploy").action((opts) => runAction("deploy", action$5)(ctx, opts));
|
|
1407
1437
|
};
|
|
1408
1438
|
const deployProject = {
|
|
1409
1439
|
name: "deploy-project",
|