From 270c8c7bd61c18b7692db4895c50dee33f5e413e Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 23 Jan 2024 21:02:28 +0530 Subject: [PATCH 01/22] sca-scan.yml --- .github/workflows/sca-scan.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/sca-scan.yml diff --git a/.github/workflows/sca-scan.yml b/.github/workflows/sca-scan.yml new file mode 100644 index 000000000..bf9c1eb0b --- /dev/null +++ b/.github/workflows/sca-scan.yml @@ -0,0 +1,15 @@ +name: Source Composition Analysis Scan +on: + pull_request: + types: [opened, synchronize, reopened] +jobs: + security: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Run Snyk to check for vulnerabilities + uses: snyk/actions/node@master + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + with: + args: --all-projects --fail-on=all From 488039d68077900c3558e174df24f4f83c3164ef Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 23 Jan 2024 21:02:43 +0530 Subject: [PATCH 02/22] jira.yml --- .github/workflows/jira.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/jira.yml diff --git a/.github/workflows/jira.yml b/.github/workflows/jira.yml new file mode 100644 index 000000000..63960ea58 --- /dev/null +++ b/.github/workflows/jira.yml @@ -0,0 +1,33 @@ +name: Create JIRA ISSUE +on: + pull_request: + types: [opened] +jobs: + security: + if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'snyk-bot' || contains(github.event.pull_request.head.ref, 'snyk-fix-') || contains(github.event.pull_request.head.ref, 'snyk-upgrade-')}} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Login into JIRA + uses: atlassian/gajira-login@master + env: + JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} + JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} + JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} + - name: Create a JIRA Issue + id: create + uses: atlassian/gajira-create@master + with: + project: ${{ secrets.JIRA_PROJECT }} + issuetype: ${{ secrets.JIRA_ISSUE_TYPE }} + summary: | + ${{ github.event.pull_request.title }} + description: | + PR: ${{ github.event.pull_request.html_url }} + + fields: "${{ secrets.JIRA_FIELDS }}" + - name: Transition issue + uses: atlassian/gajira-transition@v3 + with: + issue: ${{ steps.create.outputs.issue }} + transition: ${{ secrets.JIRA_TRANSITION }} From 818fbcd61dbddc09653b9bc12a4639e099b710fd Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 18 Jun 2024 16:46:00 +0530 Subject: [PATCH 03/22] sca-scan.yml --- .github/workflows/sca-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sca-scan.yml b/.github/workflows/sca-scan.yml index bf9c1eb0b..f09161f53 100644 --- a/.github/workflows/sca-scan.yml +++ b/.github/workflows/sca-scan.yml @@ -3,7 +3,7 @@ on: pull_request: types: [opened, synchronize, reopened] jobs: - security: + security-sca: runs-on: ubuntu-latest steps: - uses: actions/checkout@master From ef7992a204829402dc56d98a3605056bcf756299 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 18 Jun 2024 16:46:12 +0530 Subject: [PATCH 04/22] jira.yml --- .github/workflows/jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jira.yml b/.github/workflows/jira.yml index 63960ea58..caa4bbdfe 100644 --- a/.github/workflows/jira.yml +++ b/.github/workflows/jira.yml @@ -3,7 +3,7 @@ on: pull_request: types: [opened] jobs: - security: + security-jira: if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'snyk-bot' || contains(github.event.pull_request.head.ref, 'snyk-fix-') || contains(github.event.pull_request.head.ref, 'snyk-upgrade-')}} runs-on: ubuntu-latest steps: From 46146f57cec2e8dba7d48064f7576b0870161271 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 18 Jun 2024 16:46:13 +0530 Subject: [PATCH 05/22] sast-scan.yml --- .github/workflows/sast-scan.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/sast-scan.yml diff --git a/.github/workflows/sast-scan.yml b/.github/workflows/sast-scan.yml new file mode 100644 index 000000000..3b9521a55 --- /dev/null +++ b/.github/workflows/sast-scan.yml @@ -0,0 +1,11 @@ +name: SAST Scan +on: + pull_request: + types: [opened, synchronize, reopened] +jobs: + security-sast: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Semgrep Scan + run: docker run -v /var/run/docker.sock:/var/run/docker.sock -v "${PWD}:/src" returntocorp/semgrep semgrep scan --config auto \ No newline at end of file From 8a6a074a420cd9fd807f3af5e9c5ba488e0b1740 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 22 Oct 2024 20:50:24 +0530 Subject: [PATCH 06/22] sca-scan.yml From 537f6b81d5018710ec436f13da57b7aaa9052b5f Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 22 Oct 2024 20:50:38 +0530 Subject: [PATCH 07/22] jira.yml From 078a910072eeb662cbf8b12ea0fdc5df519d40f3 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 22 Oct 2024 20:50:39 +0530 Subject: [PATCH 08/22] sast-scan.yml From 4b7322beeca27274f253412237cde3fd60395f2d Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 22 Oct 2024 20:50:43 +0530 Subject: [PATCH 09/22] Added codeowners --- .github/CODEOWNERS | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..b6192f200 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,4 @@ +.github/workflows/sca-scan.yml @contentstack/security-admin +.github/workflows/sast-scan.yml @contentstack/security-admin +.github/workflows/jira.yml @contentstack/security-admin +**/.snyk @contentstack/security-admin From 843aae85ee2e3b1ea13f379f79280a54c81ff7c2 Mon Sep 17 00:00:00 2001 From: RohitKini <57343193+RohitKini@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:01:17 +0530 Subject: [PATCH 10/22] readme.md update --- api/README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/api/README.md b/api/README.md index e92712735..c336f16bf 100644 --- a/api/README.md +++ b/api/README.md @@ -13,6 +13,14 @@ This is the migration V2's node server. 2. Start the MongoDB service. 3. Verify that MongoDB is running by opening a command prompt and running the command `mongo --version`. -3. To run the development server, create a `./development.env` file and add environment variables as per `./example.env` -4. To run the production server, create a `./production.env` file and add environment variables as per `./example.env` +## Environment Variables +The following environment variables are used in this project: + +- `APP_TOKEN_KEY`: The token key for the application. Default is `MIGRATION_V2`. +- `PORT`: The port number on which the application runs. Default is `5001`. + +Make sure to set these variables in a `.env` file at the root of your project. + +1. To run the development server, create a `./development.env` file and add environment variables as per `./example.env` +2. To run the production server, create a `./production.env` file and add environment variables as per `./example.env` From 26dedec80c097a73f5f52bd75d70e14aa6f063da Mon Sep 17 00:00:00 2001 From: RohitKini <57343193+RohitKini@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:33:18 +0530 Subject: [PATCH 11/22] readme updated --- ui/README.md | 13 +++++++++++++ upload-api/README.md | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/ui/README.md b/ui/README.md index 5fe4fea2f..f8e2de361 100644 --- a/ui/README.md +++ b/ui/README.md @@ -25,6 +25,19 @@ Migration UI is a web application designed to facilitate the migration of conten npm install ``` +## Environment Variables + +The following environment variables are used in this project: + +- `REACT_APP_WEBSITE_BASE_URL`: The base URL for the website. Default is `http://localhost:3000/`. +- `REACT_APP_BASE_API_URL`: The base URL for the API. Default is `http://localhost:5001/`. +- `REACT_APP_API_VERSION`: The version of the API. Default is `v2`. +- `REACT_APP_HOST`: The host URL for the application. Default is `http://localhost:3000`. +- `REACT_APP_UPLOAD_SERVER`: The URL for the upload server. Default is `http://localhost:4002/`. +- `REACT_APP_OFFLINE_CMS`: A flag to indicate if the CMS is offline. Default is `true`. + +Make sure to set these variables in a `.env` file at the root of your ui project. + ## Usage Start the development server: ```sh diff --git a/upload-api/README.md b/upload-api/README.md index 1b18a9ddc..f7a287e54 100644 --- a/upload-api/README.md +++ b/upload-api/README.md @@ -22,6 +22,25 @@ The following environment variables are used in this project: Make sure to set these variables in a `.env` file at the root of your project. +## Configuration +Please refer sample.config.json and provide this config in index.ts of config folder of upload-api/src +The following configuration is used in this project: + +- `plan.dropdown.optionLimit`: The limit for dropdown options. Default is `100`. +- `cmsType`: The type of CMS used. Default is `sitecore`. +- `isLocalPath`: A flag to indicate if the path is local. Default is `true`. + +### AWS Data +- `awsRegion`: The AWS region. Default is `us-east-2`. +- `awsAccessKeyId`: The AWS access key ID. +- `awsSecretAccessKey`: The AWS secret access key. +- `awsSessionToken`: The AWS session token. +- `bucketName`: The name of the AWS S3 bucket. Default is `migartion-test`. +- `buketKey`: The key for the AWS S3 bucket. Default is `project/package 45.zip`. + +### Local Path +- `localPath`: The local path to the extracted files. for example is `/upload-api/extracted_files/package 45.zip`. + ## Repository - Type: git - URL: https://github.com/contentstack/migration-v2.git From 0827cc9b099bc2abcf4f089ada0790d46c34e61e Mon Sep 17 00:00:00 2001 From: RohitKini <57343193+RohitKini@users.noreply.github.com> Date: Tue, 10 Dec 2024 11:23:30 +0530 Subject: [PATCH 12/22] updated readme.md files --- README.md | 12 ++++++++++++ api/README.md | 15 ++++----------- upload-api/README.md | 4 ++-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 8620f2f54..004ba678e 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,18 @@ Check for readme.md files and install dependencies for folders npm install ``` +4. go to cli folder + 1. Install pnpm + Since pnpm is required, you need to install it globally if it's not already installed: + ``` + npm install -g pnpm + ``` + 2. Run the Setup Script + Now, run the main setup script specified in the package.json: + ``` + npm run setup-repo + ``` + ## Scripts - `npm start`: Starts the main server by running index.js. - `npm run api`: Navigates to the api directory and runs the development server. diff --git a/api/README.md b/api/README.md index c336f16bf..fa2a522e5 100644 --- a/api/README.md +++ b/api/README.md @@ -2,17 +2,6 @@ This is the migration V2's node server. -## To start the server - -1. Run `npm i` -2. Install and start MongoDB - -### To start MongoDB - -1. Install MongoDB on your system. -2. Start the MongoDB service. -3. Verify that MongoDB is running by opening a command prompt and running the command `mongo --version`. - ## Environment Variables The following environment variables are used in this project: @@ -24,3 +13,7 @@ Make sure to set these variables in a `.env` file at the root of your project. 1. To run the development server, create a `./development.env` file and add environment variables as per `./example.env` 2. To run the production server, create a `./production.env` file and add environment variables as per `./example.env` +## To start the server + +1. Run `npm i` + diff --git a/upload-api/README.md b/upload-api/README.md index f7a287e54..7970b35a0 100644 --- a/upload-api/README.md +++ b/upload-api/README.md @@ -18,7 +18,7 @@ npm install The following environment variables are used in this project: - `PORT`: The port number on which the application runs. Default is `4002`. -- `NODE_BACKEND_API`: The backend API endpoint. Default is `http://localhost:5000`. +- `NODE_BACKEND_API`: The backend API endpoint. Default is `http://localhost:5001`. Make sure to set these variables in a `.env` file at the root of your project. @@ -39,7 +39,7 @@ The following configuration is used in this project: - `buketKey`: The key for the AWS S3 bucket. Default is `project/package 45.zip`. ### Local Path -- `localPath`: The local path to the extracted files. for example is `/upload-api/extracted_files/package 45.zip`. +- `localPath`: The local path to the extracted files. for example `/upload-api/extracted_files/package 45.zip`. ## Repository - Type: git From 4afb805ae7a9a1096ea6ca15008b945f1d6092e4 Mon Sep 17 00:00:00 2001 From: AishDani Date: Tue, 10 Dec 2024 11:41:37 +0530 Subject: [PATCH 13/22] refactor:changed env file of upload-api service --- upload-api/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upload-api/.env b/upload-api/.env index 1c5d9649a..ea5f15669 100644 --- a/upload-api/.env +++ b/upload-api/.env @@ -1,2 +1,2 @@ PORT=4002 -NODE_BACKEND_API=http://localhost:5000 +NODE_BACKEND_API=http://localhost:5001 From dff07890ed1ccd28c0e1e4dce43b38620e9adbb1 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 10 Dec 2024 17:05:38 +0530 Subject: [PATCH 14/22] sca-scan.yml From 815ea0e06849bc6a8d66df77775430d7d049cfa4 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 10 Dec 2024 17:05:50 +0530 Subject: [PATCH 15/22] jira.yml From b815abb577840e23a5717aa498a3dae5d2c7ad57 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 10 Dec 2024 17:05:51 +0530 Subject: [PATCH 16/22] sast-scan.yml From 789b55673ef82e584b8cec43934a2e015402e0d7 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 10 Dec 2024 17:05:56 +0530 Subject: [PATCH 17/22] Updated codeowners --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b6192f200..ada22a902 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,4 @@ +* @contentstack/tso-migration-pr-reviewers .github/workflows/sca-scan.yml @contentstack/security-admin .github/workflows/sast-scan.yml @contentstack/security-admin .github/workflows/jira.yml @contentstack/security-admin From 889fa4e5712208dfe175949ab912f65423f090a4 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 10 Dec 2024 17:22:07 +0530 Subject: [PATCH 18/22] Update sca-scan.yml From eb43ffa80c8108965c20fd2c361afb08ac675004 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 10 Dec 2024 19:23:53 +0530 Subject: [PATCH 19/22] Delete cli/packages/contentstack-dev-dependencies/.snyk --- cli/packages/contentstack-dev-dependencies/.snyk | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 cli/packages/contentstack-dev-dependencies/.snyk diff --git a/cli/packages/contentstack-dev-dependencies/.snyk b/cli/packages/contentstack-dev-dependencies/.snyk deleted file mode 100644 index 69b495d0e..000000000 --- a/cli/packages/contentstack-dev-dependencies/.snyk +++ /dev/null @@ -1,10 +0,0 @@ -# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. -version: v1.25.0 -# ignores vulnerabilities until expiry date; change duration by modifying expiry date -ignore: - SNYK-JS-ASYNC-7414156: - - '*': - reason: 'https://contentstack.atlassian.net/browse/CLOUD-6762' - expires: 2024-08-02T13:54:17.307Z - created: 2024-07-03T13:54:17.314Z -patch: {} From 6b9c7c8d5294574bc70b5d436c3cc23e8cd99982 Mon Sep 17 00:00:00 2001 From: RohitKini <57343193+RohitKini@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:09:19 +0530 Subject: [PATCH 20/22] updated readme.md --- README.md | 128 +++++++++++++++++++++++++++++++++++++------ api/README.md | 19 ------- ui/README.md | 63 --------------------- upload-api/README.md | 55 ------------------- 4 files changed, 111 insertions(+), 154 deletions(-) diff --git a/README.md b/README.md index 004ba678e..3fc06f9f1 100644 --- a/README.md +++ b/README.md @@ -8,32 +8,126 @@ Clone the repository: git clone https://github.com/contentstack/migration-v2.git cd migration-v2 ``` + +Check for readme.md files and install dependencies for folders + +## migration-v2 API + +This is the migration V2's node server. + +### Environment Variables +The following environment variables are used in this project: + +- `APP_TOKEN_KEY`: The token key for the application. Default is `MIGRATION_V2`. +- `PORT`: The port number on which the application runs. Default is `5001`. + +Make sure to set these variables in a `.env` file at the root of your project. + +1. To run the development server, create a `./development.env` file and add environment variables as per `./example.env` +2. To run the production server, create a `./production.env` file and add environment variables as per `./example.env` + +### To start the server +Run `npm run dev` + + +## Migration UI + +Migration UI is a web application designed to facilitate the migration of content. It provides a user-friendly interface for managing and migrating content efficiently. + +### Features +- User-friendly interface for content migration +- Integration with Contentstack +- State management with Redux Toolkit +- Comprehensive testing with Testing Library + +### Installation + +1. Navigate to the project directory: + ```sh + cd ui + ``` + +2. Install the dependencies: + ```sh + npm install + ``` + +### Environment Variables + +The following environment variables are used in this project: + +- `REACT_APP_WEBSITE_BASE_URL`: The base URL for the website. Default is `http://localhost:3000/`. +- `REACT_APP_BASE_API_URL`: The base URL for the API. Default is `http://localhost:5001/`. +- `REACT_APP_API_VERSION`: The version of the API. Default is `v2`. +- `REACT_APP_HOST`: The host URL for the application. Default is `http://localhost:3000`. +- `REACT_APP_UPLOAD_SERVER`: The URL for the upload server. Default is `http://localhost:4002/`. +- `REACT_APP_OFFLINE_CMS`: A flag to indicate if the CMS is offline. Default is `true`. + +Make sure to set these variables in a `.env` file at the root of your ui project. + +### Usage +Start the development server: +```sh +npm start +``` + +Open your browser and navigate to http://localhost:3000. + +### Dependencies +- @contentstack/json-rte-serializer: ^2.0.5 +- @contentstack/venus-components: ^2.2.4 +- @reduxjs/toolkit: ^2.2.5 +- @testing-library/jest-dom: ^5.17.0 +- @testing-library/react: ^13.4.0 +- @testing-library/user-event: ^13.5.0 +- @types/react: ^18.2.28 +- @types/react-dom: ^18.2.13 +- @types/react-redux: ^7.1.33 + +## Migration v2 upload-api +### Overview +The migration-v2 upload-api project is designed to facilitate the migration of different CMS to Contentstack functionalities. + +### Installation +Navigate to the project directory: +``` +cd migration-v2/upload-api +``` Install dependencies: ``` npm install ``` -Check for readme.md files and install dependencies for folders +### Environment Variables -1. go to api folder - ``` - cd api - npm install - ``` +The following environment variables are used in this project: -2. go to ui folder - ``` - cd ui - npm install - ``` +- `PORT`: The port number on which the application runs. Default is `4002`. +- `NODE_BACKEND_API`: The backend API endpoint. Default is `http://localhost:5001`. -3. go to upload-api folder - ``` - cd upload-api - npm install - ``` +Make sure to set these variables in a `.env` file at the root of your project. + +### Configuration +Please refer sample.config.json and provide this config in index.ts of config folder of upload-api/src +The following configuration is used in this project: + +- `plan.dropdown.optionLimit`: The limit for dropdown options. Default is `100`. +- `cmsType`: The type of CMS used. Default is `sitecore`. +- `isLocalPath`: A flag to indicate if the path is local. Default is `true`. + +#### AWS Data +- `awsRegion`: The AWS region. Default is `us-east-2`. +- `awsAccessKeyId`: The AWS access key ID. +- `awsSecretAccessKey`: The AWS secret access key. +- `awsSessionToken`: The AWS session token. +- `bucketName`: The name of the AWS S3 bucket. Default is `migartion-test`. +- `buketKey`: The key for the AWS S3 bucket. Default is `project/package 45.zip`. + +#### Local Path +- `localPath`: The local path to the extracted files. for example `/upload-api/extracted_files/package 45.zip`. -4. go to cli folder +## Cli +Navigate to the project directory 1. Install pnpm Since pnpm is required, you need to install it globally if it's not already installed: ``` diff --git a/api/README.md b/api/README.md index fa2a522e5..e69de29bb 100644 --- a/api/README.md +++ b/api/README.md @@ -1,19 +0,0 @@ -# migration-v2 API - -This is the migration V2's node server. - -## Environment Variables -The following environment variables are used in this project: - -- `APP_TOKEN_KEY`: The token key for the application. Default is `MIGRATION_V2`. -- `PORT`: The port number on which the application runs. Default is `5001`. - -Make sure to set these variables in a `.env` file at the root of your project. - -1. To run the development server, create a `./development.env` file and add environment variables as per `./example.env` -2. To run the production server, create a `./production.env` file and add environment variables as per `./example.env` - -## To start the server - -1. Run `npm i` - diff --git a/ui/README.md b/ui/README.md index f8e2de361..8b1378917 100644 --- a/ui/README.md +++ b/ui/README.md @@ -1,64 +1 @@ -# Migration UI -Migration UI is a web application designed to facilitate the migration of content. It provides a user-friendly interface for managing and migrating content efficiently. - -## Features -- User-friendly interface for content migration -- Integration with Contentstack -- State management with Redux Toolkit -- Comprehensive testing with Testing Library - -## Installation - -1. Clone the repository: - ```sh - git clone https://github.com/contentstack/migration-v2 - ``` - -2. Navigate to the project directory: - ```sh - cd ui - ``` - -3. Install the dependencies: - ```sh - npm install - ``` - -## Environment Variables - -The following environment variables are used in this project: - -- `REACT_APP_WEBSITE_BASE_URL`: The base URL for the website. Default is `http://localhost:3000/`. -- `REACT_APP_BASE_API_URL`: The base URL for the API. Default is `http://localhost:5001/`. -- `REACT_APP_API_VERSION`: The version of the API. Default is `v2`. -- `REACT_APP_HOST`: The host URL for the application. Default is `http://localhost:3000`. -- `REACT_APP_UPLOAD_SERVER`: The URL for the upload server. Default is `http://localhost:4002/`. -- `REACT_APP_OFFLINE_CMS`: A flag to indicate if the CMS is offline. Default is `true`. - -Make sure to set these variables in a `.env` file at the root of your ui project. - -## Usage -Start the development server: -```sh -npm start -``` - -Open your browser and navigate to http://localhost:3000. - -## Dependencies -- @contentstack/json-rte-serializer: ^2.0.5 -- @contentstack/venus-components: ^2.2.4 -- @reduxjs/toolkit: ^2.2.5 -- @testing-library/jest-dom: ^5.17.0 -- @testing-library/react: ^13.4.0 -- @testing-library/user-event: ^13.5.0 -- @types/react: ^18.2.28 -- @types/react-dom: ^18.2.13 -- @types/react-redux: ^7.1.33 - -## Contributing -Contributions are welcome! Please open an issue or submit a pull request for any changes. - -## License -This project is licensed under the MIT License. diff --git a/upload-api/README.md b/upload-api/README.md index 7970b35a0..e69de29bb 100644 --- a/upload-api/README.md +++ b/upload-api/README.md @@ -1,55 +0,0 @@ -# Migration v2 upload-api -## Overview -The migration-v2 upload-api project is designed to facilitate the migration of different CMS to Contentstack functionalities. - -## Installation -Clone the repository: -``` -git clone https://github.com/contentstack/migration-v2.git -cd migration-v2/upload-api -``` -Install dependencies: -``` -npm install -``` - -## Environment Variables - -The following environment variables are used in this project: - -- `PORT`: The port number on which the application runs. Default is `4002`. -- `NODE_BACKEND_API`: The backend API endpoint. Default is `http://localhost:5001`. - -Make sure to set these variables in a `.env` file at the root of your project. - -## Configuration -Please refer sample.config.json and provide this config in index.ts of config folder of upload-api/src -The following configuration is used in this project: - -- `plan.dropdown.optionLimit`: The limit for dropdown options. Default is `100`. -- `cmsType`: The type of CMS used. Default is `sitecore`. -- `isLocalPath`: A flag to indicate if the path is local. Default is `true`. - -### AWS Data -- `awsRegion`: The AWS region. Default is `us-east-2`. -- `awsAccessKeyId`: The AWS access key ID. -- `awsSecretAccessKey`: The AWS secret access key. -- `awsSessionToken`: The AWS session token. -- `bucketName`: The name of the AWS S3 bucket. Default is `migartion-test`. -- `buketKey`: The key for the AWS S3 bucket. Default is `project/package 45.zip`. - -### Local Path -- `localPath`: The local path to the extracted files. for example `/upload-api/extracted_files/package 45.zip`. - -## Repository -- Type: git -- URL: https://github.com/contentstack/migration-v2.git - -## License -This project is licensed under the ISC License. - -## Author -The author information is not specified. - -## Contact -For further assistance, please contact the project maintainer through the issues page on GitHub. From 4af4c883cf693ae296849f7578d7cdcd9a2e6fb9 Mon Sep 17 00:00:00 2001 From: RohitKini <57343193+RohitKini@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:10:39 +0530 Subject: [PATCH 21/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3fc06f9f1..3f079c37e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ cd migration-v2 Check for readme.md files and install dependencies for folders -## migration-v2 API +## Migration-v2 API This is the migration V2's node server. From 3b5ecdbd22ac198a52c7577231985b8b523d2bd4 Mon Sep 17 00:00:00 2001 From: umeshmore45 Date: Thu, 9 Jan 2025 16:27:25 +0530 Subject: [PATCH 22/22] reslved minor bugs --- api/src/utils/content-type-creator.utils.ts | 3 +- api/src/utils/test-folder-creator.utils.ts | 36 +++++++- upload-api/migration-sitecore/utils/index.js | 91 +++++++++++++------- 3 files changed, 95 insertions(+), 35 deletions(-) diff --git a/api/src/utils/content-type-creator.utils.ts b/api/src/utils/content-type-creator.utils.ts index d02d1ba63..2c3fa357e 100644 --- a/api/src/utils/content-type-creator.utils.ts +++ b/api/src/utils/content-type-creator.utils.ts @@ -192,7 +192,8 @@ const convertToSchemaFormate = ({ field, advanced = true }: any) => { "unique": field?.advanced?.unique ?? false, "non_localizable": field.advanced?.nonLocalizable ?? false }; - data.field_metadata.default_value = field?.advanced?.default_value ?? null; + const default_value = field?.advanced?.options?.length ? (field?.advanced?.options?.find((item: any) => (item?.key === field?.advanced?.default_value) || (item?.key === field?.advanced?.default_value))) : { value: field?.advanced?.default_value }; + data.field_metadata.default_value = default_value?.value ?? null; return data; } case 'radio': { diff --git a/api/src/utils/test-folder-creator.utils.ts b/api/src/utils/test-folder-creator.utils.ts index 8e83f670e..79e993cb9 100644 --- a/api/src/utils/test-folder-creator.utils.ts +++ b/api/src/utils/test-folder-creator.utils.ts @@ -10,7 +10,9 @@ const { ASSETS_SCHEMA_FILE, CONTENT_TYPES_DIR_NAME, CONTENT_TYPES_SCHEMA_FILE, - ENTRIES_MASTER_FILE + ENTRIES_MASTER_FILE, + GLOBAL_FIELDS_DIR_NAME, + GLOBAL_FIELDS_FILE_NAME } = MIGRATION_DATA_CONFIG; @@ -201,10 +203,41 @@ const sortAssets = async (baseDir: string) => { await fs.promises.writeFile(path.join(assetsPath, ASSETS_SCHEMA_FILE), JSON?.stringify?.(assetsMeta)); } +const writeGlobalField = async (schema: any, globalSave: string, filePath: string) => { + try { + await fs.promises.access(globalSave); + } catch (err) { + try { + await fs.promises.mkdir(globalSave, { recursive: true }); + } catch (mkdirErr) { + console.error("🚀 ~ fs.mkdir ~ err:", mkdirErr); + return; + } + } + try { + await fs.promises.writeFile(filePath, JSON.stringify(schema, null, 2)); + } catch (writeErr) { + console.error("🚀 ~ fs.writeFile ~ err:", writeErr); + } +}; + +const sortGlobalField = async (baseDir: string, finalData: any) => { + const globalSave = path.join(process.cwd(), baseDir, GLOBAL_FIELDS_DIR_NAME); + const globalPath = path.join(globalSave, GLOBAL_FIELDS_FILE_NAME); + const globalData = await JSON.parse(await fs.promises.readFile(globalPath, 'utf8')); + const globalResult = []; + for await (const ct of globalData) { + await lookForReference(ct, finalData); + globalResult?.push(ct); + } + await writeGlobalField(globalResult, globalPath, globalPath); +} + const sortContentType = async (baseDir: string, finalData: any) => { const contentTypePath: string = path.join(process.cwd(), baseDir, CONTENT_TYPES_DIR_NAME); const contentSave = path.join(baseDir, CONTENT_TYPES_DIR_NAME); const ctData = await JSON.parse(await fs.promises.readFile(path.join(contentTypePath, CONTENT_TYPES_SCHEMA_FILE), 'utf8')); + await sortGlobalField(baseDir, finalData); const contentTypes: any = []; for await (const ct of finalData) { const findCtData = ctData?.find((ele: any) => ele?.uid === ct?.contentType); @@ -218,6 +251,7 @@ const sortContentType = async (baseDir: string, finalData: any) => { } + export const testFolderCreator = async ({ destinationStackId }: any) => { const sanitizedStackId = path.basename(destinationStackId); const baseDir = path.join(MIGRATION_DATA_CONFIG.DATA, sanitizedStackId); diff --git a/upload-api/migration-sitecore/utils/index.js b/upload-api/migration-sitecore/utils/index.js index cae85bd5f..519e6ac8d 100644 --- a/upload-api/migration-sitecore/utils/index.js +++ b/upload-api/migration-sitecore/utils/index.js @@ -1,48 +1,73 @@ const restrictedUid = [ - "uid", "api_key", - "created_at", - "deleted_at", - "updated_at", - "tags_array", - "klass_id", - "applikation_id", - "*_ids", - "id", - "_id", - "ACL", - "SYS_ACL", - "DEFAULT_ACL", - "app_user_object_uid", + "built_io_application_user", + "built_io_application_user_role", + "built_io_audit_log", + "built_io_environment", + "built_io_extensions", + "built_io_installation_data", + "built_io_label", + "built_io_language", + "built_io_publish_queue", + "built_io_release", "built_io_upload", + "cs_branches", + "org_uid", + "sys_asset", + "sys_metadata", + "_exists", + "_regex", + "*_ids", // Fields cannot have UID ending with "_ids." + "__indexes", "__loc", - "tags", + "__meta", + "__v", + "_id", "_owner", + "_publish_locales", + "_shouldFilter", + "_shouldLean", "_version", - "toJSON", - "save", - "update", + "ACL", + "api_key", + "app_user_object_uid", + "applikation_id", + "built_io_upload", + "contentstackFilters", + "created_at", + "created_by", + "DEFAULT_ACL", + "deleted_at", + "dimension", "domain", - "shard_account", - "shard_app", - "shard_random", + "embedded_items", "hook", - "__indexes", - "__meta", - "created_by", - "updated_by", + "id", "inbuilt_class", - "tenant_id", - "isSystemUser", "isApplicationUser", "isNew", - "_shouldLean", - "_shouldFilter", - "options", - "_version", - "__v", + "isSystemUser", + "klass_id", "locale", - "publish_details" + "options", + "org_uid", + "publish_details", + "save", + "shard_account", + "shard_app", + "shard_random", + "SYS_ACL", + "sys_assets", + "sys_metadata", + "tags", + "tags_array", + "taxonomies", + "tenant_id", + "toJSON", + "uid", + "update", + "updated_at", + "updated_by" ]; module.exports = restrictedUid; \ No newline at end of file