File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -140,16 +140,31 @@ const SyncSpaces = {
140140 async syncFolders ( ) {
141141 console . log ( chalk . green ( '✓' ) + ' Syncing folders...' )
142142
143- const sourceFolders = await this . client . getAll ( `spaces/ ${ this . sourceSpaceId } /stories` , {
143+ const sourceFolderParams = {
144144 folder_only : 1 ,
145145 sort_by : 'slug:asc'
146- } )
146+ } ;
147+
148+ if ( this . startsWith ) {
149+ sourceFolderParams . starts_with = this . startsWith ;
150+ }
151+
152+ const sourceFolders = await this . client . getAll ( `spaces/${ this . sourceSpaceId } /stories` , sourceFolderParams )
147153 const syncedFolders = { }
148154
149155 for ( const folder of sourceFolders ) {
150156 try {
157+
158+ const targetFolderParams = {
159+ with_slug : folder . full_slug ,
160+ } ;
161+
162+ if ( this . startsWith ) {
163+ targetFolderParams . starts_with = this . startsWith ;
164+ }
165+
151166 const folderResult = await this . client . get ( `spaces/${ this . sourceSpaceId } /stories/${ folder . id } ` )
152- const { data } = await this . client . get ( `spaces/${ this . targetSpaceId } /stories` , { with_slug : folder . full_slug } )
167+ const { data } = await this . client . get ( `spaces/${ this . targetSpaceId } /stories` , targetFolderParams )
153168 const existingFolder = data . stories [ 0 ] || null
154169 const folderData = await this . getStoryWithTranslatedSlugs ( folderResult . data . story , existingFolder )
155170 delete folderData . id
@@ -236,7 +251,7 @@ const SyncSpaces = {
236251 componentsGroups : this . componentsGroups ,
237252 componentsFullSync : this . componentsFullSync
238253 } )
239-
254+
240255 try {
241256 await syncComponentsInstance . sync ( )
242257 } catch ( e ) {
You can’t perform that action at this time.
0 commit comments