Skip to content

Commit

Permalink
Merge pull request #1634 from contentstack/staging
Browse files Browse the repository at this point in the history
DX | CLI | Hotfix Release 21-10-2024
  • Loading branch information
aman19K authored Oct 22, 2024
2 parents 1dc8747 + 56f41cd commit f932a1f
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 45 deletions.
18 changes: 9 additions & 9 deletions 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 packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dependencies": {
"@colors/colors": "^1.5.0",
"@contentstack/cli-cm-export": "~1.14.1",
"@contentstack/cli-cm-import": "~1.19.1",
"@contentstack/cli-cm-import": "~1.19.2",
"@contentstack/cli-command": "~1.3.2",
"@contentstack/cli-utilities": "~1.8.0",
"async": "^3.2.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.3.2",
"@contentstack/cli-variants": "~1.1.1",
"@contentstack/cli-variants": "~1.1.2",
"@contentstack/cli-utilities": "~1.8.0",
"@oclif/core": "^3.26.5",
"async": "^3.2.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-import/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-import/1.19.1 darwin-arm64 node-v22.2.0
@contentstack/cli-cm-import/1.19.2 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-import/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@contentstack/cli-cm-import",
"description": "Contentstack CLI plugin to import content into stack",
"version": "1.19.1",
"version": "1.19.2",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-audit": "~1.7.2",
"@contentstack/cli-command": "~1.3.2",
"@contentstack/cli-utilities": "~1.8.0",
"@contentstack/management": "~1.17.0",
"@contentstack/cli-variants": "~1.1.1",
"@contentstack/cli-variants": "~1.1.2",
"@oclif/core": "^3.26.5",
"big-json": "^3.2.0",
"bluebird": "^3.7.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/contentstack-import/src/import/modules/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,9 @@ export default class EntriesImport extends BaseClass {
const contentType = find(this.cTs, { uid: cTUid });

const onSuccess = ({ response, apiData: entry, additionalInfo }: any) => {
this.entriesForVariant.push({ content_type: cTUid, entry_uid: entry.uid, locale });
if (additionalInfo[entry.uid]?.isLocalized) {
let oldUid = additionalInfo[entry.uid].entryOldUid;
this.entriesForVariant.push({ content_type: cTUid, entry_uid: oldUid, locale });
log(
this.importConfig,
`Localized entry: '${entry.title}' of content type ${cTUid} in locale ${locale}`,
Expand All @@ -370,6 +370,7 @@ export default class EntriesImport extends BaseClass {
entriesCreateFileHelper.writeIntoFile({ [oldUid]: entry } as any, { mapKeyVal: true });
} else {
log(this.importConfig, `Created entry: '${entry.title}' of content type ${cTUid} in locale ${locale}`, 'info');
this.entriesForVariant.push({ content_type: cTUid, entry_uid: entry.uid, locale });
// This is for creating localized entries that do not have a counterpart in master locale.
// For example : To create entry1 in fr-fr, where en-us is the master locale
// entry1 will get created in en-us first, then fr-fr version will be created
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-seed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-cm-import": "~1.19.1",
"@contentstack/cli-cm-import": "~1.19.2",
"@contentstack/cli-command": "~1.3.2",
"@contentstack/cli-utilities": "~1.8.0",
"inquirer": "8.2.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-variants/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-variants",
"version": "1.1.1",
"version": "1.1.2",
"description": "Variants plugin",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
37 changes: 23 additions & 14 deletions packages/contentstack-variants/src/import/variant-entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,9 @@ export default class VariantEntries extends VariantAdapter<VariantHttpClient<Imp
},
};
super(Object.assign(omit(config, ['helpers']), conf));
this.entriesMapperPath = resolve(
sanitizePath(config.backupDir),
'mapper',
'entries',
);
this.entriesMapperPath = resolve(sanitizePath(config.backupDir), 'mapper', 'entries');
this.personalizeConfig = this.config.modules.personalize;
this.entriesDirPath = resolve(
sanitizePath(config.backupDir),
sanitizePath(config.modules.entries.dirName),
);
this.entriesDirPath = resolve(sanitizePath(config.backupDir), sanitizePath(config.modules.entries.dirName));
this.failedVariantPath = resolve(sanitizePath(this.entriesMapperPath), 'failed-entry-variants.json');
this.failedVariantEntries = new Map();
}
Expand Down Expand Up @@ -169,7 +162,7 @@ export default class VariantEntries extends VariantAdapter<VariantHttpClient<Imp
sanitizePath(variantEntry.dirName),
sanitizePath(entry_uid),
);
const fs = new FsUtility({ basePath: variantEntryBasePath });
const fs = new FsUtility({ basePath: variantEntryBasePath, createDirIfNotExist: false });

for (const _ in fs.indexFileContent) {
try {
Expand Down Expand Up @@ -217,13 +210,21 @@ export default class VariantEntries extends VariantAdapter<VariantHttpClient<Imp

for (let [, variantEntry] of entries(batch)) {
const onSuccess = ({ response, apiData: { entryUid, variantUid }, log }: any) => {
log(this.config, `Created entry variant: '${variantUid}' of entry uid ${entryUid}`, 'info');
log(
this.config,
`Created entry variant: '${variantUid}' of entry uid ${entryUid} locale '${locale}'`,
'info',
);
};

const onReject = ({ error, apiData, log }: any) => {
const { entryUid, variantUid } = apiData;
this.failedVariantEntries.set(variantUid, apiData);
log(this.config, `Failed to create entry variant: '${variantUid}' of entry uid ${entryUid}`, 'error');
log(
this.config,
`Failed to create entry variant: '${variantUid}' of entry uid ${entryUid} locale '${locale}'`,
'error',
);
log(this.config, error, 'error');
};
// NOTE Find new variant Id by old Id
Expand Down Expand Up @@ -440,10 +441,18 @@ export default class VariantEntries extends VariantAdapter<VariantHttpClient<Imp
}

const onSuccess = ({ response, apiData: { entryUid, variantUid }, log }: any) => {
log(this.config, `Entry variant: '${variantUid}' of entry uid ${entryUid} published successfully!`, 'info');
log(
this.config,
`Entry variant: '${variantUid}' of entry '${entryUid}' published on locales '${locales.join(',')}'`,
'info',
);
};
const onReject = ({ error, apiData: { entryUid, variantUid }, log }: any) => {
log(this.config, `Failed to publish entry variant: '${variantUid}' of entry uid ${entryUid}`, 'error');
log(
this.config,
`Failed to publish entry variant: '${variantUid}' of entry uid ${entryUid} on locales '${locales.join(',')}'`,
'error',
);
log(this.config, formatError(error), 'error');
};

Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-variants/src/types/variant-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export type PublishVariantEntryDto = {
uid: string;
version?: number;
}[];
}
};
locale: string;
version?: number;
} & AnyProperty;
} & AnyProperty;
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,12 @@ export class VariantHttpClient<C> extends AdapterHelper<C, HttpClient> implement
const { entry_uid, content_type_uid } = options;
let endpoint = `content_types/${content_type_uid}/entries/${entry_uid}/publish`;

const onSuccess = (response: any) => resolve({ response, apiData: { entryUid: entry_uid, variantUid }, log });
const onSuccess = (response: any) =>
resolve({ response, apiData: { entryUid: entry_uid, variantUid, locales: input.entry.locales }, log });
const onReject = (error: any) =>
reject({
error,
apiData: { entryUid: entry_uid, variantUid },
apiData: { entryUid: entry_uid, variantUid, locales: input.entry.locales },
log,
});

Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli
$ csdx COMMAND
running command...
$ csdx (--version|-v)
@contentstack/cli/1.28.0 darwin-arm64 node-v22.8.0
@contentstack/cli/1.28.1 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli",
"description": "Command-line tool (CLI) to interact with Contentstack",
"version": "1.28.0",
"version": "1.28.1",
"author": "Contentstack",
"bin": {
"csdx": "./bin/run.js"
Expand Down Expand Up @@ -30,7 +30,7 @@
"@contentstack/cli-cm-export": "~1.14.1",
"@contentstack/cli-cm-clone": "~1.13.0",
"@contentstack/cli-cm-export-to-csv": "~1.7.3",
"@contentstack/cli-cm-import": "~1.19.1",
"@contentstack/cli-cm-import": "~1.19.2",
"@contentstack/cli-cm-migrate-rte": "~1.4.20",
"@contentstack/cli-cm-seed": "~1.10.0",
"@contentstack/cli-command": "~1.3.2",
Expand All @@ -39,7 +39,7 @@
"@contentstack/cli-migration": "~1.6.3",
"@contentstack/cli-utilities": "~1.8.0",
"@contentstack/management": "~1.17.0",
"@contentstack/cli-variants": "~1.1.1",
"@contentstack/cli-variants": "~1.1.2",
"@oclif/core": "^3.26.5",
"@oclif/plugin-help": "^5",
"@oclif/plugin-not-found": "^2.4.0",
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

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

0 comments on commit f932a1f

Please sign in to comment.