From bfbcdceb7cfd3296f589b979a5e7e0bd04ded4b4 Mon Sep 17 00:00:00 2001 From: Lisi Linhart Date: Wed, 20 Sep 2023 10:53:45 +0200 Subject: [PATCH] fix: the custom parent path --- src/commands/default.ts | 10 ++++++++++ src/lib/helper-replace.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/commands/default.ts b/src/commands/default.ts index d96a415..05b2803 100644 --- a/src/commands/default.ts +++ b/src/commands/default.ts @@ -13,6 +13,7 @@ import frameworks from '../lib/frameworks' import clone from '../lib/clone' import replace from '../lib/replace' import regions, {Region} from '../lib/regions' +import {addCustomParentFramework} from '../lib/helper-replace' export default class CreateStoryblokAppCommand extends Command { static description = 'The CLI tool for quickly starting a Storyblok project'; @@ -173,6 +174,15 @@ export default class CreateStoryblokAppCommand extends Command { "region: '" + spaceRegion.toLowerCase() + "'" } + if (spaceRegion === 'CN') { + addCustomParentFramework({ + folder, + framework, + frameworkDetails, + localhostPath: 'https://app.storyblokchina.cn', + }) + } + replace(path.join(folder, frameworkDetails.config), replacements) const pathEditing = `${selectedRegion.urlUi}/#/edit/${storyId}${regionParam}` diff --git a/src/lib/helper-replace.ts b/src/lib/helper-replace.ts index 508157a..c625086 100644 --- a/src/lib/helper-replace.ts +++ b/src/lib/helper-replace.ts @@ -69,7 +69,7 @@ export function addCustomParentFramework({ return case 'sveltekit': replace(`./${folder}/${frameworkDetails.bridge}`, { - 'useStoryblokBridge(story.id, (newStory) => (story = newStory))': `useStoryblokBridge(story.id, (newStory) => (story = newStory), { customParent: '${localhostPath}'})`, + 'useStoryblokBridge(data.story.id, (newStory) => (data.story = newStory))': `useStoryblokBridge(data.story.id, (newStory) => (data.story = newStory), { customParent: '${localhostPath}'})`, }) } }