Skip to content

Commit

Permalink
fix: the custom parent path
Browse files Browse the repository at this point in the history
  • Loading branch information
Lisi Linhart committed Sep 20, 2023
1 parent 582c741 commit bfbcdce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/commands/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}`
Expand Down
2 changes: 1 addition & 1 deletion src/lib/helper-replace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}'})`,
})
}
}

0 comments on commit bfbcdce

Please sign in to comment.