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/link/action.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;8BAuIhB,UAAU;AAArC,wBAoEE"}

View File

@@ -0,0 +1,146 @@
'use strict';
var inquirer = require('inquirer');
var chalk = require('chalk');
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';
async function promptForRelink(ctx, cloudApiService, existingConfig) {
if (existingConfig && existingConfig.project) {
const { shouldRelink } = await inquirer.prompt([
{
type: 'confirm',
name: 'shouldRelink',
message: `A project named ${chalk.cyan(existingConfig.project.displayName ? existingConfig.project.displayName : existingConfig.project.name)} is already linked to this local folder. Do you want to update the link?`,
default: false
}
]);
if (!shouldRelink) {
await analytics.trackEvent(ctx, cloudApiService, 'didNotLinkProject', {
currentProjectName: existingConfig.project?.name
});
return false;
}
}
return true;
}
async function getProjectsList(ctx, cloudApiService, existingConfig) {
const spinner = ctx.logger.spinner('Fetching your projects...\n').start();
try {
const { data: { data: projectList } } = await cloudApiService.listLinkProjects();
spinner.succeed();
if (!Array.isArray(projectList)) {
ctx.logger.log("We couldn't find any projects available for linking in Strapi Cloud.");
return null;
}
const projects = projectList.filter((project)=>!(project.isMaintainer || project.name === existingConfig?.project?.name)).map((project)=>{
return {
name: project.displayName,
value: {
name: project.name,
displayName: project.displayName
}
};
});
if (projects.length === 0) {
ctx.logger.log("We couldn't find any projects available for linking in Strapi Cloud.");
return null;
}
return projects;
} catch (e) {
spinner.fail('An error occurred while fetching your projects from Strapi Cloud.');
ctx.logger.debug('Failed to list projects', e);
return null;
}
}
async function getUserSelection(ctx, projects) {
const { logger } = ctx;
try {
const answer = await inquirer.prompt([
{
type: 'list',
name: 'linkProject',
message: 'Which project do you want to link?',
choices: [
...projects,
{
name: chalk.grey(`(${QUIT_OPTION})`),
value: null
}
]
}
]);
if (!answer.linkProject) {
return null;
}
return answer;
} catch (e) {
logger.debug('Failed to get user input', e);
logger.error('An error occurred while trying to get your input.');
return null;
}
}
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 cloudApiService = await cliApi.cloudApiFactory(ctx, token$1);
const existingConfig = await getLocalConfig.getLocalConfig(ctx);
const shouldRelink = await promptForRelink(ctx, cloudApiService, existingConfig);
if (!shouldRelink) {
return;
}
await analytics.trackEvent(ctx, cloudApiService, 'willLinkProject', {});
const projects = await getProjectsList(ctx, cloudApiService, existingConfig);
if (!projects) {
return;
}
const answer = await getUserSelection(ctx, projects);
if (!answer) {
return;
}
try {
const { confirmAction } = await inquirer.prompt([
{
type: 'confirm',
name: 'confirmAction',
message: 'Warning: Once linked, deploying from CLI will replace the existing project and its data. Confirm to proceed:',
default: false
}
]);
if (!confirmAction) {
await analytics.trackEvent(ctx, cloudApiService, 'didNotLinkProject', {
cancelledProjectName: answer.linkProject.name,
currentProjectName: existingConfig ? existingConfig.project?.name : null
});
return;
}
await strapiInfoSave.save({
project: answer.linkProject
});
logger.log(` You have successfully linked your project to ${chalk.cyan(answer.linkProject.displayName)}. You are now able to deploy your project.`);
await analytics.trackEvent(ctx, cloudApiService, 'didLinkProject', {
projectInternalName: answer.linkProject
});
} catch (e) {
logger.debug('Failed to link project', e);
logger.error('An error occurred while linking the project.');
await analytics.trackEvent(ctx, cloudApiService, 'didNotLinkProject', {
projectInternalName: answer.linkProject
});
}
});
module.exports = action;
//# sourceMappingURL=action.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,144 @@
import inquirer from 'inquirer';
import chalk from 'chalk';
import { cloudApiFactory } from '../services/cli-api.mjs';
import { save } 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 { getLocalConfig } from '../utils/get-local-config.mjs';
const QUIT_OPTION = 'Quit';
async function promptForRelink(ctx, cloudApiService, existingConfig) {
if (existingConfig && existingConfig.project) {
const { shouldRelink } = await inquirer.prompt([
{
type: 'confirm',
name: 'shouldRelink',
message: `A project named ${chalk.cyan(existingConfig.project.displayName ? existingConfig.project.displayName : existingConfig.project.name)} is already linked to this local folder. Do you want to update the link?`,
default: false
}
]);
if (!shouldRelink) {
await trackEvent(ctx, cloudApiService, 'didNotLinkProject', {
currentProjectName: existingConfig.project?.name
});
return false;
}
}
return true;
}
async function getProjectsList(ctx, cloudApiService, existingConfig) {
const spinner = ctx.logger.spinner('Fetching your projects...\n').start();
try {
const { data: { data: projectList } } = await cloudApiService.listLinkProjects();
spinner.succeed();
if (!Array.isArray(projectList)) {
ctx.logger.log("We couldn't find any projects available for linking in Strapi Cloud.");
return null;
}
const projects = projectList.filter((project)=>!(project.isMaintainer || project.name === existingConfig?.project?.name)).map((project)=>{
return {
name: project.displayName,
value: {
name: project.name,
displayName: project.displayName
}
};
});
if (projects.length === 0) {
ctx.logger.log("We couldn't find any projects available for linking in Strapi Cloud.");
return null;
}
return projects;
} catch (e) {
spinner.fail('An error occurred while fetching your projects from Strapi Cloud.');
ctx.logger.debug('Failed to list projects', e);
return null;
}
}
async function getUserSelection(ctx, projects) {
const { logger } = ctx;
try {
const answer = await inquirer.prompt([
{
type: 'list',
name: 'linkProject',
message: 'Which project do you want to link?',
choices: [
...projects,
{
name: chalk.grey(`(${QUIT_OPTION})`),
value: null
}
]
}
]);
if (!answer.linkProject) {
return null;
}
return answer;
} catch (e) {
logger.debug('Failed to get user input', e);
logger.error('An error occurred while trying to get your input.');
return null;
}
}
var action = (async (ctx)=>{
const { getValidToken } = await tokenServiceFactory(ctx);
const token = await getValidToken(ctx, promptLogin);
const { logger } = ctx;
if (!token) {
return;
}
const cloudApiService = await cloudApiFactory(ctx, token);
const existingConfig = await getLocalConfig(ctx);
const shouldRelink = await promptForRelink(ctx, cloudApiService, existingConfig);
if (!shouldRelink) {
return;
}
await trackEvent(ctx, cloudApiService, 'willLinkProject', {});
const projects = await getProjectsList(ctx, cloudApiService, existingConfig);
if (!projects) {
return;
}
const answer = await getUserSelection(ctx, projects);
if (!answer) {
return;
}
try {
const { confirmAction } = await inquirer.prompt([
{
type: 'confirm',
name: 'confirmAction',
message: 'Warning: Once linked, deploying from CLI will replace the existing project and its data. Confirm to proceed:',
default: false
}
]);
if (!confirmAction) {
await trackEvent(ctx, cloudApiService, 'didNotLinkProject', {
cancelledProjectName: answer.linkProject.name,
currentProjectName: existingConfig ? existingConfig.project?.name : null
});
return;
}
await save({
project: answer.linkProject
});
logger.log(` You have successfully linked your project to ${chalk.cyan(answer.linkProject.displayName)}. You are now able to deploy your project.`);
await trackEvent(ctx, cloudApiService, 'didLinkProject', {
projectInternalName: answer.linkProject
});
} catch (e) {
logger.debug('Failed to link project', e);
logger.error('An error occurred while linking the project.');
await trackEvent(ctx, cloudApiService, 'didNotLinkProject', {
projectInternalName: answer.linkProject
});
}
});
export { action as default };
//# sourceMappingURL=action.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
import { type StrapiCloudCommand } from '../types';
/**
* `$ link local directory to project of the cloud`
*/
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/link/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,kBAQd,CAAC;AAEF,eAAe,OAAO,CAAC"}

View File

@@ -0,0 +1,13 @@
'use strict';
var helpers = require('../utils/helpers.js');
var action = require('./action.js');
/**
* `$ link local directory to project of the cloud`
*/ const command = ({ command, ctx })=>{
command.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(()=>helpers.runAction('link', action)(ctx));
};
module.exports = command;
//# sourceMappingURL=command.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"command.js","sources":["../../src/link/command.ts"],"sourcesContent":["import { type StrapiCloudCommand } from '../types';\nimport { runAction } from '../utils/helpers';\nimport action from './action';\n\n/**\n * `$ link local directory to project of the cloud`\n */\nconst command: StrapiCloudCommand = ({ command, ctx }) => {\n command\n .command('cloud:link')\n .alias('link')\n .description('Link a local directory to a Strapi Cloud project')\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","alias","description","option","action","runAction"],"mappings":";;;;;AAIA;;AAEC,UACKA,OAA8B,GAAA,CAAC,EAAEA,OAAO,EAAEC,GAAG,EAAE,GAAA;IACnDD,OACGA,CAAAA,OAAO,CAAC,YACRE,CAAAA,CAAAA,KAAK,CAAC,MACNC,CAAAA,CAAAA,WAAW,CAAC,kDAAA,CAAA,CACZC,MAAM,CAAC,eAAe,yCACtBA,CAAAA,CAAAA,MAAM,CAAC,cAAgB,EAAA,oBAAA,CAAA,CACvBC,MAAM,CAAC,IAAMC,iBAAU,CAAA,MAAA,EAAQD,MAAQJ,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA;AAC5C;;;;"}

View File

@@ -0,0 +1,11 @@
import { runAction } from '../utils/helpers.mjs';
import action from './action.mjs';
/**
* `$ link local directory to project of the cloud`
*/ const command = ({ command, ctx })=>{
command.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)(ctx));
};
export { command as default };
//# sourceMappingURL=command.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"command.mjs","sources":["../../src/link/command.ts"],"sourcesContent":["import { type StrapiCloudCommand } from '../types';\nimport { runAction } from '../utils/helpers';\nimport action from './action';\n\n/**\n * `$ link local directory to project of the cloud`\n */\nconst command: StrapiCloudCommand = ({ command, ctx }) => {\n command\n .command('cloud:link')\n .alias('link')\n .description('Link a local directory to a Strapi Cloud project')\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","alias","description","option","action","runAction"],"mappings":";;;AAIA;;AAEC,UACKA,OAA8B,GAAA,CAAC,EAAEA,OAAO,EAAEC,GAAG,EAAE,GAAA;IACnDD,OACGA,CAAAA,OAAO,CAAC,YACRE,CAAAA,CAAAA,KAAK,CAAC,MACNC,CAAAA,CAAAA,WAAW,CAAC,kDAAA,CAAA,CACZC,MAAM,CAAC,eAAe,yCACtBA,CAAAA,CAAAA,MAAM,CAAC,cAAgB,EAAA,oBAAA,CAAA,CACvBC,MAAM,CAAC,IAAMC,SAAU,CAAA,MAAA,EAAQD,MAAQJ,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/link/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,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 link = {
name: 'link-project',
description: 'Link a local directory to a Strapi Cloud project',
action,
command
};
exports.action = action;
exports.command = command;
exports.default = link;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../src/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-project',\n description: 'Link a local directory to a Strapi Cloud project',\n action,\n command,\n} as StrapiCloudCommandInfo;\n"],"names":["name","description","action","command"],"mappings":";;;;;;;AAMA,WAAe;IACbA,IAAM,EAAA,cAAA;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 link = {
name: 'link-project',
description: 'Link a local directory to a Strapi Cloud project',
action,
command
};
export { action, command, link as default };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../src/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-project',\n description: 'Link a local directory to a Strapi Cloud project',\n action,\n command,\n} as StrapiCloudCommandInfo;\n"],"names":["name","description","action","command"],"mappings":";;;AAMA,WAAe;IACbA,IAAM,EAAA,cAAA;IACNC,WAAa,EAAA,kDAAA;AACbC,IAAAA,MAAAA;AACAC,IAAAA;AACF,CAA4B;;;;"}