Skip to content

Commit 23af79d

Browse files
committed
Merge branch 'feature/cli-optimise' of github.com:contentstack/migration-v2-node-server into feature/cli-optimise
2 parents 91b4993 + f8c312f commit 23af79d

File tree

4 files changed

+82
-19
lines changed

4 files changed

+82
-19
lines changed

api/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"build": "npx tsc",
88
"start": "NODE_ENV=production node dist/server.js",
9-
"dev": "NODE_ENV=production tsx watch ./src/server.ts",
9+
"dev": "NODE_ENV=production tsx ./src/server.ts",
1010
"prettify": "prettier --write .",
1111
"windev": "SET NODE_ENV=production&& tsx watch ./src/server.ts",
1212
"winstart": "SET NODE_ENV=production&& node dist/server.js",
@@ -45,7 +45,6 @@
4545
"jsonwebtoken": "^9.0.2",
4646
"lowdb": "^7.0.1",
4747
"mkdirp": "^3.0.1",
48-
"nodemon": "^3.1.9",
4948
"p-limit": "^6.2.0",
5049
"path-to-regexp": "^8.2.0",
5150
"router": "^2.0.0",

api/src/services/migration.service.ts

Lines changed: 79 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,46 @@ const startTestMigration = async (req: Request): Promise<any> => {
369369
}
370370
case CMS.CONTENTFUL: {
371371
const cleanLocalPath = file_path?.replace?.(/\/$/, '');
372-
await contentfulService?.createLocale(cleanLocalPath, project?.current_test_stack_id, projectId, project);
373-
await contentfulService?.createRefrence(cleanLocalPath, project?.current_test_stack_id, projectId);
374-
await contentfulService?.createWebhooks(cleanLocalPath, project?.current_test_stack_id, projectId);
375-
await contentfulService?.createEnvironment(cleanLocalPath, project?.current_test_stack_id, projectId);
376-
await contentfulService?.createAssets(cleanLocalPath, project?.current_test_stack_id, projectId, true);
377-
await contentfulService?.createEntry(cleanLocalPath, project?.current_test_stack_id, projectId, contentTypes, project?.mapperKeys, project?.stackDetails?.master_locale, project);
378-
await contentfulService?.createVersionFile(project?.current_test_stack_id, projectId);
372+
await contentfulService?.createLocale(
373+
cleanLocalPath,
374+
project?.current_test_stack_id,
375+
projectId,
376+
project
377+
);
378+
await contentfulService?.createRefrence(
379+
cleanLocalPath,
380+
project?.current_test_stack_id,
381+
projectId
382+
);
383+
await contentfulService?.createWebhooks(
384+
cleanLocalPath,
385+
project?.current_test_stack_id,
386+
projectId
387+
);
388+
await contentfulService?.createEnvironment(
389+
cleanLocalPath,
390+
project?.current_test_stack_id,
391+
projectId
392+
);
393+
await contentfulService?.createAssets(
394+
cleanLocalPath,
395+
project?.current_test_stack_id,
396+
projectId,
397+
true
398+
);
399+
await contentfulService?.createEntry(
400+
cleanLocalPath,
401+
project?.current_test_stack_id,
402+
projectId,
403+
contentTypes,
404+
project?.mapperKeys,
405+
project?.stackDetails?.master_locale,
406+
project
407+
);
408+
await contentfulService?.createVersionFile(
409+
project?.current_test_stack_id,
410+
projectId
411+
);
379412
break;
380413
}
381414
default:
@@ -545,13 +578,45 @@ const startMigration = async (req: Request): Promise<any> => {
545578
}
546579
case CMS.CONTENTFUL: {
547580
const cleanLocalPath = file_path?.replace?.(/\/$/, '');
548-
await contentfulService?.createLocale(cleanLocalPath, project?.destination_stack_id, projectId, project);
549-
await contentfulService?.createRefrence(cleanLocalPath, project?.destination_stack_id, projectId);
550-
await contentfulService?.createWebhooks(cleanLocalPath, project?.destination_stack_id, projectId);
551-
await contentfulService?.createEnvironment(cleanLocalPath, project?.destination_stack_id, projectId);
552-
await contentfulService?.createAssets(cleanLocalPath, project?.destination_stack_id, projectId);
553-
await contentfulService?.createEntry(cleanLocalPath, project?.destination_stack_id, projectId, contentTypes, project?.mapperKeys, project?.stackDetails?.master_locale, project);
554-
await contentfulService?.createVersionFile(project?.destination_stack_id, projectId);
581+
await contentfulService?.createLocale(
582+
cleanLocalPath,
583+
project?.destination_stack_id,
584+
projectId,
585+
project
586+
);
587+
await contentfulService?.createRefrence(
588+
cleanLocalPath,
589+
project?.destination_stack_id,
590+
projectId
591+
);
592+
await contentfulService?.createWebhooks(
593+
cleanLocalPath,
594+
project?.destination_stack_id,
595+
projectId
596+
);
597+
await contentfulService?.createEnvironment(
598+
cleanLocalPath,
599+
project?.destination_stack_id,
600+
projectId
601+
);
602+
await contentfulService?.createAssets(
603+
cleanLocalPath,
604+
project?.destination_stack_id,
605+
projectId
606+
);
607+
await contentfulService?.createEntry(
608+
cleanLocalPath,
609+
project?.destination_stack_id,
610+
projectId,
611+
contentTypes,
612+
project?.mapperKeys,
613+
project?.stackDetails?.master_locale,
614+
project
615+
);
616+
await contentfulService?.createVersionFile(
617+
project?.destination_stack_id,
618+
projectId
619+
);
555620
break;
556621
}
557622
default:
@@ -620,7 +685,6 @@ const getLogs = async (req: Request): Promise<any> => {
620685
* @throws Exception if the project ID is invalid or the when the path to project.json is incorrect
621686
*/
622687
export const createSourceLocales = async (req: Request) => {
623-
624688
const projectId = req?.params?.projectId;
625689
const locales = req?.body?.locale;
626690

ui/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

upload-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"start": "tsc && node build/index.js",
9-
"dev": "nodemon --watch src --ext ts --exec 'tsc && node build/index.js'",
9+
"dev": "tsc --watch & node --watch build/index.js",
1010
"validation": "tsc && node build/main.js",
1111
"prettify": "prettier --write .",
1212
"lint": "eslint .",

0 commit comments

Comments
 (0)