87 lines
2.9 KiB
TypeScript
Raw Normal View History

import inquirer from 'inquirer';
import { AxiosError } from 'axios';
import { defaults } from 'lodash/fp';
import type { CLIContext, ProjectAnswers, ProjectInput } from '../types';
import { tokenServiceFactory, cloudApiFactory, local } from '../services';
chore: backmerge develop into v5 main (#20678) * Fix typo of query key from 'providers' to 'get-providers' * Closing #19644 fix filters type * fix patreon oauth 400 error from lack of user-agent header * test: backport cli tests (#20433) * fix(chore): increase specificity of the Lightning icon color (#20467) * test: temporarily disable broken edit ctb tests on CI (#20481) * feat(cli): cloud cli commands (v4) (#20119) * feat(cli): add cloud commands Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: nathan-pichon <nathan.pichon@strapi.io> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> * v4.25.0 (#20500) * NPS: Update frequency of the NPS (#20492) * enhancement(admin): change postFirstDismissal and display delays * enhancement(admin): change the display delay * fix: prevent use of local ips on webhooks (#20487) * chore: mask error on webhook manual trigger * feat: prevent using local ips * feat: display webhook edit error * chore: pr suggestion * chore: api tests * chore: allow local ips on development * chore: only run check on production * feat: include internationalized urls * fix: prettier * Add: Strapi deploy command to README files * v4.25.1 * Update @aws-sdk/client-s3 package * feat(cli): add browser logout step (#20502) * feat(cli): add browser log out step * handle error whiile fetching the config * Update LICENSE packing for packages for v4 (#20576) * feat(create-strapi-app): remove the cloud project creation part (#20561) * feat(create-strapi-app): remove the cloud project creation part * fix(create-strapi-app): adding new parameter to cloud service instantiation * Update Yarn to 4.3.1 Signed-off-by: Sora Morimoto <sora@morimoto.io> * feat(cli): trigger login sequence when token is missing or invalid (#20572) * feat(cli): launch login when auth fails * fix(cli): abstract create project fn * fix(cli): guidelines * fix(cli): rebase --------- Co-authored-by: Gonzalo Andres Garcia <nouvellegon@gmail.com> * fix clone entity, #20509 (#20531) * chore: bump glob from 7.2.0 to 9.0.0 * chore: bump glob to v10.4.2 in core/strapi * update yarn.lock * removed redundant packages/core/strapi/src/load/glob.ts file * v4.25.2 (#20675) * fix: support string array * v4.25.2 --------- Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> * Merge branch 'develop' into v5/main * fix: ts errors * fix: typescript issues * fix: remove unused import * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/js/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/ts/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * feat(cloud-cli): enable cloud-cli --------- Signed-off-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: smoothdvd <madfxgao@gmail.com> Co-authored-by: Micah Riggan <micahriggan@gmail.com> Co-authored-by: Tewson Seeoun <tewson.seeoun@gmail.com> Co-authored-by: Ben Irvin <ben.irvin@strapi.io> Co-authored-by: Simone <startae14@gmail.com> Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> Co-authored-by: Maxime Castres <mcastres@student.42.fr> Co-authored-by: Convly <jean-sebastien.herbaux@epitech.eu> Co-authored-by: Alex Supkay <asupkay1124@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> Co-authored-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Kirill Verevkin <kira795@yandex.ru> Co-authored-by: chrismuiruriz <chrismuiruri007@gmail.com>
2024-07-05 07:08:09 +02:00
import { promptLogin } from '../login/action';
async function handleError(ctx: CLIContext, error: Error) {
const { logger } = ctx;
logger.debug(error);
if (error instanceof AxiosError) {
const errorMessage = typeof error.response?.data === 'string' ? error.response.data : null;
switch (error.response?.status) {
case 403:
logger.error(
errorMessage ||
'You do not have permission to create a project. Please contact support for assistance.'
);
return;
case 400:
logger.error(errorMessage || 'Invalid input. Please check your inputs and try again.');
return;
case 503:
logger.error(
'Strapi Cloud project creation is currently unavailable. Please try again later.'
);
return;
default:
if (errorMessage) {
logger.error(errorMessage);
return;
}
break;
}
}
logger.error(
'We encountered an issue while creating your project. Please try again in a moment. If the problem persists, contact support for assistance.'
);
}
chore: backmerge develop into v5 main (#20678) * Fix typo of query key from 'providers' to 'get-providers' * Closing #19644 fix filters type * fix patreon oauth 400 error from lack of user-agent header * test: backport cli tests (#20433) * fix(chore): increase specificity of the Lightning icon color (#20467) * test: temporarily disable broken edit ctb tests on CI (#20481) * feat(cli): cloud cli commands (v4) (#20119) * feat(cli): add cloud commands Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: nathan-pichon <nathan.pichon@strapi.io> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> * v4.25.0 (#20500) * NPS: Update frequency of the NPS (#20492) * enhancement(admin): change postFirstDismissal and display delays * enhancement(admin): change the display delay * fix: prevent use of local ips on webhooks (#20487) * chore: mask error on webhook manual trigger * feat: prevent using local ips * feat: display webhook edit error * chore: pr suggestion * chore: api tests * chore: allow local ips on development * chore: only run check on production * feat: include internationalized urls * fix: prettier * Add: Strapi deploy command to README files * v4.25.1 * Update @aws-sdk/client-s3 package * feat(cli): add browser logout step (#20502) * feat(cli): add browser log out step * handle error whiile fetching the config * Update LICENSE packing for packages for v4 (#20576) * feat(create-strapi-app): remove the cloud project creation part (#20561) * feat(create-strapi-app): remove the cloud project creation part * fix(create-strapi-app): adding new parameter to cloud service instantiation * Update Yarn to 4.3.1 Signed-off-by: Sora Morimoto <sora@morimoto.io> * feat(cli): trigger login sequence when token is missing or invalid (#20572) * feat(cli): launch login when auth fails * fix(cli): abstract create project fn * fix(cli): guidelines * fix(cli): rebase --------- Co-authored-by: Gonzalo Andres Garcia <nouvellegon@gmail.com> * fix clone entity, #20509 (#20531) * chore: bump glob from 7.2.0 to 9.0.0 * chore: bump glob to v10.4.2 in core/strapi * update yarn.lock * removed redundant packages/core/strapi/src/load/glob.ts file * v4.25.2 (#20675) * fix: support string array * v4.25.2 --------- Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> * Merge branch 'develop' into v5/main * fix: ts errors * fix: typescript issues * fix: remove unused import * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/js/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/ts/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * feat(cloud-cli): enable cloud-cli --------- Signed-off-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: smoothdvd <madfxgao@gmail.com> Co-authored-by: Micah Riggan <micahriggan@gmail.com> Co-authored-by: Tewson Seeoun <tewson.seeoun@gmail.com> Co-authored-by: Ben Irvin <ben.irvin@strapi.io> Co-authored-by: Simone <startae14@gmail.com> Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> Co-authored-by: Maxime Castres <mcastres@student.42.fr> Co-authored-by: Convly <jean-sebastien.herbaux@epitech.eu> Co-authored-by: Alex Supkay <asupkay1124@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> Co-authored-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Kirill Verevkin <kira795@yandex.ru> Co-authored-by: chrismuiruriz <chrismuiruri007@gmail.com>
2024-07-05 07:08:09 +02:00
async function createProject(ctx: CLIContext, cloudApi: any, projectInput: ProjectInput) {
const { logger } = ctx;
const spinner = logger.spinner('Setting up your project...').start();
try {
const { data } = await cloudApi.createProject(projectInput);
await local.save({ project: data });
spinner.succeed('Project created successfully!');
return data;
} catch (e: Error | unknown) {
spinner.fail('An error occurred while creating the project on Strapi Cloud.');
throw e;
}
}
export default async (ctx: CLIContext) => {
const { logger } = ctx;
chore: backmerge develop into v5 main (#20678) * Fix typo of query key from 'providers' to 'get-providers' * Closing #19644 fix filters type * fix patreon oauth 400 error from lack of user-agent header * test: backport cli tests (#20433) * fix(chore): increase specificity of the Lightning icon color (#20467) * test: temporarily disable broken edit ctb tests on CI (#20481) * feat(cli): cloud cli commands (v4) (#20119) * feat(cli): add cloud commands Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: nathan-pichon <nathan.pichon@strapi.io> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> * v4.25.0 (#20500) * NPS: Update frequency of the NPS (#20492) * enhancement(admin): change postFirstDismissal and display delays * enhancement(admin): change the display delay * fix: prevent use of local ips on webhooks (#20487) * chore: mask error on webhook manual trigger * feat: prevent using local ips * feat: display webhook edit error * chore: pr suggestion * chore: api tests * chore: allow local ips on development * chore: only run check on production * feat: include internationalized urls * fix: prettier * Add: Strapi deploy command to README files * v4.25.1 * Update @aws-sdk/client-s3 package * feat(cli): add browser logout step (#20502) * feat(cli): add browser log out step * handle error whiile fetching the config * Update LICENSE packing for packages for v4 (#20576) * feat(create-strapi-app): remove the cloud project creation part (#20561) * feat(create-strapi-app): remove the cloud project creation part * fix(create-strapi-app): adding new parameter to cloud service instantiation * Update Yarn to 4.3.1 Signed-off-by: Sora Morimoto <sora@morimoto.io> * feat(cli): trigger login sequence when token is missing or invalid (#20572) * feat(cli): launch login when auth fails * fix(cli): abstract create project fn * fix(cli): guidelines * fix(cli): rebase --------- Co-authored-by: Gonzalo Andres Garcia <nouvellegon@gmail.com> * fix clone entity, #20509 (#20531) * chore: bump glob from 7.2.0 to 9.0.0 * chore: bump glob to v10.4.2 in core/strapi * update yarn.lock * removed redundant packages/core/strapi/src/load/glob.ts file * v4.25.2 (#20675) * fix: support string array * v4.25.2 --------- Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> * Merge branch 'develop' into v5/main * fix: ts errors * fix: typescript issues * fix: remove unused import * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/js/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/ts/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * feat(cloud-cli): enable cloud-cli --------- Signed-off-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: smoothdvd <madfxgao@gmail.com> Co-authored-by: Micah Riggan <micahriggan@gmail.com> Co-authored-by: Tewson Seeoun <tewson.seeoun@gmail.com> Co-authored-by: Ben Irvin <ben.irvin@strapi.io> Co-authored-by: Simone <startae14@gmail.com> Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> Co-authored-by: Maxime Castres <mcastres@student.42.fr> Co-authored-by: Convly <jean-sebastien.herbaux@epitech.eu> Co-authored-by: Alex Supkay <asupkay1124@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> Co-authored-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Kirill Verevkin <kira795@yandex.ru> Co-authored-by: chrismuiruriz <chrismuiruri007@gmail.com>
2024-07-05 07:08:09 +02:00
const { getValidToken, eraseToken } = await tokenServiceFactory(ctx);
chore: backmerge develop into v5 main (#20678) * Fix typo of query key from 'providers' to 'get-providers' * Closing #19644 fix filters type * fix patreon oauth 400 error from lack of user-agent header * test: backport cli tests (#20433) * fix(chore): increase specificity of the Lightning icon color (#20467) * test: temporarily disable broken edit ctb tests on CI (#20481) * feat(cli): cloud cli commands (v4) (#20119) * feat(cli): add cloud commands Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: nathan-pichon <nathan.pichon@strapi.io> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> * v4.25.0 (#20500) * NPS: Update frequency of the NPS (#20492) * enhancement(admin): change postFirstDismissal and display delays * enhancement(admin): change the display delay * fix: prevent use of local ips on webhooks (#20487) * chore: mask error on webhook manual trigger * feat: prevent using local ips * feat: display webhook edit error * chore: pr suggestion * chore: api tests * chore: allow local ips on development * chore: only run check on production * feat: include internationalized urls * fix: prettier * Add: Strapi deploy command to README files * v4.25.1 * Update @aws-sdk/client-s3 package * feat(cli): add browser logout step (#20502) * feat(cli): add browser log out step * handle error whiile fetching the config * Update LICENSE packing for packages for v4 (#20576) * feat(create-strapi-app): remove the cloud project creation part (#20561) * feat(create-strapi-app): remove the cloud project creation part * fix(create-strapi-app): adding new parameter to cloud service instantiation * Update Yarn to 4.3.1 Signed-off-by: Sora Morimoto <sora@morimoto.io> * feat(cli): trigger login sequence when token is missing or invalid (#20572) * feat(cli): launch login when auth fails * fix(cli): abstract create project fn * fix(cli): guidelines * fix(cli): rebase --------- Co-authored-by: Gonzalo Andres Garcia <nouvellegon@gmail.com> * fix clone entity, #20509 (#20531) * chore: bump glob from 7.2.0 to 9.0.0 * chore: bump glob to v10.4.2 in core/strapi * update yarn.lock * removed redundant packages/core/strapi/src/load/glob.ts file * v4.25.2 (#20675) * fix: support string array * v4.25.2 --------- Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> * Merge branch 'develop' into v5/main * fix: ts errors * fix: typescript issues * fix: remove unused import * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/js/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/ts/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * feat(cloud-cli): enable cloud-cli --------- Signed-off-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: smoothdvd <madfxgao@gmail.com> Co-authored-by: Micah Riggan <micahriggan@gmail.com> Co-authored-by: Tewson Seeoun <tewson.seeoun@gmail.com> Co-authored-by: Ben Irvin <ben.irvin@strapi.io> Co-authored-by: Simone <startae14@gmail.com> Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> Co-authored-by: Maxime Castres <mcastres@student.42.fr> Co-authored-by: Convly <jean-sebastien.herbaux@epitech.eu> Co-authored-by: Alex Supkay <asupkay1124@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> Co-authored-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Kirill Verevkin <kira795@yandex.ru> Co-authored-by: chrismuiruriz <chrismuiruri007@gmail.com>
2024-07-05 07:08:09 +02:00
const token = await getValidToken(ctx, promptLogin);
if (!token) {
return;
}
chore: backmerge develop into v5 main (#20678) * Fix typo of query key from 'providers' to 'get-providers' * Closing #19644 fix filters type * fix patreon oauth 400 error from lack of user-agent header * test: backport cli tests (#20433) * fix(chore): increase specificity of the Lightning icon color (#20467) * test: temporarily disable broken edit ctb tests on CI (#20481) * feat(cli): cloud cli commands (v4) (#20119) * feat(cli): add cloud commands Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: nathan-pichon <nathan.pichon@strapi.io> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> * v4.25.0 (#20500) * NPS: Update frequency of the NPS (#20492) * enhancement(admin): change postFirstDismissal and display delays * enhancement(admin): change the display delay * fix: prevent use of local ips on webhooks (#20487) * chore: mask error on webhook manual trigger * feat: prevent using local ips * feat: display webhook edit error * chore: pr suggestion * chore: api tests * chore: allow local ips on development * chore: only run check on production * feat: include internationalized urls * fix: prettier * Add: Strapi deploy command to README files * v4.25.1 * Update @aws-sdk/client-s3 package * feat(cli): add browser logout step (#20502) * feat(cli): add browser log out step * handle error whiile fetching the config * Update LICENSE packing for packages for v4 (#20576) * feat(create-strapi-app): remove the cloud project creation part (#20561) * feat(create-strapi-app): remove the cloud project creation part * fix(create-strapi-app): adding new parameter to cloud service instantiation * Update Yarn to 4.3.1 Signed-off-by: Sora Morimoto <sora@morimoto.io> * feat(cli): trigger login sequence when token is missing or invalid (#20572) * feat(cli): launch login when auth fails * fix(cli): abstract create project fn * fix(cli): guidelines * fix(cli): rebase --------- Co-authored-by: Gonzalo Andres Garcia <nouvellegon@gmail.com> * fix clone entity, #20509 (#20531) * chore: bump glob from 7.2.0 to 9.0.0 * chore: bump glob to v10.4.2 in core/strapi * update yarn.lock * removed redundant packages/core/strapi/src/load/glob.ts file * v4.25.2 (#20675) * fix: support string array * v4.25.2 --------- Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> * Merge branch 'develop' into v5/main * fix: ts errors * fix: typescript issues * fix: remove unused import * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/js/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/ts/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * feat(cloud-cli): enable cloud-cli --------- Signed-off-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: smoothdvd <madfxgao@gmail.com> Co-authored-by: Micah Riggan <micahriggan@gmail.com> Co-authored-by: Tewson Seeoun <tewson.seeoun@gmail.com> Co-authored-by: Ben Irvin <ben.irvin@strapi.io> Co-authored-by: Simone <startae14@gmail.com> Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> Co-authored-by: Maxime Castres <mcastres@student.42.fr> Co-authored-by: Convly <jean-sebastien.herbaux@epitech.eu> Co-authored-by: Alex Supkay <asupkay1124@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> Co-authored-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Kirill Verevkin <kira795@yandex.ru> Co-authored-by: chrismuiruriz <chrismuiruri007@gmail.com>
2024-07-05 07:08:09 +02:00
const cloudApi = await cloudApiFactory(ctx, token);
const { data: config } = await cloudApi.config();
const { questions, defaults: defaultValues } = config.projectCreation;
const projectAnswersDefaulted = defaults(defaultValues);
const projectAnswers = await inquirer.prompt<ProjectAnswers>(questions);
const projectInput: ProjectInput = projectAnswersDefaulted(projectAnswers);
try {
chore: backmerge develop into v5 main (#20678) * Fix typo of query key from 'providers' to 'get-providers' * Closing #19644 fix filters type * fix patreon oauth 400 error from lack of user-agent header * test: backport cli tests (#20433) * fix(chore): increase specificity of the Lightning icon color (#20467) * test: temporarily disable broken edit ctb tests on CI (#20481) * feat(cli): cloud cli commands (v4) (#20119) * feat(cli): add cloud commands Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: nathan-pichon <nathan.pichon@strapi.io> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> * v4.25.0 (#20500) * NPS: Update frequency of the NPS (#20492) * enhancement(admin): change postFirstDismissal and display delays * enhancement(admin): change the display delay * fix: prevent use of local ips on webhooks (#20487) * chore: mask error on webhook manual trigger * feat: prevent using local ips * feat: display webhook edit error * chore: pr suggestion * chore: api tests * chore: allow local ips on development * chore: only run check on production * feat: include internationalized urls * fix: prettier * Add: Strapi deploy command to README files * v4.25.1 * Update @aws-sdk/client-s3 package * feat(cli): add browser logout step (#20502) * feat(cli): add browser log out step * handle error whiile fetching the config * Update LICENSE packing for packages for v4 (#20576) * feat(create-strapi-app): remove the cloud project creation part (#20561) * feat(create-strapi-app): remove the cloud project creation part * fix(create-strapi-app): adding new parameter to cloud service instantiation * Update Yarn to 4.3.1 Signed-off-by: Sora Morimoto <sora@morimoto.io> * feat(cli): trigger login sequence when token is missing or invalid (#20572) * feat(cli): launch login when auth fails * fix(cli): abstract create project fn * fix(cli): guidelines * fix(cli): rebase --------- Co-authored-by: Gonzalo Andres Garcia <nouvellegon@gmail.com> * fix clone entity, #20509 (#20531) * chore: bump glob from 7.2.0 to 9.0.0 * chore: bump glob to v10.4.2 in core/strapi * update yarn.lock * removed redundant packages/core/strapi/src/load/glob.ts file * v4.25.2 (#20675) * fix: support string array * v4.25.2 --------- Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> * Merge branch 'develop' into v5/main * fix: ts errors * fix: typescript issues * fix: remove unused import * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/js/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/ts/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * feat(cloud-cli): enable cloud-cli --------- Signed-off-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: smoothdvd <madfxgao@gmail.com> Co-authored-by: Micah Riggan <micahriggan@gmail.com> Co-authored-by: Tewson Seeoun <tewson.seeoun@gmail.com> Co-authored-by: Ben Irvin <ben.irvin@strapi.io> Co-authored-by: Simone <startae14@gmail.com> Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> Co-authored-by: Maxime Castres <mcastres@student.42.fr> Co-authored-by: Convly <jean-sebastien.herbaux@epitech.eu> Co-authored-by: Alex Supkay <asupkay1124@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> Co-authored-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Kirill Verevkin <kira795@yandex.ru> Co-authored-by: chrismuiruriz <chrismuiruri007@gmail.com>
2024-07-05 07:08:09 +02:00
return await createProject(ctx, cloudApi, projectInput);
} catch (e: Error | unknown) {
chore: backmerge develop into v5 main (#20678) * Fix typo of query key from 'providers' to 'get-providers' * Closing #19644 fix filters type * fix patreon oauth 400 error from lack of user-agent header * test: backport cli tests (#20433) * fix(chore): increase specificity of the Lightning icon color (#20467) * test: temporarily disable broken edit ctb tests on CI (#20481) * feat(cli): cloud cli commands (v4) (#20119) * feat(cli): add cloud commands Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: nathan-pichon <nathan.pichon@strapi.io> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> * v4.25.0 (#20500) * NPS: Update frequency of the NPS (#20492) * enhancement(admin): change postFirstDismissal and display delays * enhancement(admin): change the display delay * fix: prevent use of local ips on webhooks (#20487) * chore: mask error on webhook manual trigger * feat: prevent using local ips * feat: display webhook edit error * chore: pr suggestion * chore: api tests * chore: allow local ips on development * chore: only run check on production * feat: include internationalized urls * fix: prettier * Add: Strapi deploy command to README files * v4.25.1 * Update @aws-sdk/client-s3 package * feat(cli): add browser logout step (#20502) * feat(cli): add browser log out step * handle error whiile fetching the config * Update LICENSE packing for packages for v4 (#20576) * feat(create-strapi-app): remove the cloud project creation part (#20561) * feat(create-strapi-app): remove the cloud project creation part * fix(create-strapi-app): adding new parameter to cloud service instantiation * Update Yarn to 4.3.1 Signed-off-by: Sora Morimoto <sora@morimoto.io> * feat(cli): trigger login sequence when token is missing or invalid (#20572) * feat(cli): launch login when auth fails * fix(cli): abstract create project fn * fix(cli): guidelines * fix(cli): rebase --------- Co-authored-by: Gonzalo Andres Garcia <nouvellegon@gmail.com> * fix clone entity, #20509 (#20531) * chore: bump glob from 7.2.0 to 9.0.0 * chore: bump glob to v10.4.2 in core/strapi * update yarn.lock * removed redundant packages/core/strapi/src/load/glob.ts file * v4.25.2 (#20675) * fix: support string array * v4.25.2 --------- Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> * Merge branch 'develop' into v5/main * fix: ts errors * fix: typescript issues * fix: remove unused import * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/cli/create-strapi-app/src/create-strapi-app.ts Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/js/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * Update packages/generators/app/src/resources/files/ts/README.md Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> * feat(cloud-cli): enable cloud-cli --------- Signed-off-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: smoothdvd <madfxgao@gmail.com> Co-authored-by: Micah Riggan <micahriggan@gmail.com> Co-authored-by: Tewson Seeoun <tewson.seeoun@gmail.com> Co-authored-by: Ben Irvin <ben.irvin@strapi.io> Co-authored-by: Simone <startae14@gmail.com> Co-authored-by: Nathan Pichon <nathan.pichon@strapi.io> Co-authored-by: Gonzalo Garcia <nouvellegon@gmail.com> Co-authored-by: Abdallah M <55534657+abdallahmz@users.noreply.github.com> Co-authored-by: Maxime Castres <mcastres@student.42.fr> Co-authored-by: Convly <jean-sebastien.herbaux@epitech.eu> Co-authored-by: Alex Supkay <asupkay1124@gmail.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> Co-authored-by: Sora Morimoto <sora@morimoto.io> Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Kirill Verevkin <kira795@yandex.ru> Co-authored-by: chrismuiruriz <chrismuiruri007@gmail.com>
2024-07-05 07:08:09 +02:00
if (e instanceof AxiosError && e.response?.status === 401) {
logger.warn('Oops! Your session has expired. Please log in again to retry.');
await eraseToken();
if (await promptLogin(ctx)) {
return await createProject(ctx, cloudApi, projectInput);
}
} else {
await handleError(ctx, e as Error);
}
}
};