Skip to content

Commit 0259f27

Browse files
authored
Merge pull request #1265 from contentstack/staging
Merge staging to main
2 parents e746439 + 2d9524e commit 0259f27

36 files changed

Lines changed: 1394 additions & 956 deletions

File tree

package-lock.json

Lines changed: 1169 additions & 671 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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
1919
$ csdx COMMAND
2020
running command...
2121
$ csdx (--version|-v)
22-
@contentstack/cli-audit/1.3.2 darwin-arm64 node-v20.8.0
22+
@contentstack/cli-audit/1.3.4 darwin-arm64 node-v18.12.1
2323
$ csdx --help [COMMAND]
2424
USAGE
2525
$ csdx COMMAND
@@ -285,7 +285,7 @@ EXAMPLES
285285
$ csdx plugins
286286
```
287287

288-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/index.ts)_
288+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/index.ts)_
289289

290290
## `csdx plugins:install PLUGIN...`
291291

@@ -354,7 +354,7 @@ EXAMPLES
354354
$ csdx plugins:inspect myplugin
355355
```
356356

357-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/inspect.ts)_
357+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/inspect.ts)_
358358

359359
## `csdx plugins:install PLUGIN...`
360360

@@ -398,7 +398,7 @@ EXAMPLES
398398
$ csdx plugins:install someuser/someplugin
399399
```
400400

401-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/install.ts)_
401+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/install.ts)_
402402

403403
## `csdx plugins:link PLUGIN`
404404

@@ -428,7 +428,7 @@ EXAMPLES
428428
$ csdx plugins:link myplugin
429429
```
430430

431-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/link.ts)_
431+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/link.ts)_
432432

433433
## `csdx plugins:uninstall PLUGIN...`
434434

@@ -465,7 +465,7 @@ USAGE
465465
$ csdx plugins:reset
466466
```
467467

468-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/reset.ts)_
468+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/reset.ts)_
469469

470470
## `csdx plugins:uninstall PLUGIN...`
471471

@@ -493,7 +493,7 @@ EXAMPLES
493493
$ csdx plugins:uninstall myplugin
494494
```
495495

496-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/uninstall.ts)_
496+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/uninstall.ts)_
497497

498498
## `csdx plugins:uninstall PLUGIN...`
499499

@@ -537,5 +537,5 @@ DESCRIPTION
537537
Update installed plugins.
538538
```
539539

540-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/update.ts)_
540+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/update.ts)_
541541
<!-- commandsstop -->

packages/contentstack-audit/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/cli-audit",
3-
"version": "1.3.3",
3+
"version": "1.3.4",
44
"description": "Contentstack audit plugin",
55
"author": "Contentstack CLI",
66
"homepage": "https://github.com/contentstack/cli",
@@ -19,7 +19,7 @@
1919
],
2020
"dependencies": {
2121
"@contentstack/cli-command": "~1.2.16",
22-
"@contentstack/cli-utilities": "~1.5.10",
22+
"@contentstack/cli-utilities": "~1.5.11",
2323
"@oclif/plugin-help": "^5",
2424
"@oclif/plugin-plugins": "^4.1.9",
2525
"chalk": "^4.1.2",
@@ -34,6 +34,7 @@
3434
"@oclif/test": "^2.0.3",
3535
"@types/chai": "^4.3.5",
3636
"@types/fs-extra": "^11.0.2",
37+
"@types/mocha": "^10.0.6",
3738
"@types/node": "^20.3.1",
3839
"@types/uuid": "^9.0.4",
3940
"chai": "^4.3.7",
@@ -71,6 +72,7 @@
7172
"lint": "eslint . --ext .ts --config .eslintrc",
7273
"postpack": "shx rm -f oclif.manifest.json",
7374
"posttest": "npm run lint",
75+
"compile": "shx rm -rf lib && tsc -b",
7476
"prepack": "npm run build && oclif manifest && oclif readme",
7577
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
7678
"version": "oclif readme && git add README.md",
@@ -84,4 +86,4 @@
8486
"keywords": [
8587
"oclif"
8688
]
87-
}
89+
}

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,9 @@ export default class Entries {
488488
field as ReferenceFieldDataType,
489489
entry[uid] as EntryReferenceFieldDataType[],
490490
);
491+
if (!entry[uid]) {
492+
delete entry[uid];
493+
}
491494
break;
492495
case 'blocks':
493496
entry[uid] = this.fixModularBlocksReferences(
@@ -504,6 +507,7 @@ export default class Entries {
504507
) as EntryGroupFieldDataType;
505508
break;
506509
}
510+
507511
});
508512

509513
return entry;
@@ -546,12 +550,12 @@ export default class Entries {
546550
entry: EntryModularBlocksDataType[],
547551
) {
548552
entry = entry
549-
.map((block, index) => this.modularBlockRefCheck(tree, blocks, block, index))
553+
?.map((block, index) => this.modularBlockRefCheck(tree, blocks, block, index))
550554
.filter((val) => !isEmpty(val));
551555

552556
blocks.forEach((block) => {
553557
entry = entry
554-
.map((eBlock) => {
558+
?.map((eBlock) => {
555559
if (!isEmpty(block.schema)) {
556560
if (eBlock[block.uid]) {
557561
eBlock[block.uid] = this.runFixOnSchema(
@@ -666,9 +670,9 @@ export default class Entries {
666670
field: ReferenceFieldDataType | JsonRTEFieldDataType,
667671
entry: EntryReferenceFieldDataType[],
668672
) {
673+
669674
const missingRefs: Record<string, any>[] = [];
670-
entry = entry
671-
.map((reference) => {
675+
entry = entry?.map((reference) => {
672676
const { uid } = reference;
673677
const refExist = find(this.entryMetaData, { uid });
674678

@@ -678,8 +682,7 @@ export default class Entries {
678682
}
679683

680684
return reference;
681-
})
682-
.filter((val) => val) as EntryReferenceFieldDataType[];
685+
}).filter((val) => val) as EntryReferenceFieldDataType[];
683686

684687
if (!isEmpty(missingRefs)) {
685688
this.missingRefs[this.currentUid].push({

packages/contentstack-audit/test/unit/commands/fix.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ describe('AuditFix command', () => {
1212
} as FileTransportInstance;
1313

1414
describe('AuditFix run method', () => {
15-
fancy
15+
const test = fancy.loadConfig({ root: process.cwd() });
16+
test
1617
.stdout({ print: process.env.PRINT === 'true' || false })
1718
.stub(fs, 'rmSync', () => {})
1819
.stub(winston.transports, 'File', () => fsTransport)

packages/contentstack-audit/test/unit/commands/index.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import winston from 'winston';
2-
import { expect, test } from '@oclif/test';
2+
import { expect, test as fancy } from '@oclif/test';
33
import { FileTransportInstance } from 'winston/lib/winston/transports';
44

55
import { AuditBaseCommand } from '../../../src/audit-base-command';
@@ -10,6 +10,7 @@ describe('Audit command', () => {
1010
} as FileTransportInstance;
1111

1212
describe('Audit run method', () => {
13+
const test = fancy.loadConfig({ root: process.cwd() });
1314
test
1415
.stdout({ print: process.env.PRINT === 'true' || false })
1516
.stub(winston.transports, 'File', () => fsTransport)

packages/contentstack-auth/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"dependencies": {
2525
"@contentstack/cli-command": "~1.2.16",
26-
"@contentstack/cli-utilities": "~1.5.10",
26+
"@contentstack/cli-utilities": "~1.5.11",
2727
"chalk": "^4.0.0",
2828
"debug": "^4.1.1",
2929
"inquirer": "8.2.4",
@@ -96,4 +96,4 @@
9696
}
9797
},
9898
"repository": "contentstack/cli"
99-
}
99+
}

packages/contentstack-bootstrap/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@contentstack/cli-cm-seed": "~1.7.0",
2121
"@contentstack/cli-command": "~1.2.16",
22-
"@contentstack/cli-utilities": "~1.5.10",
22+
"@contentstack/cli-utilities": "~1.5.11",
2323
"inquirer": "8.2.4",
2424
"mkdirp": "^1.0.4",
2525
"tar": "^6.1.13"
@@ -73,4 +73,4 @@
7373
}
7474
},
7575
"repository": "contentstack/cli"
76-
}
76+
}

packages/contentstack-branches/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "@contentstack/cli-cm-branches",
33
"description": "Contentstack CLI plugin to do branches operations",
4-
"version": "1.0.21",
4+
"version": "1.0.22",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"dependencies": {
88
"@contentstack/cli-command": "~1.2.16",
9-
"@contentstack/cli-utilities": "~1.5.10",
9+
"@contentstack/cli-utilities": "~1.5.11",
1010
"@oclif/core": "^2.9.3",
1111
"async": "^3.2.4",
1212
"big-json": "^3.2.0",
@@ -26,7 +26,7 @@
2626
},
2727
"devDependencies": {
2828
"@contentstack/cli-auth": "~1.3.17",
29-
"@contentstack/cli-config": "~1.4.15",
29+
"@contentstack/cli-config": "~1.6.0",
3030
"@contentstack/cli-dev-dependencies": "~1.2.4",
3131
"@oclif/plugin-help": "^5.1.19",
3232
"@oclif/test": "^1.2.6",
@@ -95,4 +95,4 @@
9595
}
9696
},
9797
"repository": "https://github.com/contentstack/cli"
98-
}
98+
}

packages/contentstack-branches/src/utils/entry-create-script.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export function entryCreateScript(contentType) {
182182
text = JSON.stringify(_entry);
183183
}
184184
markdownRegEx = new RegExp(
185-
'(https://(assets|(eu-|azure-na-|azure-eu-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
185+
'(https://(assets|(eu-|azure-na-|azure-eu-|gcp-na-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
186186
'g',
187187
);
188188
while ((markdownMatch = markdownRegEx.exec(text)) !== null) {

0 commit comments

Comments
 (0)