@strapi/cloud-cli 5.0.5 → 5.0.6
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 +32 -121
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -121
- package/dist/index.mjs.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/services/cli-api.d.ts +0 -9
- package/dist/src/services/cli-api.d.ts.map +1 -1
- package/dist/src/types.d.ts +0 -3
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/src/cloud/command.d.ts +0 -3
- package/dist/src/cloud/command.d.ts.map +0 -1
- package/dist/src/environment/command.d.ts +0 -3
- package/dist/src/environment/command.d.ts.map +0 -1
- package/dist/src/environment/list/action.d.ts +0 -4
- package/dist/src/environment/list/action.d.ts.map +0 -1
- package/dist/src/environment/list/command.d.ts +0 -4
- package/dist/src/environment/list/command.d.ts.map +0 -1
- package/dist/src/environment/list/index.d.ts +0 -7
- package/dist/src/environment/list/index.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -193,7 +193,7 @@ async function saveLocalConfig(data) {
|
|
|
193
193
|
await fse__namespace.default.writeJson(configFilePath, data, { encoding: "utf8", spaces: 2, mode: 384 });
|
|
194
194
|
}
|
|
195
195
|
const name = "@strapi/cloud-cli";
|
|
196
|
-
const version = "5.0.
|
|
196
|
+
const version = "5.0.0";
|
|
197
197
|
const description = "Commands to interact with the Strapi Cloud";
|
|
198
198
|
const keywords = [
|
|
199
199
|
"strapi",
|
|
@@ -267,7 +267,7 @@ const devDependencies = {
|
|
|
267
267
|
tsconfig: "workspace:*"
|
|
268
268
|
};
|
|
269
269
|
const engines = {
|
|
270
|
-
node: ">=18.0.0 <=
|
|
270
|
+
node: ">=18.0.0 <=20.x.x",
|
|
271
271
|
npm: ">=6.0.0"
|
|
272
272
|
};
|
|
273
273
|
const packageJson = {
|
|
@@ -388,20 +388,6 @@ async function cloudApiFactory({ logger }, token) {
|
|
|
388
388
|
throw error;
|
|
389
389
|
}
|
|
390
390
|
},
|
|
391
|
-
async listEnvironments({ name: name2 }) {
|
|
392
|
-
try {
|
|
393
|
-
const response = await axiosCloudAPI.get(`/projects/${name2}/environments`);
|
|
394
|
-
if (response.status !== 200) {
|
|
395
|
-
throw new Error("Error fetching cloud environments from the server.");
|
|
396
|
-
}
|
|
397
|
-
return response;
|
|
398
|
-
} catch (error) {
|
|
399
|
-
logger.debug(
|
|
400
|
-
"🥲 Oops! Couldn't retrieve your project's environments from the server. Please try again."
|
|
401
|
-
);
|
|
402
|
-
throw error;
|
|
403
|
-
}
|
|
404
|
-
},
|
|
405
391
|
async getProject({ name: name2 }) {
|
|
406
392
|
try {
|
|
407
393
|
const response = await axiosCloudAPI.get(`/projects/${name2}`);
|
|
@@ -974,7 +960,7 @@ async function createProject$1(ctx, cloudApi, projectInput) {
|
|
|
974
960
|
throw e;
|
|
975
961
|
}
|
|
976
962
|
}
|
|
977
|
-
const action$
|
|
963
|
+
const action$4 = async (ctx) => {
|
|
978
964
|
const { logger } = ctx;
|
|
979
965
|
const { getValidToken, eraseToken } = await tokenServiceFactory(ctx);
|
|
980
966
|
const token = await getValidToken(ctx, promptLogin);
|
|
@@ -1181,11 +1167,11 @@ async function upload(ctx, project, token, maxProjectFileSize) {
|
|
|
1181
1167
|
process.exit(1);
|
|
1182
1168
|
}
|
|
1183
1169
|
}
|
|
1184
|
-
async function getProject
|
|
1170
|
+
async function getProject(ctx) {
|
|
1185
1171
|
const { project } = await retrieve();
|
|
1186
1172
|
if (!project) {
|
|
1187
1173
|
try {
|
|
1188
|
-
return await action$
|
|
1174
|
+
return await action$4(ctx);
|
|
1189
1175
|
} catch (e) {
|
|
1190
1176
|
ctx.logger.error("An error occurred while deploying the project. Please try again later.");
|
|
1191
1177
|
ctx.logger.debug(e);
|
|
@@ -1206,13 +1192,13 @@ async function getConfig({
|
|
|
1206
1192
|
return null;
|
|
1207
1193
|
}
|
|
1208
1194
|
}
|
|
1209
|
-
const action$
|
|
1195
|
+
const action$3 = async (ctx) => {
|
|
1210
1196
|
const { getValidToken } = await tokenServiceFactory(ctx);
|
|
1211
1197
|
const token = await getValidToken(ctx, promptLogin);
|
|
1212
1198
|
if (!token) {
|
|
1213
1199
|
return;
|
|
1214
1200
|
}
|
|
1215
|
-
const project = await getProject
|
|
1201
|
+
const project = await getProject(ctx);
|
|
1216
1202
|
if (!project) {
|
|
1217
1203
|
return;
|
|
1218
1204
|
}
|
|
@@ -1317,14 +1303,14 @@ const runAction = (name2, action2) => (...args) => {
|
|
|
1317
1303
|
process.exit(1);
|
|
1318
1304
|
});
|
|
1319
1305
|
};
|
|
1320
|
-
const command$
|
|
1321
|
-
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").action(() => runAction("deploy", action$
|
|
1306
|
+
const command$5 = ({ ctx }) => {
|
|
1307
|
+
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").action(() => runAction("deploy", action$3)(ctx));
|
|
1322
1308
|
};
|
|
1323
1309
|
const deployProject = {
|
|
1324
1310
|
name: "deploy-project",
|
|
1325
1311
|
description: "Deploy a Strapi Cloud project",
|
|
1326
|
-
action: action$
|
|
1327
|
-
command: command$
|
|
1312
|
+
action: action$3,
|
|
1313
|
+
command: command$5
|
|
1328
1314
|
};
|
|
1329
1315
|
const QUIT_OPTION = "Quit";
|
|
1330
1316
|
async function getExistingConfig(ctx) {
|
|
@@ -1408,7 +1394,7 @@ async function getUserSelection(ctx, projects) {
|
|
|
1408
1394
|
return null;
|
|
1409
1395
|
}
|
|
1410
1396
|
}
|
|
1411
|
-
const action$
|
|
1397
|
+
const action$2 = async (ctx) => {
|
|
1412
1398
|
const { getValidToken } = await tokenServiceFactory(ctx);
|
|
1413
1399
|
const token = await getValidToken(ctx, promptLogin);
|
|
1414
1400
|
const { logger } = ctx;
|
|
@@ -1463,16 +1449,16 @@ const action$3 = async (ctx) => {
|
|
|
1463
1449
|
});
|
|
1464
1450
|
}
|
|
1465
1451
|
};
|
|
1466
|
-
const command$
|
|
1467
|
-
command2.command("cloud:link").alias("link").description("Link a local directory to a Strapi Cloud project").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("link", action$
|
|
1452
|
+
const command$4 = ({ command: command2, ctx }) => {
|
|
1453
|
+
command2.command("cloud:link").alias("link").description("Link a local directory to a Strapi Cloud project").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("link", action$2)(ctx));
|
|
1468
1454
|
};
|
|
1469
1455
|
const link = {
|
|
1470
1456
|
name: "link-project",
|
|
1471
1457
|
description: "Link a local directory to a Strapi Cloud project",
|
|
1472
|
-
action: action$
|
|
1473
|
-
command: command$
|
|
1458
|
+
action: action$2,
|
|
1459
|
+
command: command$4
|
|
1474
1460
|
};
|
|
1475
|
-
const command$
|
|
1461
|
+
const command$3 = ({ ctx }) => {
|
|
1476
1462
|
return commander.createCommand("cloud:login").alias("login").description("Strapi Cloud Login").addHelpText(
|
|
1477
1463
|
"after",
|
|
1478
1464
|
"\nAfter running this command, you will be prompted to enter your authentication information."
|
|
@@ -1482,10 +1468,10 @@ const login = {
|
|
|
1482
1468
|
name: "login",
|
|
1483
1469
|
description: "Strapi Cloud Login",
|
|
1484
1470
|
action: loginAction,
|
|
1485
|
-
command: command$
|
|
1471
|
+
command: command$3
|
|
1486
1472
|
};
|
|
1487
1473
|
const openModule = import("open");
|
|
1488
|
-
const action$
|
|
1474
|
+
const action$1 = async (ctx) => {
|
|
1489
1475
|
const { logger } = ctx;
|
|
1490
1476
|
const { retrieveToken, eraseToken } = await tokenServiceFactory(ctx);
|
|
1491
1477
|
const token = await retrieveToken();
|
|
@@ -1517,25 +1503,25 @@ const action$2 = async (ctx) => {
|
|
|
1517
1503
|
}
|
|
1518
1504
|
await trackEvent(ctx, cloudApiService, "didLogout", { loginMethod: "cli" });
|
|
1519
1505
|
};
|
|
1520
|
-
const command$
|
|
1521
|
-
return commander.createCommand("cloud:logout").alias("logout").description("Strapi Cloud Logout").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("logout", action$
|
|
1506
|
+
const command$2 = ({ ctx }) => {
|
|
1507
|
+
return commander.createCommand("cloud:logout").alias("logout").description("Strapi Cloud Logout").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("logout", action$1)(ctx));
|
|
1522
1508
|
};
|
|
1523
1509
|
const logout = {
|
|
1524
1510
|
name: "logout",
|
|
1525
1511
|
description: "Strapi Cloud Logout",
|
|
1526
|
-
action: action$
|
|
1527
|
-
command: command$
|
|
1512
|
+
action: action$1,
|
|
1513
|
+
command: command$2
|
|
1528
1514
|
};
|
|
1529
|
-
const command$
|
|
1530
|
-
return commander.createCommand("cloud:create-project").description("Create a Strapi Cloud project").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("cloud:create-project", action$
|
|
1515
|
+
const command$1 = ({ ctx }) => {
|
|
1516
|
+
return commander.createCommand("cloud:create-project").description("Create a Strapi Cloud project").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("cloud:create-project", action$4)(ctx));
|
|
1531
1517
|
};
|
|
1532
1518
|
const createProject = {
|
|
1533
1519
|
name: "create-project",
|
|
1534
1520
|
description: "Create a new project",
|
|
1535
|
-
action: action$
|
|
1536
|
-
command: command$
|
|
1521
|
+
action: action$4,
|
|
1522
|
+
command: command$1
|
|
1537
1523
|
};
|
|
1538
|
-
const action
|
|
1524
|
+
const action = async (ctx) => {
|
|
1539
1525
|
const { getValidToken } = await tokenServiceFactory(ctx);
|
|
1540
1526
|
const token = await getValidToken(ctx, promptLogin);
|
|
1541
1527
|
const { logger } = ctx;
|
|
@@ -1555,86 +1541,12 @@ const action$1 = async (ctx) => {
|
|
|
1555
1541
|
spinner.fail("An error occurred while fetching your projects from Strapi Cloud.");
|
|
1556
1542
|
}
|
|
1557
1543
|
};
|
|
1558
|
-
const command
|
|
1559
|
-
command2.command("cloud:projects").alias("projects").description("List Strapi Cloud projects").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("projects", action
|
|
1544
|
+
const command = ({ command: command2, ctx }) => {
|
|
1545
|
+
command2.command("cloud:projects").alias("projects").description("List Strapi Cloud projects").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("projects", action)(ctx));
|
|
1560
1546
|
};
|
|
1561
1547
|
const listProjects = {
|
|
1562
1548
|
name: "list-projects",
|
|
1563
1549
|
description: "List Strapi Cloud projects",
|
|
1564
|
-
action: action$1,
|
|
1565
|
-
command: command$1
|
|
1566
|
-
};
|
|
1567
|
-
async function getProject(ctx) {
|
|
1568
|
-
const { project } = await retrieve();
|
|
1569
|
-
if (!project) {
|
|
1570
|
-
ctx.logger.warn(
|
|
1571
|
-
`
|
|
1572
|
-
We couldn't find a valid local project config.
|
|
1573
|
-
Please link your local project to an existing Strapi Cloud project using the ${chalk__default.default.cyan(
|
|
1574
|
-
"link"
|
|
1575
|
-
)} command`
|
|
1576
|
-
);
|
|
1577
|
-
process.exit(1);
|
|
1578
|
-
}
|
|
1579
|
-
return project;
|
|
1580
|
-
}
|
|
1581
|
-
const action = async (ctx) => {
|
|
1582
|
-
const { getValidToken } = await tokenServiceFactory(ctx);
|
|
1583
|
-
const token = await getValidToken(ctx, promptLogin);
|
|
1584
|
-
const { logger } = ctx;
|
|
1585
|
-
if (!token) {
|
|
1586
|
-
return;
|
|
1587
|
-
}
|
|
1588
|
-
const project = await getProject(ctx);
|
|
1589
|
-
if (!project) {
|
|
1590
|
-
ctx.logger.debug(`No valid local project configuration was found.`);
|
|
1591
|
-
return;
|
|
1592
|
-
}
|
|
1593
|
-
const cloudApiService = await cloudApiFactory(ctx, token);
|
|
1594
|
-
const spinner = logger.spinner("Fetching environments...").start();
|
|
1595
|
-
await trackEvent(ctx, cloudApiService, "willListEnvironment", {
|
|
1596
|
-
projectInternalName: project.name
|
|
1597
|
-
});
|
|
1598
|
-
try {
|
|
1599
|
-
const {
|
|
1600
|
-
data: { data: environmentsList }
|
|
1601
|
-
} = await cloudApiService.listEnvironments({ name: project.name });
|
|
1602
|
-
spinner.succeed();
|
|
1603
|
-
logger.log(environmentsList);
|
|
1604
|
-
await trackEvent(ctx, cloudApiService, "didListEnvironment", {
|
|
1605
|
-
projectInternalName: project.name
|
|
1606
|
-
});
|
|
1607
|
-
} catch (e) {
|
|
1608
|
-
if (e.response && e.response.status === 404) {
|
|
1609
|
-
spinner.succeed();
|
|
1610
|
-
logger.warn(
|
|
1611
|
-
`
|
|
1612
|
-
The project associated with this folder does not exist in Strapi Cloud.
|
|
1613
|
-
Please link your local project to an existing Strapi Cloud project using the ${chalk__default.default.cyan(
|
|
1614
|
-
"link"
|
|
1615
|
-
)} command`
|
|
1616
|
-
);
|
|
1617
|
-
} else {
|
|
1618
|
-
spinner.fail("An error occurred while fetching environments data from Strapi Cloud.");
|
|
1619
|
-
logger.debug("Failed to list environments", e);
|
|
1620
|
-
}
|
|
1621
|
-
await trackEvent(ctx, cloudApiService, "didNotListEnvironment", {
|
|
1622
|
-
projectInternalName: project.name
|
|
1623
|
-
});
|
|
1624
|
-
}
|
|
1625
|
-
};
|
|
1626
|
-
function defineCloudNamespace(command2) {
|
|
1627
|
-
return command2.command("cloud").description("Manage Strapi Cloud projects");
|
|
1628
|
-
}
|
|
1629
|
-
const command = ({ command: command2, ctx }) => {
|
|
1630
|
-
const cloud = defineCloudNamespace(command2);
|
|
1631
|
-
cloud.command("environments").description("Alias for cloud environment list").action(() => runAction("list", action)(ctx));
|
|
1632
|
-
const environment = cloud.command("environment").description("Manage environments for a Strapi Cloud project");
|
|
1633
|
-
environment.command("list").description("List Strapi Cloud project environments").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("list", action)(ctx));
|
|
1634
|
-
};
|
|
1635
|
-
const listEnvironments = {
|
|
1636
|
-
name: "list-environments",
|
|
1637
|
-
description: "List Strapi Cloud environments",
|
|
1638
1550
|
action,
|
|
1639
1551
|
command
|
|
1640
1552
|
};
|
|
@@ -1644,10 +1556,9 @@ const cli = {
|
|
|
1644
1556
|
login,
|
|
1645
1557
|
logout,
|
|
1646
1558
|
createProject,
|
|
1647
|
-
listProjects
|
|
1648
|
-
listEnvironments
|
|
1559
|
+
listProjects
|
|
1649
1560
|
};
|
|
1650
|
-
const cloudCommands = [deployProject, link, login, logout, listProjects
|
|
1561
|
+
const cloudCommands = [deployProject, link, login, logout, listProjects];
|
|
1651
1562
|
async function initCloudCLIConfig() {
|
|
1652
1563
|
const localConfig = await getLocalConfig();
|
|
1653
1564
|
if (!localConfig.deviceId) {
|