Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a15fb5e
Initialize project with essential files including ESLint configuratio…
harshitha-cstk Nov 21, 2025
48204f6
Update README.md to include detailed usage instructions and command d…
harshitha-cstk Nov 21, 2025
f3addd4
Update unit-test workflow to use 'npm run test' for executing tests, …
harshitha-cstk Nov 21, 2025
a66d12a
Update .gitignore to include 'snyk_output.log' and 'oclif.manifest.js…
harshitha-cstk Nov 21, 2025
161c1d5
delete unused test setup file.
harshitha-cstk Nov 21, 2025
fb9149d
Add NYC configuration file and enhance test setup
harshitha-cstk Nov 21, 2025
818897c
Refactor unit-test workflow and update test setup for improved clarity
harshitha-cstk Nov 21, 2025
c264728
Refactor test setup by removing nock cleanup logic for improved simpl…
harshitha-cstk Nov 24, 2025
b1b4934
Remove .nycrc configuration file and update test script for improved …
harshitha-cstk Nov 24, 2025
b25d3dd
Comment out test case for config validation without alias property to…
harshitha-cstk Nov 24, 2025
62a41e1
Refactor migration config validation test by renaming test case for c…
harshitha-cstk Nov 24, 2025
19b0e50
Enhance migration config validation test by uncommenting and refining…
harshitha-cstk Nov 24, 2025
0945311
Enhance json-migration tests by adding detailed comments, fixing typo…
harshitha-cstk Nov 24, 2025
c2fb5b0
Refactor json-migration tests by removing unnecessary comments, impro…
harshitha-cstk Nov 24, 2025
3b74c16
Update test script in package.json to simplify command and improve cl…
harshitha-cstk Nov 24, 2025
e64a991
Refactor json-migration test to improve clarity by consolidating toke…
harshitha-cstk Nov 24, 2025
d63da3e
Update json-migration test to log actual error object for better debu…
harshitha-cstk Nov 24, 2025
4dbb585
Add .nycrc configuration for coverage reporting and update unit test …
harshitha-cstk Nov 24, 2025
02a7638
Update .nycrc configuration to include source files and specify JavaS…
harshitha-cstk Nov 24, 2025
3f9d84b
Update test script in package.json to disable coverage checks, improv…
harshitha-cstk Nov 24, 2025
c29fe14
Skip invalid alias and config file tests in json-migration test suite…
harshitha-cstk Nov 24, 2025
8a4462c
Remove debug steps from unit test workflow and enable previously skip…
harshitha-cstk Nov 24, 2025
bc378d9
Fix typo in json-migration test case for invalid alias error handling…
harshitha-cstk Nov 24, 2025
f03d5f3
Comment out invalid alias and config file tests in json-migration tes…
harshitha-cstk Nov 24, 2025
0196ca1
Refactor json-migration test suite to restore error handling for inva…
harshitha-cstk Nov 24, 2025
01a4e25
Add default region configuration for tests to prevent "Region not con…
harshitha-cstk Nov 24, 2025
1c3edf7
Enhance json-migration test suite by adding comments for clarity, res…
harshitha-cstk Nov 24, 2025
269b01e
Refactor json-migration test suite to streamline API URL stubbing by …
harshitha-cstk Nov 24, 2025
7362f89
Update test script in package.json to include setup file and enhance …
harshitha-cstk Nov 24, 2025
7fab7c6
Add global configuration for test environment to prevent region error…
harshitha-cstk Nov 24, 2025
fb9446b
Add nock setup for API mocks in tests to streamline content type and …
harshitha-cstk Nov 24, 2025
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
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "oclif"
}
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release Plugin

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Build package
run: npm run prepack

- name: Publish to npm
id: publish
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
access: public

- name: Create GitHub Release
if: steps.publish.outputs.type != 'none'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.publish.outputs.version }}
run: |
gh release create v"$VERSION" \
--title "Release $VERSION" \
--generate-notes
23 changes: 23 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run Unit Tests

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*-debug.log
*-error.log
/.nyc_output
/dist
/tmp
/logs
/yarn.lock
node_modules
/coverage
12 changes: 12 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"all": true,
"extension": [".js"],
"include": ["src/**/*.js"],
"exclude": ["test/**", "node_modules/**"],
"reporter": ["text"],
"check-coverage": true,
"statements": 80,
"branches": 60,
"functions": 80,
"lines": 80
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Contentstack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
157 changes: 156 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,156 @@
# cli-cm-migrate-rte
# @contentstack/cli-cm-migrate-rte

It is Contentstack’s CLI plugin to migrate rte. Using this command, you can copy existing value of HTML RTE into JSON RTE.

<!-- toc -->
* [@contentstack/cli-cm-migrate-rte](#contentstackcli-cm-migrate-rte)
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->

# Usage

<!-- usage -->
```sh-session
$ npm install -g @contentstack/cli-cm-migrate-rte
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-migrate-rte/2.0.0-beta darwin-arm64 node-v22.14.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
...
```
<!-- usagestop -->

# Commands

<!-- commands -->
* [`csdx cm:entries:migrate-html-rte`](#csdx-cmentriesmigrate-html-rte)
* [`csdx cm:migrate-rte`](#csdx-cmmigrate-rte)

## `csdx cm:entries:migrate-html-rte`

Migration script to migrate content from HTML RTE to JSON RTE

```
USAGE
$ csdx cm:entries:migrate-html-rte [-c <value>] [-a <value>] [--stack-api-key <value>] [--content-type <value>]
[--global-field] [-y] [--branch <value>] [--html-path <value> --json-path <value>] [--delay <value>] [--locale
<value>] [--batch-limit <value>]

FLAGS
-a, --alias=<value> Enter the alias name. You must use either the --alias flag or the --stack-api-key flag.
-c, --config-path=<value> Specify the path where your config file is located.
-y, --yes Avoids reconfirmation of your configuration.
--batch-limit=<value> [default: 50] Provide batch limit for updating entries (default: 50).
--branch=<value> The name of the branch to be used.
--content-type=<value> Specify the UID of the content type for which you want to migrate HTML RTE content.
--delay=<value> [default: 1000] To set the interval time between the migration of HTML RTE to JSON RTE in
subsequent entries of a content type. The default value is 1,000 milliseconds.
--global-field Checks whether the specified UID belongs to a content type or a global field. This flag
is set to false by default.
--html-path=<value> Enter the path to the HTML RTE whose content you want to migrate.
--json-path=<value> Enter the path to the JSON RTE to which you want to migrate the HTML RTE content.
--locale=<value> The locale from which entries will be migrated.
--stack-api-key=<value> API key of the source stack. You must use either the --stack-api-key flag or the --alias
flag.

DESCRIPTION
Migration script to migrate content from HTML RTE to JSON RTE

ALIASES
$ csdx cm:migrate-rte

EXAMPLES
General Usage

$ csdx cm:entries:migrate-html-rte --config-path path/to/config.json



Using Flags

$ csdx cm:entries:migrate-html-rte --alias alias --content-type content_type_uid --html-path html-path --json-path json-path



Nested RTE

$ csdx cm:entries:migrate-html-rte --alias alias --content-type content_type_uid --html-path modular_block_uid.block_uid.html_rte_uid --json-path modular_block_uid.block_uid.json_rte_uid



$ csdx cm:entries:migrate-html-rte --alias alias --content-type content_type_uid --html-path group_uid.html_rte_uid --json-path group_uid.json_rte_uid



Global Field

$ csdx cm:entries:migrate-html-rte --alias alias --content-type global_field_uid --global-field --html-path html-path --json-path json-path
```

_See code: [src/commands/cm/entries/migrate-html-rte.js](https://github.com/contentstack/cli-cm-migrate-rte/blob/main/src/commands/cm/entries/migrate-html-rte.js)_

## `csdx cm:migrate-rte`

Migration script to migrate content from HTML RTE to JSON RTE

```
USAGE
$ csdx cm:migrate-rte [-c <value>] [-a <value>] [--stack-api-key <value>] [--content-type <value>]
[--global-field] [-y] [--branch <value>] [--html-path <value> --json-path <value>] [--delay <value>] [--locale
<value>] [--batch-limit <value>]

FLAGS
-a, --alias=<value> Enter the alias name. You must use either the --alias flag or the --stack-api-key flag.
-c, --config-path=<value> Specify the path where your config file is located.
-y, --yes Avoids reconfirmation of your configuration.
--batch-limit=<value> [default: 50] Provide batch limit for updating entries (default: 50).
--branch=<value> The name of the branch to be used.
--content-type=<value> Specify the UID of the content type for which you want to migrate HTML RTE content.
--delay=<value> [default: 1000] To set the interval time between the migration of HTML RTE to JSON RTE in
subsequent entries of a content type. The default value is 1,000 milliseconds.
--global-field Checks whether the specified UID belongs to a content type or a global field. This flag
is set to false by default.
--html-path=<value> Enter the path to the HTML RTE whose content you want to migrate.
--json-path=<value> Enter the path to the JSON RTE to which you want to migrate the HTML RTE content.
--locale=<value> The locale from which entries will be migrated.
--stack-api-key=<value> API key of the source stack. You must use either the --stack-api-key flag or the --alias
flag.

DESCRIPTION
Migration script to migrate content from HTML RTE to JSON RTE

ALIASES
$ csdx cm:migrate-rte

EXAMPLES
General Usage

$ csdx cm:entries:migrate-html-rte --config-path path/to/config.json



Using Flags

$ csdx cm:entries:migrate-html-rte --alias alias --content-type content_type_uid --html-path html-path --json-path json-path



Nested RTE

$ csdx cm:entries:migrate-html-rte --alias alias --content-type content_type_uid --html-path modular_block_uid.block_uid.html_rte_uid --json-path modular_block_uid.block_uid.json_rte_uid



$ csdx cm:entries:migrate-html-rte --alias alias --content-type content_type_uid --html-path group_uid.html_rte_uid --json-path group_uid.json_rte_uid



Global Field

$ csdx cm:entries:migrate-html-rte --alias alias --content-type global_field_uid --global-field --html-path html-path --json-path json-path
```
<!-- commandsstop -->
3 changes: 3 additions & 0 deletions bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
7 changes: 7 additions & 0 deletions bin/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env node

// eslint-disable-next-line unicorn/prefer-top-level-await
(async () => {
const oclif = await import('@oclif/core');
await oclif.execute({ development: false, dir: __dirname });
})();
Loading