Skip to content

Commit 0664255

Browse files
authored
Merge pull request #1500 from contentstack/release/hotfix
Release/hotfix
2 parents 6c19247 + afb938b commit 0664255

File tree

17 files changed

+1411
-1434
lines changed

17 files changed

+1411
-1434
lines changed

package-lock.json

Lines changed: 172 additions & 219 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/contentstack-audit/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ EXAMPLES
267267
$ csdx plugins
268268
```
269269

270-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/index.ts)_
270+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/index.ts)_
271271

272272
## `csdx plugins:add PLUGIN`
273273

@@ -341,7 +341,7 @@ EXAMPLES
341341
$ csdx plugins:inspect myplugin
342342
```
343343

344-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/inspect.ts)_
344+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/inspect.ts)_
345345

346346
## `csdx plugins:install PLUGIN`
347347

@@ -390,7 +390,7 @@ EXAMPLES
390390
$ csdx plugins:install someuser/someplugin
391391
```
392392

393-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/install.ts)_
393+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/install.ts)_
394394

395395
## `csdx plugins:link PATH`
396396

@@ -420,7 +420,7 @@ EXAMPLES
420420
$ csdx plugins:link myplugin
421421
```
422422

423-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/link.ts)_
423+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/link.ts)_
424424

425425
## `csdx plugins:remove [PLUGIN]`
426426

@@ -461,7 +461,7 @@ FLAGS
461461
--reinstall Reinstall all plugins after uninstalling.
462462
```
463463

464-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/reset.ts)_
464+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/reset.ts)_
465465

466466
## `csdx plugins:uninstall [PLUGIN]`
467467

@@ -489,7 +489,7 @@ EXAMPLES
489489
$ csdx plugins:uninstall myplugin
490490
```
491491

492-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/uninstall.ts)_
492+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/uninstall.ts)_
493493

494494
## `csdx plugins:unlink [PLUGIN]`
495495

@@ -533,5 +533,5 @@ DESCRIPTION
533533
Update installed plugins.
534534
```
535535

536-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/update.ts)_
536+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/update.ts)_
537537
<!-- commandsstop -->

packages/contentstack-clone/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dependencies": {
88
"@colors/colors": "^1.5.0",
99
"@contentstack/cli-cm-export": "~1.11.6",
10-
"@contentstack/cli-cm-import": "~1.16.3",
10+
"@contentstack/cli-cm-import": "~1.16.4",
1111
"@contentstack/cli-command": "~1.2.19",
1212
"@contentstack/cli-utilities": "~1.7.0",
1313
"async": "^3.2.4",

packages/contentstack-import/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import
4747
$ csdx COMMAND
4848
running command...
4949
$ csdx (--version)
50-
@contentstack/cli-cm-import/1.16.3 darwin-arm64 node-v22.2.0
50+
@contentstack/cli-cm-import/1.16.4 darwin-arm64 node-v22.2.0
5151
$ csdx --help [COMMAND]
5252
USAGE
5353
$ csdx COMMAND

packages/contentstack-import/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-cm-import",
33
"description": "Contentstack CLI plugin to import content into stack",
4-
"version": "1.16.3",
4+
"version": "1.16.4",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"dependencies": {

packages/contentstack-import/src/import/modules/entries.ts

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
} from '../../utils';
2525
import { ModuleClassParams } from '../../types';
2626
import BaseClass, { ApiOptions } from './base-class';
27-
2827
export default class EntriesImport extends BaseClass {
2928
private assetUidMapperPath: string;
3029
private assetUidMapper: Record<string, any>;
@@ -68,11 +67,25 @@ export default class EntriesImport extends BaseClass {
6867
this.entriesUIDMapperPath = path.join(sanitizePath(this.entriesMapperPath), 'uid-mapping.json');
6968
this.uniqueUidMapperPath = path.join(sanitizePath(this.entriesMapperPath), 'unique-mapping.json');
7069
this.modifiedCTsPath = path.join(sanitizePath(this.entriesMapperPath), 'modified-schemas.json');
71-
this.marketplaceAppMapperPath = path.join(sanitizePath(this.importConfig.data), 'mapper', 'marketplace_apps', 'uid-mapping.json');
72-
this.taxonomiesPath = path.join(sanitizePath(this.importConfig.data), 'mapper', 'taxonomies', 'terms', 'success.json');
70+
this.marketplaceAppMapperPath = path.join(
71+
sanitizePath(this.importConfig.data),
72+
'mapper',
73+
'marketplace_apps',
74+
'uid-mapping.json',
75+
);
76+
this.taxonomiesPath = path.join(
77+
sanitizePath(this.importConfig.data),
78+
'mapper',
79+
'taxonomies',
80+
'terms',
81+
'success.json',
82+
);
7383
this.entriesConfig = importConfig.modules.entries;
7484
this.entriesPath = path.resolve(sanitizePath(importConfig.data), sanitizePath(this.entriesConfig.dirName));
75-
this.cTsPath = path.resolve(sanitizePath(importConfig.data), sanitizePath(importConfig.modules['content-types'].dirName));
85+
this.cTsPath = path.resolve(
86+
sanitizePath(importConfig.data),
87+
sanitizePath(importConfig.modules['content-types'].dirName),
88+
);
7689
this.localesPath = path.resolve(
7790
sanitizePath(importConfig.data),
7891
sanitizePath(importConfig.modules.locales.dirName),
@@ -898,23 +911,35 @@ export default class EntriesImport extends BaseClass {
898911

899912
if (chunk) {
900913
let apiContent = values(chunk as Record<string, any>[]);
901-
await this.makeConcurrentCall({
902-
apiContent,
903-
processName,
904-
indexerCount,
905-
currentIndexer: +index,
906-
apiParams: {
907-
reject: onReject,
908-
resolve: onSuccess,
909-
entity: 'publish-entries',
910-
includeParamOnCompletion: true,
911-
serializeData: this.serializePublishEntries.bind(this),
912-
additionalInfo: { contentType, locale, cTUid },
913-
},
914-
concurrencyLimit: this.importConcurrency,
915-
}).then(() => {
916-
log(this.importConfig, `Published entries for content type ${cTUid} in locale ${locale}`, 'success');
914+
let apiContentDuplicate: any = [];
915+
apiContent.forEach((content: Record<string, any>) => {
916+
content?.publish_details?.forEach((publish: Record<string, any>) => {
917+
let c2 = { ...content };
918+
c2.locale = publish.locale;
919+
c2.publish_details = [publish];
920+
apiContentDuplicate.push(c2);
921+
});
917922
});
923+
for (let i = 0; i < apiContentDuplicate.length; i++) {
924+
let apiContent = [apiContentDuplicate[i]];
925+
await this.makeConcurrentCall({
926+
apiContent,
927+
processName,
928+
indexerCount,
929+
currentIndexer: +index,
930+
apiParams: {
931+
reject: onReject,
932+
resolve: onSuccess,
933+
entity: 'publish-entries',
934+
includeParamOnCompletion: true,
935+
serializeData: this.serializePublishEntries.bind(this),
936+
additionalInfo: { contentType, locale: apiContentDuplicate[i]?.locale, cTUid },
937+
},
938+
concurrencyLimit: this.importConcurrency,
939+
}).then(() => {
940+
log(this.importConfig, `Published entries for content type ${cTUid} in locale ${locale}`, 'success');
941+
});
942+
}
918943
}
919944
}
920945
}

packages/contentstack-launch/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-launch
1919
$ csdx COMMAND
2020
running command...
2121
$ csdx (--version|-v)
22-
@contentstack/cli-launch/1.0.19 darwin-arm64 node-v22.2.0
22+
@contentstack/cli-launch/1.1.0 darwin-arm64 node-v22.2.0
2323
$ csdx --help [COMMAND]
2424
USAGE
2525
$ csdx COMMAND

packages/contentstack-launch/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/cli-launch",
3-
"version": "1.0.19",
3+
"version": "1.1.0",
44
"description": "Launch related operations",
55
"author": "Contentstack CLI",
66
"bin": {

packages/contentstack-launch/src/adapters/base-class.ts

Lines changed: 82 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,19 @@ export default class BaseClass {
262262
this.log(error, 'error');
263263
this.exit(1);
264264
})) || [];
265-
this.config.selectedStack = await ux
266-
.inquire({
267-
name: 'stack',
268-
type: 'search-list',
269-
choices: listOfStacks,
270-
message: 'Stack',
271-
})
272-
.then((name) => find(listOfStacks, { name }));
265+
266+
if (this.config.selectedStack) {
267+
this.config.selectedStack = find(listOfStacks, { api_key: this.config.selectedStack });
268+
} else {
269+
this.config.selectedStack = await ux
270+
.inquire({
271+
name: 'stack',
272+
type: 'search-list',
273+
choices: listOfStacks,
274+
message: 'Stack',
275+
})
276+
.then((name) => find(listOfStacks, { name }));
277+
}
273278
}
274279

275280
/**
@@ -299,16 +304,19 @@ export default class BaseClass {
299304
this.exit(1);
300305
})) || [];
301306

302-
this.config.deliveryToken = await ux
303-
.inquire({
304-
type: 'search-list',
305-
name: 'deliveryToken',
306-
choices: listOfDeliveryTokens,
307-
message: 'Delivery token',
308-
})
309-
.then((name) => find(listOfDeliveryTokens, { name }) as Record<string, any>);
310-
311-
this.config.environment = this.config.deliveryToken.scope[0]?.environments[0]?.name;
307+
if (this.config.deliveryToken) {
308+
this.config.deliveryToken = find(listOfDeliveryTokens, { token: this.config.deliveryToken });
309+
} else {
310+
this.config.deliveryToken = await ux
311+
.inquire({
312+
type: 'search-list',
313+
name: 'deliveryToken',
314+
choices: listOfDeliveryTokens,
315+
message: 'Delivery token',
316+
})
317+
.then((name) => find(listOfDeliveryTokens, { name }) as Record<string, any>);
318+
}
319+
this.config.environment = this.config.deliveryToken?.scope[0]?.environments[0]?.name;
312320
}
313321

314322
/**
@@ -321,38 +329,51 @@ export default class BaseClass {
321329
let addNew = true;
322330
const envVariables = [];
323331

324-
do {
325-
const variable = await ux
326-
.inquire({
327-
type: 'input',
328-
name: 'variable',
329-
message:
330-
'Enter key and value with a colon between them, and use a comma(,) for the key-value pair. Format: <key1>:<value1>, <key2>:<value2> Ex: APP_ENV:prod, TEST_ENV:testVal',
331-
})
332-
.then((variable) => {
333-
return map(split(variable as string, ','), (variable) => {
334-
let [key, value] = split(variable as string, ':');
335-
value = (value || '').trim();
336-
key = (key || '').trim();
337-
338-
return { key, value };
339-
}).filter(({ key }) => key);
340-
});
332+
if (!this.config.envVariables) {
333+
do {
334+
const variable = await ux
335+
.inquire({
336+
type: 'input',
337+
name: 'variable',
338+
message:
339+
'Enter key and value with a colon between them, and use a comma(,) for the key-value pair. Format: <key1>:<value1>, <key2>:<value2> Ex: APP_ENV:prod, TEST_ENV:testVal',
340+
})
341+
.then((variable) => {
342+
return map(split(variable as string, ','), (variable) => {
343+
let [key, value] = split(variable as string, ':');
344+
value = (value || '').trim();
345+
key = (key || '').trim();
346+
347+
return { key, value };
348+
}).filter(({ key }) => key);
349+
});
341350

342-
envVariables.push(...variable);
351+
envVariables.push(...variable);
343352

344-
if (
345-
!(await ux.inquire({
346-
type: 'confirm',
347-
name: 'canImportFromStack',
348-
message: 'Would you like to add more variables?',
349-
}))
350-
) {
351-
addNew = false;
352-
}
353-
} while (addNew);
353+
if (
354+
!(await ux.inquire({
355+
type: 'confirm',
356+
name: 'canImportFromStack',
357+
message: 'Would you like to add more variables?',
358+
}))
359+
) {
360+
addNew = false;
361+
}
362+
} while (addNew);
363+
364+
this.envVariables.push(...envVariables);
365+
} else {
366+
if (typeof this.config.envVariables === 'string') {
367+
const variable = map(split(this.config.envVariables as string, ','), (variable) => {
368+
let [key, value] = split(variable as string, ':');
369+
value = (value || '').trim();
370+
key = (key || '').trim();
354371

355-
this.envVariables.push(...envVariables);
372+
return { key, value };
373+
});
374+
this.envVariables.push(...variable);
375+
}
376+
}
356377
}
357378

358379
/**
@@ -492,19 +513,16 @@ export default class BaseClass {
492513
* @memberof BaseClass
493514
*/
494515
async handleEnvImportFlow(): Promise<void> {
495-
const variablePreparationTypeOptions = [
496-
'Import variables from a stack',
497-
'Manually add custom variables to the list',
498-
'Import variables from the local env file',
499-
];
500-
const variablePreparationType: Array<string> = await ux.inquire({
501-
type: 'checkbox',
502-
name: 'variablePreparationType',
503-
default: this.config.framework,
504-
choices: variablePreparationTypeOptions,
505-
message: 'Import variables from a stack and/or manually add custom variables to the list',
506-
// validate: this.inquireRequireValidation,
507-
});
516+
const variablePreparationType =
517+
this.config.variableType ||
518+
(await ux.inquire({
519+
type: 'checkbox',
520+
name: 'variablePreparationType',
521+
default: this.config.framework,
522+
choices: this.config.variablePreparationTypeOptions,
523+
message: 'Import variables from a stack and/or manually add custom variables to the list',
524+
// validate: this.inquireRequireValidation,
525+
}));
508526

509527
if (includes(variablePreparationType, 'Import variables from a stack')) {
510528
await this.importEnvFromStack();
@@ -519,8 +537,8 @@ export default class BaseClass {
519537
if (this.envVariables.length) {
520538
this.printAllVariables();
521539
} else {
522-
this.log('Import variables from a stack and/or manually add custom variables to the list', 'warn');
523-
// this.exit(1);
540+
this.log('Please provide env file!', 'error');
541+
this.exit(1);
524542
}
525543
}
526544

@@ -533,10 +551,10 @@ export default class BaseClass {
533551
async importVariableFromLocalConfig(): Promise<void> {
534552
const localEnv =
535553
dotEnv.config({
536-
path: this.config.projectBasePath,
554+
path: `${this.config.projectBasePath}/.env.local`,
537555
}).parsed ||
538556
dotEnv.config({
539-
path: `${this.config.projectBasePath}/.env.local`,
557+
path: this.config.projectBasePath,
540558
}).parsed;
541559

542560
if (!isEmpty(localEnv)) {

0 commit comments

Comments
 (0)