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
206 changes: 2 additions & 204 deletions .talismanrc

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default class TokensAddCommand extends BaseCommand<typeof TokensAddComman

if (!isDelivery && !isManagement && !Boolean(environment)) {
log.debug('No token type specified, requesting user input', this.contextDetails);
let tokenType = await askTokenType();
const tokenType = await askTokenType();
isDelivery = tokenType === 'delivery';
isManagement = tokenType === 'management';
log.debug(`Token type selected: ${tokenType}`, this.contextDetails);
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-migrate-rte/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-migrate-rte
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-migrate-rte/1.6.2 darwin-arm64 node-v22.14.0
@contentstack/cli-cm-migrate-rte/2.0.0-beta.1 darwin-arm64 node-v24.11.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
8 changes: 2 additions & 6 deletions packages/contentstack-migrate-rte/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-migrate-rte",
"description": "Contentstack CLI plugin to migrate HTML RTE to JSON RTE",
"version": "1.6.2",
"version": "2.0.0-beta.1",
"author": "contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down Expand Up @@ -58,12 +58,8 @@
"clean": "rm -rf ./node_modules tsconfig.build.tsbuildinfo"
},
"csdxConfig": {
"expiredCommands": {
"cm:migrate-rte": "csdx cm:entries:migrate-html-rte"
},
"shortCommandName": {
"cm:entries:migrate-html-rte": "MGRTRTE",
"cm:migrate-rte": "O-MGRTRTE"
"cm:entries:migrate-html-rte": "MGRTRTE"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Command } = require('@contentstack/cli-command');
const { printFlagDeprecation, flags } = require('@contentstack/cli-utilities');
const { flags } = require('@contentstack/cli-utilities');
const { isEmpty } = require('lodash');
const chalk = require('chalk');
let {
Expand All @@ -22,10 +22,10 @@ class JsonMigrationCommand extends Command {
}
const stackOptions = { host: this.cmaHost };
if (config.alias) {
stackOptions.token = getToken(config.alias)
stackOptions.token = getToken(config.alias);
}
if (config['stack-api-key']) {
stackOptions.stackApiKey = config['stack-api-key']
stackOptions.stackApiKey = config['stack-api-key'];
}
if (config.branch) stackOptions.branch = config.branch;
let stack = await getStack(stackOptions);
Expand Down Expand Up @@ -83,7 +83,8 @@ JsonMigrationCommand.flags = {
required: false,
}),
'global-field': flags.boolean({
description: 'Checks whether the specified UID belongs to a content type or a global field. This flag is set to false by default.',
description:
'Checks whether the specified UID belongs to a content type or a global field. This flag is set to false by default.',
default: false,
required: false,
}),
Expand All @@ -108,7 +109,8 @@ JsonMigrationCommand.flags = {
required: false,
}),
delay: flags.integer({
description: '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.',
description:
'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.',
default: 1000,
required: false,
}),
Expand All @@ -120,37 +122,6 @@ JsonMigrationCommand.flags = {
description: 'Provide batch limit for updating entries (default: 50).',
default: 50,
}),

// To be deprecated
configPath: flags.string({
char: 'p',
description: 'Path to the config file',
hidden: true,
parse: printFlagDeprecation(['-p', '--configPath'], ['-c', '--config-path']),
}),
content_type: flags.string({
description: 'The content-type from which entries need to be migrated',
hidden: true,
parse: printFlagDeprecation(['-c', '--content_type'], ['--content-type']),
}),
isGlobalField: flags.boolean({
char: 'g',
description: 'Indicates that the current content type is a global field (default: false)',
hidden: true,
parse: printFlagDeprecation(['-g', '--isGlobalField'], ['--global-field']),
}),
htmlPath: flags.string({
char: 'h',
description: 'Provide the path of HTML RTE to migrate',
hidden: true,
parse: printFlagDeprecation(['-h', '--htmlPath'], ['--html-path']),
}),
jsonPath: flags.string({
char: 'j',
description: 'Provide the path of JSON RTE to migrate',
hidden: true,
parse: printFlagDeprecation(['-j', '--jsonPath'], ['--json-path']),
}),
};

JsonMigrationCommand.examples = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('Migration Config validation', () => {
.stub(cliux, 'confirm', () => true)
.stub(command, 'getToken', getTokenCallback)
.it('throw error on Empty paths', async () => {
const {error} = await runCommand(
const { error } = await runCommand(
['cm:entries:migrate-html-rte', '--config-path', './test/dummy/config/configWithEmptyPath.json', '--yes'],
{ root: process.cwd() },
);
Expand All @@ -67,7 +67,7 @@ describe('Migration Config validation', () => {
.stub(cliux, 'confirm', () => true)
.stub(command, 'getToken', getTokenCallback)
.it('throw error on invalid config type', async () => {
const {error} = await runCommand(
const { error } = await runCommand(
['cm:entries:migrate-html-rte', '--config-path', '../test/dummy/config/invalidConfig.json', '--yes'],
{ root: process.cwd() },
);
Expand Down Expand Up @@ -354,20 +354,23 @@ describe('Content Type with Single RTE Field of Single Type', function () {
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.it('throw error on invalid html rte path', async () => {
const { error } = await runCommand([
'cm:entries:migrate-html-rte',
'--alias',
'test1',
'--content-type',
'contenttypewithsinglerte',
'--html-path',
'rich_text_editor.invalidPath',
'--json-path',
'supercharged_rte',
'--yes',
'--delay',
'50',
],{ root: process.cwd() });
const { error } = await runCommand(
[
'cm:entries:migrate-html-rte',
'--alias',
'test1',
'--content-type',
'contenttypewithsinglerte',
'--html-path',
'rich_text_editor.invalidPath',
'--json-path',
'supercharged_rte',
'--yes',
'--delay',
'50',
],
{ root: process.cwd() },
);
expect(error.message).to.contain('The specified path to invalidPath HTML RTE does not exist.');
});

Expand Down Expand Up @@ -748,7 +751,7 @@ describe('Content Type with single rte of multiple type', () => {
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.it('execute using config file', async () => {
const {stdout} = await runCommand(
const { stdout } = await runCommand(
['cm:entries:migrate-html-rte', '--config-path', './test/dummy/config/configForMultipleRte.json', '--yes'],
{ root: process.cwd() },
);
Expand Down Expand Up @@ -884,57 +887,3 @@ describe('Content Type with multiple file field', () => {
expect(stdout).to.contain('Updated 1 Content Type(s) and 1 Entrie(s)');
});
});

describe('Migration with old flags and command', () => {
const getTokenCallback = sinon.stub();
getTokenCallback.withArgs('test1').returns({
token: 'testManagementToken',
apiKey: 'testApiKey',
type: 'management',
});

fancy
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.it('execute using config file w/o locale', async (ctx) => {
const { stdout } = await runCommand(
['cm:migrate-rte', '--configPath', './test/dummy/config/config.json', '--yes'],
{ root: process.cwd() },
);
expect(stdout).to.contain(
`WARNING!!! You're using the old (soon to be deprecated) Contentstack CLI flags (-p, --configPath). We recommend you to use the updated flags (-c, --config-path).`,
);
});

fancy
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.it('execute using flags (w/o locale)', async () => {
const { stdout } = await runCommand(
[
'cm:entries:migrate-html-rte',
'--alias',
'test1',
'--content_type',
'contenttypewithsinglerte',
'--htmlPath',
'rich_text_editor',
'--jsonPath',
'supercharged_rte',
'--delay',
'50',
],
{ root: process.cwd() },
);

expect(stdout).to.contain(
`WARNING!!! You're using the old (soon to be deprecated) Contentstack CLI flags (-c, --content_type). We recommend you to use the updated flags (--content-type).`,
);
expect(stdout).to.contain(
`WARNING!!! You're using the old (soon to be deprecated) Contentstack CLI flags (-h, --htmlPath). We recommend you to use the updated flags (--html-path)`,
);
expect(stdout).to.contain(
`WARNING!!! You're using the old (soon to be deprecated) Contentstack CLI flags (-j, --jsonPath). We recommend you to use the updated flags (--json-path).`,
);
});
});
4 changes: 2 additions & 2 deletions packages/contentstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2566,7 +2566,7 @@ EXAMPLES

$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>

$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>

$ csdx cm:migration --alias --file-path <migration/script/file/path> -k <api-key>
```
Expand Down Expand Up @@ -3029,7 +3029,7 @@ EXAMPLES

$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>

$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>

$ csdx cm:migration --alias --file-path <migration/script/file/path> -k <api-key>
```
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@contentstack/cli-cm-export-to-csv": "~1.10.0",
"@contentstack/cli-cm-import": "~2.0.0-beta.2",
"@contentstack/cli-cm-import-setup": "1.7.0",
"@contentstack/cli-cm-migrate-rte": "~1.6.2",
"@contentstack/cli-cm-migrate-rte": "~2.0.0-beta.1",
"@contentstack/cli-cm-seed": "~2.0.0-beta.2",
"@contentstack/cli-command": "~1.6.2",
"@contentstack/cli-config": "~1.15.3",
Expand Down
Loading