From 3c7360419afd2e9136948efe78a9dd9ffc2016a8 Mon Sep 17 00:00:00 2001 From: Lisi Linhart Date: Thu, 21 Sep 2023 09:43:12 +0200 Subject: [PATCH] Revert "chore: region EU and US" --- README.md | 2 +- src/commands/default.ts | 2 +- src/lib/regions.ts | 6 ++++++ test/unit/regions.test.ts | 8 ++++---- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ff6674e..a741409 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ OPTIONS -h, --help show CLI help -k, --key=key Storyblok Access Token -p, --packagemanager=packagemanager Package manager to use (yarn or npm) - -r, --region=region Space region (EU, US). The support for the China region will be introduced in the next release. + -r, --region=region Space region (e.g. EU, US or CN) -v, --version show CLI version ~~~ diff --git a/src/commands/default.ts b/src/commands/default.ts index 4dfa214..05b2803 100644 --- a/src/commands/default.ts +++ b/src/commands/default.ts @@ -24,7 +24,7 @@ export default class CreateStoryblokAppCommand extends Command { key: Flags.string({char: 'k', description: 'Storyblok Access Token'}), region: Flags.string({ char: 'r', - description: 'Space region (EU or US)', + description: 'Space region (EU, US or CN)', }), folder: Flags.string({ char: 'd', diff --git a/src/lib/regions.ts b/src/lib/regions.ts index 2291c48..48b8b47 100644 --- a/src/lib/regions.ts +++ b/src/lib/regions.ts @@ -27,6 +27,12 @@ const regions: RegionMap = { apiEndpoint: 'https://api-us.storyblok.com/v2/cdn/', urlUi: 'https://app.storyblok.com', }, + CN: { + name: 'CN', + value: '', + apiEndpoint: 'https://app.storyblokchina.cn/v2/cdn/', + urlUi: 'https://app.storyblokchina.cn/fe/editor_v2', + }, } diff --git a/test/unit/regions.test.ts b/test/unit/regions.test.ts index 549c458..a303f6b 100644 --- a/test/unit/regions.test.ts +++ b/test/unit/regions.test.ts @@ -6,10 +6,10 @@ describe('Regions', function () { it('contains US', function () { assert.equal(Object.keys(regions).includes('US'), true) }) - it('not contains CN', function () { - assert.equal(Object.keys(regions).includes('CN'), false) + it('contains CN', function () { + assert.equal(Object.keys(regions).includes('CN'), true) }) - it('contains 2 regions', function () { - assert.equal(Object.keys(regions).length, 2) + it('contains 3 regions', function () { + assert.equal(Object.keys(regions).length, 3) }) })