Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/sast-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
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
run: docker run -v /var/run/docker.sock:/var/run/docker.sock -v "${PWD}:/src" returntocorp/semgrep semgrep scan --config auto
68 changes: 51 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Migration v2

## Overview

The migration-v2 project is designed to facilitate the migration of assets and related functionalities. This project includes multiple components such as API, UI, and upload API.

## Installation

Clone the repository:

```
git clone https://github.com/contentstack/migration-v2.git
cd migration-v2
Expand All @@ -16,6 +20,7 @@ Check for readme.md files and install dependencies for folders
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`.
Expand All @@ -27,14 +32,15 @@ Make sure to set these variables in a `.env` file at the root of your project.
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`

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
Expand All @@ -43,14 +49,15 @@ Migration UI is a web application designed to facilitate the migration of conten
### Installation

1. Navigate to the project directory:
```sh
cd ui
```

```sh
cd ui
```

2. Install the dependencies:
```sh
npm install
```
```sh
npm install
```

### Environment Variables

Expand All @@ -66,14 +73,17 @@ The following environment variables are used in this project:
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
Expand All @@ -85,15 +95,21 @@ Open your browser and navigate to http://localhost:3000.
- @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
```
Expand All @@ -108,6 +124,7 @@ 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:

Expand All @@ -116,6 +133,7 @@ The following configuration is used in this project:
- `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.
Expand All @@ -124,22 +142,29 @@ 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 `/upload-api/extracted_files/package 45.zip`.

## 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:
```
npm install -g pnpm
```
2. Run the Setup Script
Now, run the main setup script specified in the package.json:
```
npm run setup-repo
```

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.
- `npm run upload`: Navigates to the upload-api directory and starts the upload API server.
Expand All @@ -149,29 +174,35 @@ Navigate to the project directory
- `npm test`: Displays an error message indicating that no tests are specified.

## Repository

- Type: git
- URL: https://github.com/contentstack/migration-v2.git

## Bugs and Issues

- URL: https://github.com/contentstack/migration-v2/issues

## Homepage

- URL: https://github.com/contentstack/migration-v2#readme

## DevDependencies

- husky: ^4.3.8
- prettier: ^2.4.1
- rimraf: ^3.0.2
- validate-branch-name: ^1.3.0

## Husky Configuration

```
"husky": {
"hooks": {}
}
```

- Branch Name Validation

```
"validate-branch-name": {
"pattern": "^(feature|bugfix|hotfix)/[a-z0-9-]{5,30}$",
Expand All @@ -180,10 +211,13 @@ Navigate to the project directory
```

## 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.
2 changes: 1 addition & 1 deletion api/src/constants/app/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3665,4 +3665,4 @@
}
],
"count": 11
}
}
56 changes: 32 additions & 24 deletions api/src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
export const CS_REGIONS = ["NA", "EU", "AZURE_NA", "AZURE_EU", "GCP_NA"];
export const DEVURLS: any = {
'NA': 'developerhub-api.contentstack.com',
'EU': 'eu-developerhub-api.contentstack.com',
'AZURE_NA': 'azure-na-developerhub-api.contentstack.com',
'AZURE_EU': 'azure-eu-developerhub-api.contentstack.com',
'GCP_NA': 'gcp-na-developerhub-api.contentstack.com',
}
NA: "developerhub-api.contentstack.com",
EU: "eu-developerhub-api.contentstack.com",
AZURE_NA: "azure-na-developerhub-api.contentstack.com",
AZURE_EU: "azure-eu-developerhub-api.contentstack.com",
GCP_NA: "gcp-na-developerhub-api.contentstack.com",
};
export const CMS = {
CONTENTFUL: "contentful",
SITECORE_V8: "sitecore v8",
SITECORE_V9: "sitecore v9",
SITECORE_V10: "sitecore v10",
WORDPRESS: "wordpress",
AEM: "aem",
}
};
export const MODULES = [
"Project",
"Migration",
Expand Down Expand Up @@ -58,7 +58,8 @@ export const HTTP_TEXTS = {
"Project's Fileformat confirmation updated successfully",
CMS_UPDATED: "Project's migration cms updated successfully",
STACK_UPDATED: "Project's migration stack details updated successfully",
CONTENT_MAPPER_UPDATED: "Project's migration content mapping updated successfully",
CONTENT_MAPPER_UPDATED:
"Project's migration content mapping updated successfully",
FILE_FORMAT_UPDATED: "Project's migration file format updated successfully",
DESTINATION_STACK_UPDATED:
"Project's migration destination stack updated successfully",
Expand Down Expand Up @@ -95,14 +96,11 @@ export const HTTP_TEXTS = {
"Sorry, the requested content mapper id does not exists.",
ADMIN_LOGIN_ERROR:
"Sorry, You Don't have admin access in any of the Organisation",
PROJECT_DELETE:
"Project Deleted Successfully",
PROJECT_REVERT:
"Project Reverted Successfully",
LOGS_NOT_FOUND:
"Sorry, no logs found for requested stack migration.",
PROJECT_DELETE: "Project Deleted Successfully",
PROJECT_REVERT: "Project Reverted Successfully",
LOGS_NOT_FOUND: "Sorry, no logs found for requested stack migration.",
MIGRATION_EXECUTION_KEY_UPDATED:
"Project's migration execution key updated successfully"
"Project's migration execution key updated successfully",
};

export const HTTP_RESPONSE_HEADERS = {
Expand Down Expand Up @@ -177,18 +175,28 @@ export const CONTENT_TYPE_STATUS = {
export const LOCALE_MAPPER: any = {
//not more than one locale mapping in master locale
masterLocale: {
'en-us': 'en'
"en-us": "en",
},
'fr': 'fr-fr'
}
fr: "fr-fr",
};
export const CHUNK_SIZE = 1048576;

export const LIST_EXTENSION_UID = 'bltc44e51cc9f4b0d80';
export const LIST_EXTENSION_UID = "bltc44e51cc9f4b0d80";

export const KEYTOREMOVE = [
"update", "fetch", "delete", "oauth", "hosting", "install", "reinstall",
"upgrade", "getRequests", "authorize", "authorization", "listInstallations"
]
"update",
"fetch",
"delete",
"oauth",
"hosting",
"install",
"reinstall",
"upgrade",
"getRequests",
"authorize",
"authorization",
"listInstallations",
];

export const MIGRATION_DATA_CONFIG = {
DATA: "./cmsMigrationData",
Expand Down Expand Up @@ -262,5 +270,5 @@ export const MIGRATION_DATA_CONFIG = {
GLOBAL_FIELDS_DIR_NAME: "global_fields",
GLOBAL_FIELDS_FILE_NAME: "globalfields.json",

EXPORT_INFO_FILE: "export-info.json"
}
EXPORT_INFO_FILE: "export-info.json",
};
13 changes: 6 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fs = require('fs');
const path = require('path');
const fs = require("fs");
const path = require("path");

const apiEnvContent = `
APP_TOKEN_KEY=MIGRATION_V2
Expand All @@ -21,19 +21,18 @@ NODE_BACKEND_API =http://localhost:5001
`;

const envFilePaths = {
API: path.join(__dirname, 'api', 'production.env'),
UI: path.join(__dirname, 'ui', '.env.local'),
'Upload-API': path.join(__dirname, 'upload-api', '.env'),
API: path.join(__dirname, "api", "production.env"),
UI: path.join(__dirname, "ui", ".env.local"),
"Upload-API": path.join(__dirname, "upload-api", ".env"),
};

// Define the contents for each file in an array
const envContents = {
API: apiEnvContent,
UI: uiEnvContent,
'Upload-API': uploadAPIEnvContent,
"Upload-API": uploadAPIEnvContent,
};


// Function to create env files
const createEnvFiles = () => {
// Loop through each key in the envFilePaths object
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"xml2js": "^0.5.0"
},
"husky": {
"hooks": {}
"hooks": {
"pre-commit": "npx validate-branch-name"
}
},
"validate-branch-name": {
"pattern": "^(feature|bugfix|hotfix)/[a-z0-9-]{5,30}$",
Expand Down
1 change: 0 additions & 1 deletion ui/README.md
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

8 changes: 4 additions & 4 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@types/react": "^18.2.28",
"@types/react-dom": "^18.2.13",
"@types/react-redux": "^7.1.33",
"axios": "^1.7.8",
"axios": "^1.8.2",
"bootstrap": "5.1.3",
"chokidar": "^3.6.0",
"final-form": "^4.20.10",
Expand Down
Loading
Loading