@@ -238,28 +238,30 @@ const startTestMigration = async (req: Request): Promise<any> => {
238238 }
239239 case CMS . WORDPRESS : {
240240 if ( packagePath ) {
241+ await wordpressService ?. createLocale ( req , project ?. current_test_stack_id , projectId , project ) ;
241242 await wordpressService ?. getAllAssets ( file_path , packagePath , project ?. current_test_stack_id , projectId )
242243 await wordpressService ?. createAssetFolderFile ( file_path , project ?. current_test_stack_id , projectId )
243244 await wordpressService ?. getAllreference ( file_path , packagePath , project ?. current_test_stack_id , projectId )
244245 await wordpressService ?. extractChunks ( file_path , packagePath , project ?. current_test_stack_id , projectId )
245- await wordpressService ?. getAllAuthors ( file_path , packagePath , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale )
246+ await wordpressService ?. getAllAuthors ( file_path , packagePath , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project )
246247 //await wordpressService?.extractContentTypes(projectId, project?.current_test_stack_id, contentTypes)
247- await wordpressService ?. getAllTerms ( file_path , packagePath , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale )
248- await wordpressService ?. getAllTags ( file_path , packagePath , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale )
249- await wordpressService ?. getAllCategories ( file_path , packagePath , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale )
250- await wordpressService ?. extractPosts ( packagePath , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale )
248+ await wordpressService ?. getAllTerms ( file_path , packagePath , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project )
249+ await wordpressService ?. getAllTags ( file_path , packagePath , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project )
250+ await wordpressService ?. getAllCategories ( file_path , packagePath , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project )
251+ await wordpressService ?. extractPosts ( packagePath , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project )
251252 await wordpressService ?. extractGlobalFields ( project ?. current_test_stack_id , projectId )
252253 await wordpressService ?. createVersionFile ( project ?. current_test_stack_id , projectId ) ;
253254 }
254255 break ;
255256 }
256257 case CMS . CONTENTFUL : {
257- await contentfulService ?. createLocale ( file_path , project ?. current_test_stack_id , projectId , project ) ;
258- await contentfulService ?. createRefrence ( file_path , project ?. current_test_stack_id , projectId ) ;
259- await contentfulService ?. createWebhooks ( file_path , project ?. current_test_stack_id , projectId ) ;
260- await contentfulService ?. createEnvironment ( file_path , project ?. current_test_stack_id , projectId ) ;
261- await contentfulService ?. createAssets ( file_path , project ?. current_test_stack_id , projectId , true ) ;
262- await contentfulService ?. createEntry ( file_path , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project ) ;
258+ const cleanLocalPath = file_path ?. replace ?.( / \/ $ / , '' ) ;
259+ await contentfulService ?. createLocale ( cleanLocalPath , project ?. current_test_stack_id , projectId , project ) ;
260+ await contentfulService ?. createRefrence ( cleanLocalPath , project ?. current_test_stack_id , projectId ) ;
261+ await contentfulService ?. createWebhooks ( cleanLocalPath , project ?. current_test_stack_id , projectId ) ;
262+ await contentfulService ?. createEnvironment ( cleanLocalPath , project ?. current_test_stack_id , projectId ) ;
263+ await contentfulService ?. createAssets ( cleanLocalPath , project ?. current_test_stack_id , projectId , true ) ;
264+ await contentfulService ?. createEntry ( cleanLocalPath , project ?. current_test_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project ) ;
263265 await contentfulService ?. createVersionFile ( project ?. current_test_stack_id , projectId ) ;
264266 break ;
265267 }
@@ -314,28 +316,30 @@ const startMigration = async (req: Request): Promise<any> => {
314316 }
315317 case CMS . WORDPRESS : {
316318 if ( packagePath ) {
319+ await wordpressService ?. createLocale ( req , project ?. current_test_stack_id , projectId , project ) ;
317320 await wordpressService ?. getAllAssets ( file_path , packagePath , project ?. destination_stack_id , projectId , )
318321 await wordpressService ?. createAssetFolderFile ( file_path , project ?. destination_stack_id , projectId )
319322 await wordpressService ?. getAllreference ( file_path , packagePath , project ?. destination_stack_id , projectId )
320323 await wordpressService ?. extractChunks ( file_path , packagePath , project ?. destination_stack_id , projectId )
321- await wordpressService ?. getAllAuthors ( file_path , packagePath , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale )
324+ await wordpressService ?. getAllAuthors ( file_path , packagePath , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project )
322325 //await wordpressService?.extractContentTypes(projectId, project?.destination_stack_id)
323- await wordpressService ?. getAllTerms ( file_path , packagePath , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale )
324- await wordpressService ?. getAllTags ( file_path , packagePath , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale )
325- await wordpressService ?. getAllCategories ( file_path , packagePath , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale )
326- await wordpressService ?. extractPosts ( packagePath , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale )
326+ await wordpressService ?. getAllTerms ( file_path , packagePath , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project )
327+ await wordpressService ?. getAllTags ( file_path , packagePath , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project )
328+ await wordpressService ?. getAllCategories ( file_path , packagePath , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project )
329+ await wordpressService ?. extractPosts ( packagePath , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project )
327330 await wordpressService ?. extractGlobalFields ( project ?. destination_stack_id , projectId )
328331 await wordpressService ?. createVersionFile ( project ?. destination_stack_id , projectId ) ;
329332 }
330333 break ;
331334 }
332335 case CMS . CONTENTFUL : {
333- await contentfulService ?. createLocale ( file_path , project ?. destination_stack_id , projectId , project ) ;
334- await contentfulService ?. createRefrence ( file_path , project ?. destination_stack_id , projectId ) ;
335- await contentfulService ?. createWebhooks ( file_path , project ?. destination_stack_id , projectId ) ;
336- await contentfulService ?. createEnvironment ( file_path , project ?. destination_stack_id , projectId ) ;
337- await contentfulService ?. createAssets ( file_path , project ?. destination_stack_id , projectId ) ;
338- await contentfulService ?. createEntry ( file_path , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project ) ;
336+ const cleanLocalPath = file_path ?. replace ?.( / \/ $ / , '' ) ;
337+ await contentfulService ?. createLocale ( cleanLocalPath , project ?. destination_stack_id , projectId , project ) ;
338+ await contentfulService ?. createRefrence ( cleanLocalPath , project ?. destination_stack_id , projectId ) ;
339+ await contentfulService ?. createWebhooks ( cleanLocalPath , project ?. destination_stack_id , projectId ) ;
340+ await contentfulService ?. createEnvironment ( cleanLocalPath , project ?. destination_stack_id , projectId ) ;
341+ await contentfulService ?. createAssets ( cleanLocalPath , project ?. destination_stack_id , projectId ) ;
342+ await contentfulService ?. createEntry ( cleanLocalPath , project ?. destination_stack_id , projectId , contentTypes , project ?. mapperKeys , project ?. stackDetails ?. master_locale , project ) ;
339343 await contentfulService ?. createVersionFile ( project ?. destination_stack_id , projectId ) ;
340344 break ;
341345 }
@@ -419,7 +423,6 @@ export const createSourceLocales = async (req: Request) => {
419423
420424 const projectId = req ?. params ?. projectId ;
421425 const locales = req ?. body ?. locale ;
422- console . info ( "🚀 ~ createSourceLocales ~ locales:" , locales ) ;
423426
424427 try {
425428 // Find the project with the specified projectId
0 commit comments