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,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;;;;"}