node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
import { Command } from 'commander';
export declare const initializeEnvironmentCommand: (command: Command, ctx: unknown) => Command;
//# sourceMappingURL=command.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/environment/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,4BAA4B,YAAa,OAAO,OAAO,OAAO,KAAG,OAM7E,CAAC"}

View File

@@ -0,0 +1,15 @@
'use strict';
var command = require('../cloud/command.js');
let environmentCmd = null;
const initializeEnvironmentCommand = (command$1, ctx)=>{
if (!environmentCmd) {
const cloud = command.defineCloudNamespace(command$1, ctx);
environmentCmd = cloud.command('environment').description('Manage environments');
}
return environmentCmd;
};
exports.initializeEnvironmentCommand = initializeEnvironmentCommand;
//# sourceMappingURL=command.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"command.js","sources":["../../src/environment/command.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { defineCloudNamespace } from '../cloud/command';\n\nlet environmentCmd: Command | null = null;\n\nexport const initializeEnvironmentCommand = (command: Command, ctx: unknown): Command => {\n if (!environmentCmd) {\n const cloud = defineCloudNamespace(command, ctx);\n environmentCmd = cloud.command('environment').description('Manage environments');\n }\n return environmentCmd;\n};\n"],"names":["environmentCmd","initializeEnvironmentCommand","command","ctx","cloud","defineCloudNamespace","description"],"mappings":";;;;AAGA,IAAIA,cAAiC,GAAA,IAAA;AAE9B,MAAMC,4BAA+B,GAAA,CAACC,SAAkBC,EAAAA,GAAAA,GAAAA;AAC7D,IAAA,IAAI,CAACH,cAAgB,EAAA;QACnB,MAAMI,KAAAA,GAAQC,6BAAqBH,SAASC,EAAAA,GAAAA,CAAAA;AAC5CH,QAAAA,cAAAA,GAAiBI,KAAMF,CAAAA,OAAO,CAAC,aAAA,CAAA,CAAeI,WAAW,CAAC,qBAAA,CAAA;AAC5D;IACA,OAAON,cAAAA;AACT;;;;"}

View File

@@ -0,0 +1,13 @@
import { defineCloudNamespace } from '../cloud/command.mjs';
let environmentCmd = null;
const initializeEnvironmentCommand = (command, ctx)=>{
if (!environmentCmd) {
const cloud = defineCloudNamespace(command, ctx);
environmentCmd = cloud.command('environment').description('Manage environments');
}
return environmentCmd;
};
export { initializeEnvironmentCommand };
//# sourceMappingURL=command.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"command.mjs","sources":["../../src/environment/command.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { defineCloudNamespace } from '../cloud/command';\n\nlet environmentCmd: Command | null = null;\n\nexport const initializeEnvironmentCommand = (command: Command, ctx: unknown): Command => {\n if (!environmentCmd) {\n const cloud = defineCloudNamespace(command, ctx);\n environmentCmd = cloud.command('environment').description('Manage environments');\n }\n return environmentCmd;\n};\n"],"names":["environmentCmd","initializeEnvironmentCommand","command","ctx","cloud","defineCloudNamespace","description"],"mappings":";;AAGA,IAAIA,cAAiC,GAAA,IAAA;AAE9B,MAAMC,4BAA+B,GAAA,CAACC,OAAkBC,EAAAA,GAAAA,GAAAA;AAC7D,IAAA,IAAI,CAACH,cAAgB,EAAA;QACnB,MAAMI,KAAAA,GAAQC,qBAAqBH,OAASC,EAAAA,GAAAA,CAAAA;AAC5CH,QAAAA,cAAAA,GAAiBI,KAAMF,CAAAA,OAAO,CAAC,aAAA,CAAA,CAAeI,WAAW,CAAC,qBAAA,CAAA;AAC5D;IACA,OAAON,cAAAA;AACT;;;;"}

View File

@@ -0,0 +1,4 @@
import type { CLIContext } from '../../types';
declare const _default: (ctx: CLIContext) => Promise<void>;
export default _default;
//# sourceMappingURL=action.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/environment/link/action.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,aAAa,CAAC;8BAkBpC,UAAU;AAArC,wBA+DE"}

View File

@@ -0,0 +1,117 @@
'use strict';
var chalk = require('chalk');
var inquirer = require('inquirer');
var cliApi = require('../../services/cli-api.js');
var strapiInfoSave = require('../../services/strapi-info-save.js');
var token = require('../../services/token.js');
require('fast-safe-stringify');
require('ora');
require('cli-progress');
var action$1 = require('../../login/action.js');
var analytics = require('../../utils/analytics.js');
var getLocalConfig = require('../../utils/get-local-config.js');
const QUIT_OPTION = 'Quit';
var action = (async (ctx)=>{
const { getValidToken } = await token.tokenServiceFactory(ctx);
const token$1 = await getValidToken(ctx, action$1.promptLogin);
const { logger } = ctx;
if (!token$1) {
return;
}
const project = await getLocalConfig.getLocalProject(ctx);
if (!project) {
logger.debug(`No valid local project configuration was found.`);
return;
}
const cloudApiService = await cliApi.cloudApiFactory(ctx, token$1);
const environments = await getEnvironmentsList(ctx, cloudApiService, project);
if (!environments) {
logger.debug(`Fetching environments failed.`);
return;
}
if (environments.length === 0) {
logger.log(`The only available environment is already linked. You can add a new one from your project settings on the Strapi Cloud dashboard.`);
return;
}
const answer = await promptUserForEnvironment(ctx, environments);
if (!answer) {
return;
}
await analytics.trackEvent(ctx, cloudApiService, 'willLinkEnvironment', {
projectName: project.name,
environmentName: answer.targetEnvironment
});
try {
await strapiInfoSave.patch({
project: {
targetEnvironment: answer.targetEnvironment
}
});
} catch (e) {
await analytics.trackEvent(ctx, cloudApiService, 'didNotLinkEnvironment', {
projectName: project.name,
environmentName: answer.targetEnvironment
});
logger.debug('Failed to link environment', e);
logger.error('Failed to link the environment. If this issue persists, try re-linking your project or contact support.');
process.exit(1);
}
logger.log(` You have successfully linked your project to ${chalk.cyan(answer.targetEnvironment)}, on ${chalk.cyan(project.displayName)}. You are now able to deploy your project.`);
await analytics.trackEvent(ctx, cloudApiService, 'didLinkEnvironment', {
projectName: project.name,
environmentName: answer.targetEnvironment
});
});
async function promptUserForEnvironment(ctx, environments) {
const { logger } = ctx;
try {
const answer = await inquirer.prompt([
{
type: 'list',
name: 'targetEnvironment',
message: 'Which environment do you want to link?',
choices: [
...environments,
{
name: chalk.grey(`(${QUIT_OPTION})`),
value: null
}
]
}
]);
if (!answer.targetEnvironment) {
return null;
}
return answer;
} catch (e) {
logger.debug('Failed to get user input', e);
logger.error('An error occurred while trying to get your environment selection.');
return null;
}
}
async function getEnvironmentsList(ctx, cloudApiService, project) {
const spinner = ctx.logger.spinner('Fetching environments...\n').start();
try {
const { data: { data: environmentsList } } = await cloudApiService.listLinkEnvironments({
name: project.name
});
if (!Array.isArray(environmentsList) || environmentsList.length === 0) {
throw new Error('Environments not found in server response');
}
spinner.succeed();
return environmentsList.filter((environment)=>environment.name !== project.targetEnvironment);
} catch (e) {
if (e.response && e.response.status === 404) {
spinner.succeed();
ctx.logger.warn(`\nThe project associated with this folder does not exist in Strapi Cloud. \nPlease link your local project to an existing Strapi Cloud project using the ${chalk.cyan('link')} command.`);
} else {
spinner.fail('An error occurred while fetching environments data from Strapi Cloud.');
ctx.logger.debug('Failed to list environments', e);
}
}
}
module.exports = action;
//# sourceMappingURL=action.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,115 @@
import chalk from 'chalk';
import inquirer from 'inquirer';
import { cloudApiFactory } from '../../services/cli-api.mjs';
import { patch } from '../../services/strapi-info-save.mjs';
import { tokenServiceFactory } from '../../services/token.mjs';
import 'fast-safe-stringify';
import 'ora';
import 'cli-progress';
import { promptLogin } from '../../login/action.mjs';
import { trackEvent } from '../../utils/analytics.mjs';
import { getLocalProject } from '../../utils/get-local-config.mjs';
const QUIT_OPTION = 'Quit';
var action = (async (ctx)=>{
const { getValidToken } = await tokenServiceFactory(ctx);
const token = await getValidToken(ctx, promptLogin);
const { logger } = ctx;
if (!token) {
return;
}
const project = await getLocalProject(ctx);
if (!project) {
logger.debug(`No valid local project configuration was found.`);
return;
}
const cloudApiService = await cloudApiFactory(ctx, token);
const environments = await getEnvironmentsList(ctx, cloudApiService, project);
if (!environments) {
logger.debug(`Fetching environments failed.`);
return;
}
if (environments.length === 0) {
logger.log(`The only available environment is already linked. You can add a new one from your project settings on the Strapi Cloud dashboard.`);
return;
}
const answer = await promptUserForEnvironment(ctx, environments);
if (!answer) {
return;
}
await trackEvent(ctx, cloudApiService, 'willLinkEnvironment', {
projectName: project.name,
environmentName: answer.targetEnvironment
});
try {
await patch({
project: {
targetEnvironment: answer.targetEnvironment
}
});
} catch (e) {
await trackEvent(ctx, cloudApiService, 'didNotLinkEnvironment', {
projectName: project.name,
environmentName: answer.targetEnvironment
});
logger.debug('Failed to link environment', e);
logger.error('Failed to link the environment. If this issue persists, try re-linking your project or contact support.');
process.exit(1);
}
logger.log(` You have successfully linked your project to ${chalk.cyan(answer.targetEnvironment)}, on ${chalk.cyan(project.displayName)}. You are now able to deploy your project.`);
await trackEvent(ctx, cloudApiService, 'didLinkEnvironment', {
projectName: project.name,
environmentName: answer.targetEnvironment
});
});
async function promptUserForEnvironment(ctx, environments) {
const { logger } = ctx;
try {
const answer = await inquirer.prompt([
{
type: 'list',
name: 'targetEnvironment',
message: 'Which environment do you want to link?',
choices: [
...environments,
{
name: chalk.grey(`(${QUIT_OPTION})`),
value: null
}
]
}
]);
if (!answer.targetEnvironment) {
return null;
}
return answer;
} catch (e) {
logger.debug('Failed to get user input', e);
logger.error('An error occurred while trying to get your environment selection.');
return null;
}
}
async function getEnvironmentsList(ctx, cloudApiService, project) {
const spinner = ctx.logger.spinner('Fetching environments...\n').start();
try {
const { data: { data: environmentsList } } = await cloudApiService.listLinkEnvironments({
name: project.name
});
if (!Array.isArray(environmentsList) || environmentsList.length === 0) {
throw new Error('Environments not found in server response');
}
spinner.succeed();
return environmentsList.filter((environment)=>environment.name !== project.targetEnvironment);
} catch (e) {
if (e.response && e.response.status === 404) {
spinner.succeed();
ctx.logger.warn(`\nThe project associated with this folder does not exist in Strapi Cloud. \nPlease link your local project to an existing Strapi Cloud project using the ${chalk.cyan('link')} command.`);
} else {
spinner.fail('An error occurred while fetching environments data from Strapi Cloud.');
ctx.logger.debug('Failed to list environments', e);
}
}
}
export { action as default };
//# sourceMappingURL=action.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import { type StrapiCloudCommand } from '../../types';
declare const command: StrapiCloudCommand;
export default command;
//# sourceMappingURL=command.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/environment/link/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAKtD,QAAA,MAAM,OAAO,EAAE,kBASd,CAAC;AAEF,eAAe,OAAO,CAAC"}

View File

@@ -0,0 +1,13 @@
'use strict';
var helpers = require('../../utils/helpers.js');
var action = require('./action.js');
var command$1 = require('../command.js');
const command = ({ command, ctx })=>{
const environmentCmd = command$1.initializeEnvironmentCommand(command, ctx);
environmentCmd.command('link').description('Link project to a specific Strapi Cloud project environment').option('-d, --debug', 'Enable debugging mode with verbose logs').option('-s, --silent', "Don't log anything").action(()=>helpers.runAction('link', action)(ctx));
};
module.exports = command;
//# sourceMappingURL=command.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"command.js","sources":["../../../src/environment/link/command.ts"],"sourcesContent":["import { type StrapiCloudCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\nimport { initializeEnvironmentCommand } from '../command';\n\nconst command: StrapiCloudCommand = ({ command, ctx }) => {\n const environmentCmd = initializeEnvironmentCommand(command, ctx);\n\n environmentCmd\n .command('link')\n .description('Link project to a specific Strapi Cloud project environment')\n .option('-d, --debug', 'Enable debugging mode with verbose logs')\n .option('-s, --silent', \"Don't log anything\")\n .action(() => runAction('link', action)(ctx));\n};\n\nexport default command;\n"],"names":["command","ctx","environmentCmd","initializeEnvironmentCommand","description","option","action","runAction"],"mappings":";;;;;;AAKA,MAAMA,UAA8B,CAAC,EAAEA,OAAO,EAAEC,GAAG,EAAE,GAAA;IACnD,MAAMC,cAAAA,GAAiBC,uCAA6BH,OAASC,EAAAA,GAAAA,CAAAA;AAE7DC,IAAAA,cAAAA,CACGF,OAAO,CAAC,MAAA,CAAA,CACRI,WAAW,CAAC,6DAAA,CAAA,CACZC,MAAM,CAAC,aAAA,EAAe,2CACtBA,MAAM,CAAC,gBAAgB,oBACvBC,CAAAA,CAAAA,MAAM,CAAC,IAAMC,iBAAAA,CAAU,QAAQD,MAAQL,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA;AAC5C;;;;"}

View File

@@ -0,0 +1,11 @@
import { runAction } from '../../utils/helpers.mjs';
import action from './action.mjs';
import { initializeEnvironmentCommand } from '../command.mjs';
const command = ({ command, ctx })=>{
const environmentCmd = initializeEnvironmentCommand(command, ctx);
environmentCmd.command('link').description('Link project to a specific Strapi Cloud project environment').option('-d, --debug', 'Enable debugging mode with verbose logs').option('-s, --silent', "Don't log anything").action(()=>runAction('link', action)(ctx));
};
export { command as default };
//# sourceMappingURL=command.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"command.mjs","sources":["../../../src/environment/link/command.ts"],"sourcesContent":["import { type StrapiCloudCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\nimport { initializeEnvironmentCommand } from '../command';\n\nconst command: StrapiCloudCommand = ({ command, ctx }) => {\n const environmentCmd = initializeEnvironmentCommand(command, ctx);\n\n environmentCmd\n .command('link')\n .description('Link project to a specific Strapi Cloud project environment')\n .option('-d, --debug', 'Enable debugging mode with verbose logs')\n .option('-s, --silent', \"Don't log anything\")\n .action(() => runAction('link', action)(ctx));\n};\n\nexport default command;\n"],"names":["command","ctx","environmentCmd","initializeEnvironmentCommand","description","option","action","runAction"],"mappings":";;;;AAKA,MAAMA,UAA8B,CAAC,EAAEA,OAAO,EAAEC,GAAG,EAAE,GAAA;IACnD,MAAMC,cAAAA,GAAiBC,6BAA6BH,OAASC,EAAAA,GAAAA,CAAAA;AAE7DC,IAAAA,cAAAA,CACGF,OAAO,CAAC,MAAA,CAAA,CACRI,WAAW,CAAC,6DAAA,CAAA,CACZC,MAAM,CAAC,aAAA,EAAe,2CACtBA,MAAM,CAAC,gBAAgB,oBACvBC,CAAAA,CAAAA,MAAM,CAAC,IAAMC,SAAAA,CAAU,QAAQD,MAAQL,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA;AAC5C;;;;"}

View File

@@ -0,0 +1,7 @@
import action from './action';
import command from './command';
import type { StrapiCloudCommandInfo } from '../../types';
export { action, command };
declare const _default: StrapiCloudCommandInfo;
export default _default;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/environment/link/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;;AAE3B,wBAK4B"}

View File

@@ -0,0 +1,18 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var action = require('./action.js');
var command = require('./command.js');
var linkEnvironment = {
name: 'link-environment',
description: 'Link Strapi Cloud environment to a local project',
action,
command
};
exports.action = action;
exports.command = command;
exports.default = linkEnvironment;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../src/environment/link/index.ts"],"sourcesContent":["import action from './action';\nimport command from './command';\nimport type { StrapiCloudCommandInfo } from '../../types';\n\nexport { action, command };\n\nexport default {\n name: 'link-environment',\n description: 'Link Strapi Cloud environment to a local project',\n action,\n command,\n} as StrapiCloudCommandInfo;\n"],"names":["name","description","action","command"],"mappings":";;;;;;;AAMA,sBAAe;IACbA,IAAM,EAAA,kBAAA;IACNC,WAAa,EAAA,kDAAA;AACbC,IAAAA,MAAAA;AACAC,IAAAA;AACF,CAA4B;;;;;;"}

View File

@@ -0,0 +1,12 @@
import action from './action.mjs';
import command from './command.mjs';
var linkEnvironment = {
name: 'link-environment',
description: 'Link Strapi Cloud environment to a local project',
action,
command
};
export { action, command, linkEnvironment as default };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../src/environment/link/index.ts"],"sourcesContent":["import action from './action';\nimport command from './command';\nimport type { StrapiCloudCommandInfo } from '../../types';\n\nexport { action, command };\n\nexport default {\n name: 'link-environment',\n description: 'Link Strapi Cloud environment to a local project',\n action,\n command,\n} as StrapiCloudCommandInfo;\n"],"names":["name","description","action","command"],"mappings":";;;AAMA,sBAAe;IACbA,IAAM,EAAA,kBAAA;IACNC,WAAa,EAAA,kDAAA;AACbC,IAAAA,MAAAA;AACAC,IAAAA;AACF,CAA4B;;;;"}

View File

@@ -0,0 +1,4 @@
import type { CLIContext } from '../../types';
declare const _default: (ctx: CLIContext) => Promise<void>;
export default _default;
//# sourceMappingURL=action.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/environment/list/action.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;8BAMnB,UAAU;AAArC,wBA8CE"}

View File

@@ -0,0 +1,57 @@
'use strict';
var chalk = require('chalk');
var cliApi = require('../../services/cli-api.js');
require('fs-extra');
require('path');
require('lodash');
var token = require('../../services/token.js');
require('fast-safe-stringify');
require('ora');
require('cli-progress');
var action$1 = require('../../login/action.js');
var analytics = require('../../utils/analytics.js');
var getLocalConfig = require('../../utils/get-local-config.js');
var action = (async (ctx)=>{
const { getValidToken } = await token.tokenServiceFactory(ctx);
const token$1 = await getValidToken(ctx, action$1.promptLogin);
const { logger } = ctx;
if (!token$1) {
return;
}
const project = await getLocalConfig.getLocalProject(ctx);
if (!project) {
ctx.logger.debug(`No valid local project configuration was found.`);
return;
}
const cloudApiService = await cliApi.cloudApiFactory(ctx, token$1);
const spinner = logger.spinner('Fetching environments...').start();
await analytics.trackEvent(ctx, cloudApiService, 'willListEnvironment', {
projectInternalName: project.name
});
try {
const { data: { data: environmentsList } } = await cloudApiService.listEnvironments({
name: project.name
});
spinner.succeed();
logger.log(environmentsList);
await analytics.trackEvent(ctx, cloudApiService, 'didListEnvironment', {
projectInternalName: project.name
});
} catch (e) {
if (e.response && e.response.status === 404) {
spinner.succeed();
logger.warn(`\nThe project associated with this folder does not exist in Strapi Cloud. \nPlease link your local project to an existing Strapi Cloud project using the ${chalk.cyan('link')} command`);
} else {
spinner.fail('An error occurred while fetching environments data from Strapi Cloud.');
logger.debug('Failed to list environments', e);
}
await analytics.trackEvent(ctx, cloudApiService, 'didNotListEnvironment', {
projectInternalName: project.name
});
}
});
module.exports = action;
//# sourceMappingURL=action.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"action.js","sources":["../../../src/environment/list/action.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CLIContext } from '../../types';\nimport { cloudApiFactory, tokenServiceFactory } from '../../services';\nimport { promptLogin } from '../../login/action';\nimport { trackEvent } from '../../utils/analytics';\nimport { getLocalProject } from '../../utils/get-local-config';\n\nexport default async (ctx: CLIContext) => {\n const { getValidToken } = await tokenServiceFactory(ctx);\n const token = await getValidToken(ctx, promptLogin);\n const { logger } = ctx;\n\n if (!token) {\n return;\n }\n\n const project = await getLocalProject(ctx);\n if (!project) {\n ctx.logger.debug(`No valid local project configuration was found.`);\n return;\n }\n\n const cloudApiService = await cloudApiFactory(ctx, token);\n const spinner = logger.spinner('Fetching environments...').start();\n await trackEvent(ctx, cloudApiService, 'willListEnvironment', {\n projectInternalName: project.name,\n });\n\n try {\n const {\n data: { data: environmentsList },\n } = await cloudApiService.listEnvironments({ name: project.name });\n spinner.succeed();\n logger.log(environmentsList);\n await trackEvent(ctx, cloudApiService, 'didListEnvironment', {\n projectInternalName: project.name,\n });\n } catch (e: any) {\n if (e.response && e.response.status === 404) {\n spinner.succeed();\n logger.warn(\n `\\nThe project associated with this folder does not exist in Strapi Cloud. \\nPlease link your local project to an existing Strapi Cloud project using the ${chalk.cyan(\n 'link'\n )} command`\n );\n } else {\n spinner.fail('An error occurred while fetching environments data from Strapi Cloud.');\n logger.debug('Failed to list environments', e);\n }\n await trackEvent(ctx, cloudApiService, 'didNotListEnvironment', {\n projectInternalName: project.name,\n });\n }\n};\n"],"names":["ctx","getValidToken","tokenServiceFactory","token","promptLogin","logger","project","getLocalProject","debug","cloudApiService","cloudApiFactory","spinner","start","trackEvent","projectInternalName","name","data","environmentsList","listEnvironments","succeed","log","e","response","status","warn","chalk","cyan","fail"],"mappings":";;;;;;;;;;;;;;;AAOA,aAAe,CAAA,OAAOA,GAAAA,GAAAA;AACpB,IAAA,MAAM,EAAEC,aAAa,EAAE,GAAG,MAAMC,yBAAoBF,CAAAA,GAAAA,CAAAA;IACpD,MAAMG,OAAAA,GAAQ,MAAMF,aAAAA,CAAcD,GAAKI,EAAAA,oBAAAA,CAAAA;IACvC,MAAM,EAAEC,MAAM,EAAE,GAAGL,GAAAA;AAEnB,IAAA,IAAI,CAACG,OAAO,EAAA;AACV,QAAA;AACF;IAEA,MAAMG,OAAAA,GAAU,MAAMC,8BAAgBP,CAAAA,GAAAA,CAAAA;AACtC,IAAA,IAAI,CAACM,OAAS,EAAA;AACZN,QAAAA,GAAAA,CAAIK,MAAM,CAACG,KAAK,CAAC,CAAC,+CAA+C,CAAC,CAAA;AAClE,QAAA;AACF;IAEA,MAAMC,eAAAA,GAAkB,MAAMC,sBAAAA,CAAgBV,GAAKG,EAAAA,OAAAA,CAAAA;AACnD,IAAA,MAAMQ,OAAUN,GAAAA,MAAAA,CAAOM,OAAO,CAAC,4BAA4BC,KAAK,EAAA;IAChE,MAAMC,oBAAAA,CAAWb,GAAKS,EAAAA,eAAAA,EAAiB,qBAAuB,EAAA;AAC5DK,QAAAA,mBAAAA,EAAqBR,QAAQS;AAC/B,KAAA,CAAA;IAEA,IAAI;QACF,MAAM,EACJC,IAAM,EAAA,EAAEA,IAAMC,EAAAA,gBAAgB,EAAE,EACjC,GAAG,MAAMR,eAAgBS,CAAAA,gBAAgB,CAAC;AAAEH,YAAAA,IAAAA,EAAMT,QAAQS;AAAK,SAAA,CAAA;AAChEJ,QAAAA,OAAAA,CAAQQ,OAAO,EAAA;AACfd,QAAAA,MAAAA,CAAOe,GAAG,CAACH,gBAAAA,CAAAA;QACX,MAAMJ,oBAAAA,CAAWb,GAAKS,EAAAA,eAAAA,EAAiB,oBAAsB,EAAA;AAC3DK,YAAAA,mBAAAA,EAAqBR,QAAQS;AAC/B,SAAA,CAAA;AACF,KAAA,CAAE,OAAOM,CAAQ,EAAA;QACf,IAAIA,CAAAA,CAAEC,QAAQ,IAAID,CAAAA,CAAEC,QAAQ,CAACC,MAAM,KAAK,GAAK,EAAA;AAC3CZ,YAAAA,OAAAA,CAAQQ,OAAO,EAAA;YACfd,MAAOmB,CAAAA,IAAI,CACT,CAAC,yJAAyJ,EAAEC,MAAMC,IAAI,CACpK,MACA,CAAA,CAAA,QAAQ,CAAC,CAAA;SAER,MAAA;AACLf,YAAAA,OAAAA,CAAQgB,IAAI,CAAC,uEAAA,CAAA;YACbtB,MAAOG,CAAAA,KAAK,CAAC,6BAA+Ba,EAAAA,CAAAA,CAAAA;AAC9C;QACA,MAAMR,oBAAAA,CAAWb,GAAKS,EAAAA,eAAAA,EAAiB,uBAAyB,EAAA;AAC9DK,YAAAA,mBAAAA,EAAqBR,QAAQS;AAC/B,SAAA,CAAA;AACF;AACF,CAAA;;;;"}

View File

@@ -0,0 +1,55 @@
import chalk from 'chalk';
import { cloudApiFactory } from '../../services/cli-api.mjs';
import 'fs-extra';
import 'path';
import 'lodash';
import { tokenServiceFactory } from '../../services/token.mjs';
import 'fast-safe-stringify';
import 'ora';
import 'cli-progress';
import { promptLogin } from '../../login/action.mjs';
import { trackEvent } from '../../utils/analytics.mjs';
import { getLocalProject } from '../../utils/get-local-config.mjs';
var action = (async (ctx)=>{
const { getValidToken } = await tokenServiceFactory(ctx);
const token = await getValidToken(ctx, promptLogin);
const { logger } = ctx;
if (!token) {
return;
}
const project = await getLocalProject(ctx);
if (!project) {
ctx.logger.debug(`No valid local project configuration was found.`);
return;
}
const cloudApiService = await cloudApiFactory(ctx, token);
const spinner = logger.spinner('Fetching environments...').start();
await trackEvent(ctx, cloudApiService, 'willListEnvironment', {
projectInternalName: project.name
});
try {
const { data: { data: environmentsList } } = await cloudApiService.listEnvironments({
name: project.name
});
spinner.succeed();
logger.log(environmentsList);
await trackEvent(ctx, cloudApiService, 'didListEnvironment', {
projectInternalName: project.name
});
} catch (e) {
if (e.response && e.response.status === 404) {
spinner.succeed();
logger.warn(`\nThe project associated with this folder does not exist in Strapi Cloud. \nPlease link your local project to an existing Strapi Cloud project using the ${chalk.cyan('link')} command`);
} else {
spinner.fail('An error occurred while fetching environments data from Strapi Cloud.');
logger.debug('Failed to list environments', e);
}
await trackEvent(ctx, cloudApiService, 'didNotListEnvironment', {
projectInternalName: project.name
});
}
});
export { action as default };
//# sourceMappingURL=action.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"action.mjs","sources":["../../../src/environment/list/action.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CLIContext } from '../../types';\nimport { cloudApiFactory, tokenServiceFactory } from '../../services';\nimport { promptLogin } from '../../login/action';\nimport { trackEvent } from '../../utils/analytics';\nimport { getLocalProject } from '../../utils/get-local-config';\n\nexport default async (ctx: CLIContext) => {\n const { getValidToken } = await tokenServiceFactory(ctx);\n const token = await getValidToken(ctx, promptLogin);\n const { logger } = ctx;\n\n if (!token) {\n return;\n }\n\n const project = await getLocalProject(ctx);\n if (!project) {\n ctx.logger.debug(`No valid local project configuration was found.`);\n return;\n }\n\n const cloudApiService = await cloudApiFactory(ctx, token);\n const spinner = logger.spinner('Fetching environments...').start();\n await trackEvent(ctx, cloudApiService, 'willListEnvironment', {\n projectInternalName: project.name,\n });\n\n try {\n const {\n data: { data: environmentsList },\n } = await cloudApiService.listEnvironments({ name: project.name });\n spinner.succeed();\n logger.log(environmentsList);\n await trackEvent(ctx, cloudApiService, 'didListEnvironment', {\n projectInternalName: project.name,\n });\n } catch (e: any) {\n if (e.response && e.response.status === 404) {\n spinner.succeed();\n logger.warn(\n `\\nThe project associated with this folder does not exist in Strapi Cloud. \\nPlease link your local project to an existing Strapi Cloud project using the ${chalk.cyan(\n 'link'\n )} command`\n );\n } else {\n spinner.fail('An error occurred while fetching environments data from Strapi Cloud.');\n logger.debug('Failed to list environments', e);\n }\n await trackEvent(ctx, cloudApiService, 'didNotListEnvironment', {\n projectInternalName: project.name,\n });\n }\n};\n"],"names":["ctx","getValidToken","tokenServiceFactory","token","promptLogin","logger","project","getLocalProject","debug","cloudApiService","cloudApiFactory","spinner","start","trackEvent","projectInternalName","name","data","environmentsList","listEnvironments","succeed","log","e","response","status","warn","chalk","cyan","fail"],"mappings":";;;;;;;;;;;;;AAOA,aAAe,CAAA,OAAOA,GAAAA,GAAAA;AACpB,IAAA,MAAM,EAAEC,aAAa,EAAE,GAAG,MAAMC,mBAAoBF,CAAAA,GAAAA,CAAAA;IACpD,MAAMG,KAAAA,GAAQ,MAAMF,aAAAA,CAAcD,GAAKI,EAAAA,WAAAA,CAAAA;IACvC,MAAM,EAAEC,MAAM,EAAE,GAAGL,GAAAA;AAEnB,IAAA,IAAI,CAACG,KAAO,EAAA;AACV,QAAA;AACF;IAEA,MAAMG,OAAAA,GAAU,MAAMC,eAAgBP,CAAAA,GAAAA,CAAAA;AACtC,IAAA,IAAI,CAACM,OAAS,EAAA;AACZN,QAAAA,GAAAA,CAAIK,MAAM,CAACG,KAAK,CAAC,CAAC,+CAA+C,CAAC,CAAA;AAClE,QAAA;AACF;IAEA,MAAMC,eAAAA,GAAkB,MAAMC,eAAAA,CAAgBV,GAAKG,EAAAA,KAAAA,CAAAA;AACnD,IAAA,MAAMQ,OAAUN,GAAAA,MAAAA,CAAOM,OAAO,CAAC,4BAA4BC,KAAK,EAAA;IAChE,MAAMC,UAAAA,CAAWb,GAAKS,EAAAA,eAAAA,EAAiB,qBAAuB,EAAA;AAC5DK,QAAAA,mBAAAA,EAAqBR,QAAQS;AAC/B,KAAA,CAAA;IAEA,IAAI;QACF,MAAM,EACJC,IAAM,EAAA,EAAEA,IAAMC,EAAAA,gBAAgB,EAAE,EACjC,GAAG,MAAMR,eAAgBS,CAAAA,gBAAgB,CAAC;AAAEH,YAAAA,IAAAA,EAAMT,QAAQS;AAAK,SAAA,CAAA;AAChEJ,QAAAA,OAAAA,CAAQQ,OAAO,EAAA;AACfd,QAAAA,MAAAA,CAAOe,GAAG,CAACH,gBAAAA,CAAAA;QACX,MAAMJ,UAAAA,CAAWb,GAAKS,EAAAA,eAAAA,EAAiB,oBAAsB,EAAA;AAC3DK,YAAAA,mBAAAA,EAAqBR,QAAQS;AAC/B,SAAA,CAAA;AACF,KAAA,CAAE,OAAOM,CAAQ,EAAA;QACf,IAAIA,CAAAA,CAAEC,QAAQ,IAAID,CAAAA,CAAEC,QAAQ,CAACC,MAAM,KAAK,GAAK,EAAA;AAC3CZ,YAAAA,OAAAA,CAAQQ,OAAO,EAAA;YACfd,MAAOmB,CAAAA,IAAI,CACT,CAAC,yJAAyJ,EAAEC,MAAMC,IAAI,CACpK,MACA,CAAA,CAAA,QAAQ,CAAC,CAAA;SAER,MAAA;AACLf,YAAAA,OAAAA,CAAQgB,IAAI,CAAC,uEAAA,CAAA;YACbtB,MAAOG,CAAAA,KAAK,CAAC,6BAA+Ba,EAAAA,CAAAA,CAAAA;AAC9C;QACA,MAAMR,UAAAA,CAAWb,GAAKS,EAAAA,eAAAA,EAAiB,uBAAyB,EAAA;AAC9DK,YAAAA,mBAAAA,EAAqBR,QAAQS;AAC/B,SAAA,CAAA;AACF;AACF,CAAA;;;;"}

View File

@@ -0,0 +1,4 @@
import { type StrapiCloudCommand } from '../../types';
declare const command: StrapiCloudCommand;
export default command;
//# sourceMappingURL=command.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/environment/list/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAKtD,QAAA,MAAM,OAAO,EAAE,kBASd,CAAC;AAEF,eAAe,OAAO,CAAC"}

View File

@@ -0,0 +1,13 @@
'use strict';
var helpers = require('../../utils/helpers.js');
var action = require('./action.js');
var command$1 = require('../command.js');
const command = ({ command, ctx })=>{
const environmentCmd = command$1.initializeEnvironmentCommand(command, ctx);
environmentCmd.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(()=>helpers.runAction('list', action)(ctx));
};
module.exports = command;
//# sourceMappingURL=command.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"command.js","sources":["../../../src/environment/list/command.ts"],"sourcesContent":["import { type StrapiCloudCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\nimport { initializeEnvironmentCommand } from '../command';\n\nconst command: StrapiCloudCommand = ({ command, ctx }) => {\n const environmentCmd = initializeEnvironmentCommand(command, ctx);\n\n environmentCmd\n .command('list')\n .description('List Strapi Cloud project environments')\n .option('-d, --debug', 'Enable debugging mode with verbose logs')\n .option('-s, --silent', \"Don't log anything\")\n .action(() => runAction('list', action)(ctx));\n};\n\nexport default command;\n"],"names":["command","ctx","environmentCmd","initializeEnvironmentCommand","description","option","action","runAction"],"mappings":";;;;;;AAKA,MAAMA,UAA8B,CAAC,EAAEA,OAAO,EAAEC,GAAG,EAAE,GAAA;IACnD,MAAMC,cAAAA,GAAiBC,uCAA6BH,OAASC,EAAAA,GAAAA,CAAAA;AAE7DC,IAAAA,cAAAA,CACGF,OAAO,CAAC,MAAA,CAAA,CACRI,WAAW,CAAC,wCAAA,CAAA,CACZC,MAAM,CAAC,aAAA,EAAe,2CACtBA,MAAM,CAAC,gBAAgB,oBACvBC,CAAAA,CAAAA,MAAM,CAAC,IAAMC,iBAAAA,CAAU,QAAQD,MAAQL,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA;AAC5C;;;;"}

View File

@@ -0,0 +1,11 @@
import { runAction } from '../../utils/helpers.mjs';
import action from './action.mjs';
import { initializeEnvironmentCommand } from '../command.mjs';
const command = ({ command, ctx })=>{
const environmentCmd = initializeEnvironmentCommand(command, ctx);
environmentCmd.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));
};
export { command as default };
//# sourceMappingURL=command.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"command.mjs","sources":["../../../src/environment/list/command.ts"],"sourcesContent":["import { type StrapiCloudCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\nimport { initializeEnvironmentCommand } from '../command';\n\nconst command: StrapiCloudCommand = ({ command, ctx }) => {\n const environmentCmd = initializeEnvironmentCommand(command, ctx);\n\n environmentCmd\n .command('list')\n .description('List Strapi Cloud project environments')\n .option('-d, --debug', 'Enable debugging mode with verbose logs')\n .option('-s, --silent', \"Don't log anything\")\n .action(() => runAction('list', action)(ctx));\n};\n\nexport default command;\n"],"names":["command","ctx","environmentCmd","initializeEnvironmentCommand","description","option","action","runAction"],"mappings":";;;;AAKA,MAAMA,UAA8B,CAAC,EAAEA,OAAO,EAAEC,GAAG,EAAE,GAAA;IACnD,MAAMC,cAAAA,GAAiBC,6BAA6BH,OAASC,EAAAA,GAAAA,CAAAA;AAE7DC,IAAAA,cAAAA,CACGF,OAAO,CAAC,MAAA,CAAA,CACRI,WAAW,CAAC,wCAAA,CAAA,CACZC,MAAM,CAAC,aAAA,EAAe,2CACtBA,MAAM,CAAC,gBAAgB,oBACvBC,CAAAA,CAAAA,MAAM,CAAC,IAAMC,SAAAA,CAAU,QAAQD,MAAQL,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA;AAC5C;;;;"}

View File

@@ -0,0 +1,7 @@
import action from './action';
import command from './command';
import type { StrapiCloudCommandInfo } from '../../types';
export { action, command };
declare const _default: StrapiCloudCommandInfo;
export default _default;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/environment/list/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;;AAE3B,wBAK4B"}

View File

@@ -0,0 +1,18 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var action = require('./action.js');
var command = require('./command.js');
var listEnvironments = {
name: 'list-environments',
description: 'List Strapi Cloud environments',
action,
command
};
exports.action = action;
exports.command = command;
exports.default = listEnvironments;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../src/environment/list/index.ts"],"sourcesContent":["import action from './action';\nimport command from './command';\nimport type { StrapiCloudCommandInfo } from '../../types';\n\nexport { action, command };\n\nexport default {\n name: 'list-environments',\n description: 'List Strapi Cloud environments',\n action,\n command,\n} as StrapiCloudCommandInfo;\n"],"names":["name","description","action","command"],"mappings":";;;;;;;AAMA,uBAAe;IACbA,IAAM,EAAA,mBAAA;IACNC,WAAa,EAAA,gCAAA;AACbC,IAAAA,MAAAA;AACAC,IAAAA;AACF,CAA4B;;;;;;"}

View File

@@ -0,0 +1,12 @@
import action from './action.mjs';
import command from './command.mjs';
var listEnvironments = {
name: 'list-environments',
description: 'List Strapi Cloud environments',
action,
command
};
export { action, command, listEnvironments as default };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../src/environment/list/index.ts"],"sourcesContent":["import action from './action';\nimport command from './command';\nimport type { StrapiCloudCommandInfo } from '../../types';\n\nexport { action, command };\n\nexport default {\n name: 'list-environments',\n description: 'List Strapi Cloud environments',\n action,\n command,\n} as StrapiCloudCommandInfo;\n"],"names":["name","description","action","command"],"mappings":";;;AAMA,uBAAe;IACbA,IAAM,EAAA,mBAAA;IACNC,WAAa,EAAA,gCAAA;AACbC,IAAAA,MAAAA;AACAC,IAAAA;AACF,CAA4B;;;;"}