Skip to content

Commit 88d6b5d

Browse files
authored
Merge pull request #3 from contentstack/staging
DX | 08-12-2025 | Release
2 parents 422ce9b + 0cc0ded commit 88d6b5d

35 files changed

+23367
-1
lines changed

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "oclif"
3+
}

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release Plugin
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '22.x'
19+
registry-url: 'https://registry.npmjs.org'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Run tests
26+
run: npm test
27+
28+
- name: Build package
29+
run: npm run prepack
30+
31+
- name: Publish to npm
32+
id: publish
33+
uses: JS-DevTools/npm-publish@v3
34+
with:
35+
token: ${{ secrets.NPM_TOKEN }}
36+
access: public
37+
38+
- name: Create GitHub Release
39+
if: steps.publish.outputs.type != 'none'
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
VERSION: ${{ steps.publish.outputs.version }}
43+
run: |
44+
gh release create v"$VERSION" \
45+
--title "Release $VERSION" \
46+
--generate-notes

.github/workflows/unit-test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Run Unit Tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
run-tests:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Set up Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '22.x'
18+
19+
- name: Install dependencies
20+
run: npm ci
21+
22+
- name: Run tests
23+
run: npm run test

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*-debug.log
2+
*-error.log
3+
/.nyc_output
4+
/dist
5+
/tmp
6+
/logs
7+
/yarn.lock
8+
node_modules
9+
/coverage

.nycrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"all": true,
3+
"extension": [".js"],
4+
"include": ["src/**/*.js"],
5+
"exclude": ["test/**", "node_modules/**"],
6+
"reporter": ["text"],
7+
"check-coverage": true,
8+
"statements": 80,
9+
"branches": 60,
10+
"functions": 80,
11+
"lines": 80
12+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Contentstack
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 156 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,156 @@
1-
# cli-cm-migrate-rte
1+
# @contentstack/cli-cm-migrate-rte
2+
3+
It is Contentstack’s CLI plugin to migrate rte. Using this command, you can copy existing value of HTML RTE into JSON RTE.
4+
5+
<!-- toc -->
6+
* [@contentstack/cli-cm-migrate-rte](#contentstackcli-cm-migrate-rte)
7+
* [Usage](#usage)
8+
* [Commands](#commands)
9+
<!-- tocstop -->
10+
11+
# Usage
12+
13+
<!-- usage -->
14+
```sh-session
15+
$ npm install -g @contentstack/cli-cm-migrate-rte
16+
$ csdx COMMAND
17+
running command...
18+
$ csdx (--version)
19+
@contentstack/cli-cm-migrate-rte/2.0.0-beta darwin-arm64 node-v22.14.0
20+
$ csdx --help [COMMAND]
21+
USAGE
22+
$ csdx COMMAND
23+
...
24+
```
25+
<!-- usagestop -->
26+
27+
# Commands
28+
29+
<!-- commands -->
30+
* [`csdx cm:entries:migrate-html-rte`](#csdx-cmentriesmigrate-html-rte)
31+
* [`csdx cm:migrate-rte`](#csdx-cmmigrate-rte)
32+
33+
## `csdx cm:entries:migrate-html-rte`
34+
35+
Migration script to migrate content from HTML RTE to JSON RTE
36+
37+
```
38+
USAGE
39+
$ csdx cm:entries:migrate-html-rte [-c <value>] [-a <value>] [--stack-api-key <value>] [--content-type <value>]
40+
[--global-field] [-y] [--branch <value>] [--html-path <value> --json-path <value>] [--delay <value>] [--locale
41+
<value>] [--batch-limit <value>]
42+
43+
FLAGS
44+
-a, --alias=<value> Enter the alias name. You must use either the --alias flag or the --stack-api-key flag.
45+
-c, --config-path=<value> Specify the path where your config file is located.
46+
-y, --yes Avoids reconfirmation of your configuration.
47+
--batch-limit=<value> [default: 50] Provide batch limit for updating entries (default: 50).
48+
--branch=<value> The name of the branch to be used.
49+
--content-type=<value> Specify the UID of the content type for which you want to migrate HTML RTE content.
50+
--delay=<value> [default: 1000] To set the interval time between the migration of HTML RTE to JSON RTE in
51+
subsequent entries of a content type. The default value is 1,000 milliseconds.
52+
--global-field Checks whether the specified UID belongs to a content type or a global field. This flag
53+
is set to false by default.
54+
--html-path=<value> Enter the path to the HTML RTE whose content you want to migrate.
55+
--json-path=<value> Enter the path to the JSON RTE to which you want to migrate the HTML RTE content.
56+
--locale=<value> The locale from which entries will be migrated.
57+
--stack-api-key=<value> API key of the source stack. You must use either the --stack-api-key flag or the --alias
58+
flag.
59+
60+
DESCRIPTION
61+
Migration script to migrate content from HTML RTE to JSON RTE
62+
63+
ALIASES
64+
$ csdx cm:migrate-rte
65+
66+
EXAMPLES
67+
General Usage
68+
69+
$ csdx cm:entries:migrate-html-rte --config-path path/to/config.json
70+
71+
72+
73+
Using Flags
74+
75+
$ csdx cm:entries:migrate-html-rte --alias alias --content-type content_type_uid --html-path html-path --json-path json-path
76+
77+
78+
79+
Nested RTE
80+
81+
$ 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
82+
83+
84+
85+
$ 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
86+
87+
88+
89+
Global Field
90+
91+
$ csdx cm:entries:migrate-html-rte --alias alias --content-type global_field_uid --global-field --html-path html-path --json-path json-path
92+
```
93+
94+
_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)_
95+
96+
## `csdx cm:migrate-rte`
97+
98+
Migration script to migrate content from HTML RTE to JSON RTE
99+
100+
```
101+
USAGE
102+
$ csdx cm:migrate-rte [-c <value>] [-a <value>] [--stack-api-key <value>] [--content-type <value>]
103+
[--global-field] [-y] [--branch <value>] [--html-path <value> --json-path <value>] [--delay <value>] [--locale
104+
<value>] [--batch-limit <value>]
105+
106+
FLAGS
107+
-a, --alias=<value> Enter the alias name. You must use either the --alias flag or the --stack-api-key flag.
108+
-c, --config-path=<value> Specify the path where your config file is located.
109+
-y, --yes Avoids reconfirmation of your configuration.
110+
--batch-limit=<value> [default: 50] Provide batch limit for updating entries (default: 50).
111+
--branch=<value> The name of the branch to be used.
112+
--content-type=<value> Specify the UID of the content type for which you want to migrate HTML RTE content.
113+
--delay=<value> [default: 1000] To set the interval time between the migration of HTML RTE to JSON RTE in
114+
subsequent entries of a content type. The default value is 1,000 milliseconds.
115+
--global-field Checks whether the specified UID belongs to a content type or a global field. This flag
116+
is set to false by default.
117+
--html-path=<value> Enter the path to the HTML RTE whose content you want to migrate.
118+
--json-path=<value> Enter the path to the JSON RTE to which you want to migrate the HTML RTE content.
119+
--locale=<value> The locale from which entries will be migrated.
120+
--stack-api-key=<value> API key of the source stack. You must use either the --stack-api-key flag or the --alias
121+
flag.
122+
123+
DESCRIPTION
124+
Migration script to migrate content from HTML RTE to JSON RTE
125+
126+
ALIASES
127+
$ csdx cm:migrate-rte
128+
129+
EXAMPLES
130+
General Usage
131+
132+
$ csdx cm:entries:migrate-html-rte --config-path path/to/config.json
133+
134+
135+
136+
Using Flags
137+
138+
$ csdx cm:entries:migrate-html-rte --alias alias --content-type content_type_uid --html-path html-path --json-path json-path
139+
140+
141+
142+
Nested RTE
143+
144+
$ 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
145+
146+
147+
148+
$ 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
149+
150+
151+
152+
Global Field
153+
154+
$ csdx cm:entries:migrate-html-rte --alias alias --content-type global_field_uid --global-field --html-path html-path --json-path json-path
155+
```
156+
<!-- commandsstop -->

bin/run.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node "%~dp0\run" %*

bin/run.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env node
2+
3+
// eslint-disable-next-line unicorn/prefer-top-level-await
4+
(async () => {
5+
const oclif = await import('@oclif/core');
6+
await oclif.execute({ development: false, dir: __dirname });
7+
})();

0 commit comments

Comments
 (0)