Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 6154194

Browse files
author
Lisi Linhart
authored
Merge pull request #30 from storyblok/fix/china-custom-parent
Fix: china custom parent
2 parents 0d782aa + bfbcdce commit 6154194

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/commands/default.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import frameworks from '../lib/frameworks'
1313
import clone from '../lib/clone'
1414
import replace from '../lib/replace'
1515
import regions, {Region} from '../lib/regions'
16+
import {addCustomParentFramework} from '../lib/helper-replace'
1617

1718
export default class CreateStoryblokAppCommand extends Command {
1819
static description = 'The CLI tool for quickly starting a Storyblok project';
@@ -173,6 +174,15 @@ export default class CreateStoryblokAppCommand extends Command {
173174
"region: '" + spaceRegion.toLowerCase() + "'"
174175
}
175176

177+
if (spaceRegion === 'CN') {
178+
addCustomParentFramework({
179+
folder,
180+
framework,
181+
frameworkDetails,
182+
localhostPath: 'https://app.storyblokchina.cn',
183+
})
184+
}
185+
176186
replace(path.join(folder, frameworkDetails.config), replacements)
177187

178188
const pathEditing = `${selectedRegion.urlUi}/#/edit/${storyId}${regionParam}`

src/lib/helper-replace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function addCustomParentFramework({
6969
return
7070
case 'sveltekit':
7171
replace(`./${folder}/${frameworkDetails.bridge}`, {
72-
'useStoryblokBridge(story.id, (newStory) => (story = newStory))': `useStoryblokBridge(story.id, (newStory) => (story = newStory), { customParent: '${localhostPath}'})`,
72+
'useStoryblokBridge(data.story.id, (newStory) => (data.story = newStory))': `useStoryblokBridge(data.story.id, (newStory) => (data.story = newStory), { customParent: '${localhostPath}'})`,
7373
})
7474
}
7575
}

0 commit comments

Comments
 (0)