Skip to content

Commit

Permalink
Merge branch 'development' into feat/CS-42773
Browse files Browse the repository at this point in the history
  • Loading branch information
shafeeqd959 authored Dec 21, 2023
2 parents fa06b82 + e7fdcb1 commit b9b3835
Show file tree
Hide file tree
Showing 26 changed files with 110 additions and 60 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions packages/contentstack-audit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-audit",
"version": "1.3.1",
"version": "1.3.2",
"description": "Contentstack audit plugin",
"author": "Contentstack CLI",
"homepage": "https://github.com/contentstack/cli",
Expand All @@ -19,7 +19,7 @@
],
"dependencies": {
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"@oclif/plugin-help": "^5",
"@oclif/plugin-plugins": "^4.1.9",
"chalk": "^4.1.2",
Expand Down
15 changes: 10 additions & 5 deletions packages/contentstack-audit/src/audit-base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
this.log(this.messages.NO_MISSING_REF_FOUND, 'info');
this.log('');

if (this.currentCommand === 'cm:stacks:audit:fix' && existsSync(this.sharedConfig.basePath)) {
if (
this.flags['copy-dir'] &&
this.currentCommand === 'cm:stacks:audit:fix' &&
existsSync(this.sharedConfig.basePath)
) {
// NOTE Clean up the backup dir if no issue found while audit the content
rmSync(this.sharedConfig.basePath, { recursive: true });
}
Expand Down Expand Up @@ -135,10 +139,11 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
}

// NOTE create bkp directory
const backupDirPath = `${(this.flags['copy-path'] || this.flags['data-dir']).replace(
/\/+$/,
'',
)}_backup_${uuid()}`;
const backupDirPath = `${(
this.flags['copy-path'] ||
this.flags['data-dir'] ||
this.sharedConfig.basePath
).replace(/\/+$/, '')}_backup_${uuid()}`;

if (!existsSync(backupDirPath)) {
mkdirSync(backupDirPath, { recursive: true });
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-audit/src/modules/content-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,9 @@ export default class ContentType {

if (!refExist) {
this.missingRefs[this.currentUid].push(refErrorObj);
}

return refExist;
return block;
}
}

block.schema = this.runFixOnSchema(tree, block.schema as ContentTypeSchemaType[]);
Expand Down
35 changes: 22 additions & 13 deletions packages/contentstack-audit/src/modules/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ export default class Entries {
const { uid, title } = entry;
this.currentUid = uid;
this.currentTitle = title;
this.missingRefs[this.currentUid] = [];
this.lookForReference([{ uid, name: title }], ctSchema, this.entries[entryUid]);

if (!this.missingRefs[this.currentUid]) {
this.missingRefs[this.currentUid] = [];
}

this.lookForReference([{ locale: code, uid, name: title }], ctSchema, this.entries[entryUid]);
this.log(
$t(auditMsg.SCAN_ENTRY_SUCCESS_MSG, {
title,
Expand Down Expand Up @@ -451,6 +455,10 @@ export default class Entries {
schema.forEach((field) => {
const { uid, data_type } = field;

if (!Object(entry).hasOwnProperty(uid)) {
return;
}

switch (data_type) {
case 'global_field':
entry[uid] = this.fixGlobalFieldReferences(
Expand All @@ -474,7 +482,6 @@ export default class Entries {
break;
}
}

// NOTE Reference field
entry[uid] = this.fixMissingReferences(
[...tree, { uid: field.uid, name: field.display_name, data_type: field.data_type }],
Expand Down Expand Up @@ -623,19 +630,21 @@ export default class Entries {
return this.fixJsonRteMissingReferences([...tree, { index, type: child?.type, uid: child?.uid }], field, child);
}) as EntryJsonRTEFieldDataType[];
} else {
entry.children = entry.children
.map((child) => {
const refExist = this.jsonRefCheck(tree, field, child);
if (entry?.children) {
entry.children = entry.children
.map((child) => {
const refExist = this.jsonRefCheck(tree, field, child);

if (!refExist) return null;
if (!refExist) return null;

if (isEmpty(child.children)) {
child = this.fixJsonRteMissingReferences(tree, field, child) as EntryJsonRTEFieldDataType;
}
if (!isEmpty(child.children)) {
child = this.fixJsonRteMissingReferences(tree, field, child) as EntryJsonRTEFieldDataType;
}

return child;
})
.filter((val) => val) as EntryJsonRTEFieldDataType[];
return child;
})
.filter((val) => val) as EntryJsonRTEFieldDataType[];
}
}

return entry;
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"dependencies": {
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"chalk": "^4.0.0",
"debug": "^4.1.1",
"inquirer": "8.2.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@contentstack/cli-cm-seed": "~1.7.0",
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"inquirer": "8.2.4",
"mkdirp": "^1.0.4",
"tar": "^6.1.13"
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-branches/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.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"@oclif/core": "^2.9.3",
"async": "^3.2.4",
"big-json": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bulk-publish/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.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"bluebird": "^3.7.2",
"chalk": "^4.1.2",
"dotenv": "^16.1.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@contentstack/cli-cm-export": "~1.10.2",
"@contentstack/cli-cm-import": "~1.12.2",
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"@colors/colors": "^1.5.0",
"async": "^3.2.4",
"chalk": "^4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-command/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"format": "eslint src/**/*.ts --fix"
},
"dependencies": {
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"contentstack": "^3.10.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-config/1.5.0 darwin-arm64 node-v20.8.0
@contentstack/cli-config/1.5.1 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-config",
"description": "Contentstack CLI plugin for configuration",
"version": "1.5.0",
"version": "1.5.1",
"author": "Contentstack",
"scripts": {
"build": "npm run clean && npm run compile",
Expand All @@ -22,7 +22,7 @@
},
"dependencies": {
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"chalk": "^4.0.0",
"debug": "^4.1.1",
"inquirer": "8.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export default class SetEarlyAccessHeaderCommand extends Command {
flags: { header: earlyAccessHeader, 'header-alias': earlyAccessHeaderAlias },
} = await this.parse(SetEarlyAccessHeaderCommand);
if (!earlyAccessHeaderAlias) {
earlyAccessHeaderAlias = await interactive.askEarlyAccessHeaderAlias();
earlyAccessHeaderAlias = (await interactive.askEarlyAccessHeaderAlias())?.trim();
}
if (!earlyAccessHeader) {
earlyAccessHeader = await interactive.askEarlyAccessHeaderValue();
earlyAccessHeader = (await interactive.askEarlyAccessHeaderValue())?.trim();
}
configHandler.set(`earlyAccessHeaders.${earlyAccessHeaderAlias}`, earlyAccessHeader);
cliux.success(
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-export-to-csv/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.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"chalk": "^4.1.0",
"fast-csv": "^4.3.6",
"inquirer": "8.2.4",
Expand Down
4 changes: 2 additions & 2 deletions 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.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"@oclif/core": "^2.9.3",
"async": "^3.2.4",
"big-json": "^3.2.0",
Expand Down Expand Up @@ -98,4 +98,4 @@
}
},
"repository": "https://github.com/contentstack/cli"
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-import/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.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"@contentstack/management": "~1.13.0",
"@oclif/core": "^2.9.3",
"axios": "^1.6.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-launch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@apollo/client": "^3.7.9",
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"@oclif/core": "^2.9.3",
"@oclif/plugin-help": "^5",
"@oclif/plugin-plugins": "^4.1.9",
Expand Down Expand Up @@ -105,4 +105,4 @@
"launch:deployments": "LNCH-DPLMNT"
}
}
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-migrate-rte/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.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"@contentstack/json-rte-serializer": "~2.0.4",
"collapse-whitespace": "^1.1.7",
"chalk": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-migration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"async": "^3.2.4",
"callsites": "^3.1.0",
"cardinal": "^2.1.1",
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 @@ -7,7 +7,7 @@
"dependencies": {
"@contentstack/cli-cm-import": "~1.12.2",
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.9",
"@contentstack/cli-utilities": "~1.5.10",
"inquirer": "8.2.4",
"mkdirp": "^1.0.4",
"tar": "^6.1.13",
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-utilities/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-utilities",
"version": "1.5.9",
"version": "1.5.10",
"description": "Utilities for contentstack projects",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -83,4 +83,4 @@
"tslib": "^1.13.0",
"typescript": "^4.9.3"
}
}
}
Loading

0 comments on commit b9b3835

Please sign in to comment.