Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/hotfix cs 42696 #1204

Merged
merged 25 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bf3b4e9
fix html rte
Aug 9, 2023
c0e0d1b
merged latest
Aug 9, 2023
96ee8c3
merged latest
shafeeqd959 Dec 6, 2023
0a30a1e
bumped version
shafeeqd959 Dec 4, 2023
bdae538
Merge pull request #1187 from contentstack/fix/CS-42696
shafeeqd959 Nov 29, 2023
b40b691
updated lock and readme files
shafeeqd959 Dec 6, 2023
fbd4f80
fixed ts config import
shafeeqd959 Dec 6, 2023
c576130
bumped oclif plugins dependency to 4.1.9 to fix vulnerabilities repor…
shafeeqd959 Dec 6, 2023
18f86cd
bumped cli version
shafeeqd959 Dec 7, 2023
140a8b4
Fix: Entry import fails if JSON RTE has a reference inside the table,…
antonyagustine Dec 7, 2023
c938306
fix: vulnerabilities fix
antonyagustine Dec 7, 2023
5c8e873
Fix: Extension code change reverted
antonyagustine Dec 7, 2023
8927c31
Fix: Replace reference issue related fix
antonyagustine Dec 7, 2023
19bd303
Fix: Reference mapper fixes on json rte
antonyagustine Dec 7, 2023
ba58d56
Fix: Missing uid mapper added
antonyagustine Dec 8, 2023
cb2d340
Code clean
antonyagustine Dec 8, 2023
f77f81c
Code clean
antonyagustine Dec 8, 2023
0280b1a
Fix: Cannot read properties of undefined (reading 'type')
antonyagustine Dec 8, 2023
b89afb9
fix: handle entry deleted from compare branch condition
aman19K Dec 8, 2023
0c81f89
Version bump
antonyagustine Dec 8, 2023
2b68c03
Merge branch 'release/hotfix-CS-42696' into fix/CS-42996
antonyagustine Dec 8, 2023
13e63d2
Doc: Readme updated
antonyagustine Dec 8, 2023
719e397
Merge pull request #1205 from contentstack/fix/CS-42996
antonyagustine Dec 8, 2023
dfd4edd
Merge branch 'release/hotfix-CS-42696' into fix/CS-42677
aman19K Dec 8, 2023
8d7cd4c
Merge pull request #1206 from contentstack/fix/CS-42677
aman19K Dec 8, 2023
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
2,016 changes: 913 additions & 1,103 deletions package-lock.json

Large diffs are not rendered by default.

54 changes: 42 additions & 12 deletions packages/contentstack-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ USAGE
* [`csdx plugins:install PLUGIN...`](#csdx-pluginsinstall-plugin-1)
* [`csdx plugins:link PLUGIN`](#csdx-pluginslink-plugin)
* [`csdx plugins:uninstall PLUGIN...`](#csdx-pluginsuninstall-plugin)
* [`csdx plugins:reset`](#csdx-pluginsreset)
* [`csdx plugins:uninstall PLUGIN...`](#csdx-pluginsuninstall-plugin-1)
* [`csdx plugins:uninstall PLUGIN...`](#csdx-pluginsuninstall-plugin-2)
* [`csdx plugins:update`](#csdx-pluginsupdate)
Expand Down Expand Up @@ -284,7 +285,7 @@ EXAMPLES
$ csdx plugins
```

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

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

Expand All @@ -300,7 +301,11 @@ ARGUMENTS
FLAGS
-f, --force Run yarn install with force flag.
-h, --help Show CLI help.
-v, --verbose
-s, --silent Silences yarn output.
-v, --verbose Show verbose yarn output.

GLOBAL FLAGS
--json Format output as json.

DESCRIPTION
Installs a plugin into the CLI.
Expand All @@ -317,11 +322,11 @@ ALIASES
$ csdx plugins:add

EXAMPLES
$ csdx plugins:install myplugin
$ csdx plugins:add myplugin

$ csdx plugins:install https://github.com/someuser/someplugin
$ csdx plugins:add https://github.com/someuser/someplugin

$ csdx plugins:install someuser/someplugin
$ csdx plugins:add someuser/someplugin
```

## `csdx plugins:inspect PLUGIN...`
Expand Down Expand Up @@ -349,7 +354,7 @@ EXAMPLES
$ csdx plugins:inspect myplugin
```

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

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

Expand All @@ -365,7 +370,11 @@ ARGUMENTS
FLAGS
-f, --force Run yarn install with force flag.
-h, --help Show CLI help.
-v, --verbose
-s, --silent Silences yarn output.
-v, --verbose Show verbose yarn output.

GLOBAL FLAGS
--json Format output as json.

DESCRIPTION
Installs a plugin into the CLI.
Expand All @@ -389,7 +398,7 @@ EXAMPLES
$ csdx plugins:install someuser/someplugin
```

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

## `csdx plugins:link PLUGIN`

Expand All @@ -403,8 +412,9 @@ ARGUMENTS
PATH [default: .] path to plugin

FLAGS
-h, --help Show CLI help.
-h, --help Show CLI help.
-v, --verbose
--[no-]install Install dependencies after linking the plugin.

DESCRIPTION
Links a plugin into the CLI for development.
Expand All @@ -418,7 +428,7 @@ EXAMPLES
$ csdx plugins:link myplugin
```

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

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

Expand All @@ -441,8 +451,22 @@ DESCRIPTION
ALIASES
$ csdx plugins:unlink
$ csdx plugins:remove

EXAMPLES
$ csdx plugins:remove myplugin
```

## `csdx plugins:reset`

Remove all user-installed and linked plugins.

```
USAGE
$ csdx plugins:reset
```

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

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

Removes a plugin from the CLI.
Expand All @@ -464,9 +488,12 @@ DESCRIPTION
ALIASES
$ csdx plugins:unlink
$ csdx plugins:remove

EXAMPLES
$ csdx plugins:uninstall myplugin
```

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

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

Expand All @@ -489,6 +516,9 @@ DESCRIPTION
ALIASES
$ csdx plugins:unlink
$ csdx plugins:remove

EXAMPLES
$ csdx plugins:unlink myplugin
```

## `csdx plugins:update`
Expand All @@ -507,5 +537,5 @@ DESCRIPTION
Update installed plugins.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.8.4/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/update.ts)_
<!-- commandsstop -->
4 changes: 2 additions & 2 deletions packages/contentstack-audit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.8",
"@oclif/plugin-help": "^5",
"@oclif/plugin-plugins": "^3.8.4",
"@oclif/plugin-plugins": "^4.1.9",
"chalk": "^4.1.2",
"fast-csv": "^4.3.6",
"fs-extra": "^11.1.1",
Expand Down Expand Up @@ -84,4 +84,4 @@
"keywords": [
"oclif"
]
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-bootstrap/1.7.0 darwin-arm64 node-v20.8.0
@contentstack/cli-cm-bootstrap/1.7.1 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-bootstrap",
"description": "Bootstrap contentstack apps",
"version": "1.7.0",
"version": "1.7.1",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"scripts": {
Expand Down
10 changes: 10 additions & 0 deletions packages/contentstack-bootstrap/src/bootstrap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ export default class Bootstrap {
} else {
throw new Error(messageHandler.parse('CLI_BOOTSTRAP_NO_API_KEY_FOUND'));
}

if (this.options.livePreviewEnabled) {
cliux.print(
'Important: set management token and app host in the environment file before running the application',
{
color: 'yellow',
},
);
}

cliux.print(messageHandler.parse('CLI_BOOTSTRAP_SUCCESS'));
} catch (error) {
cliux.error(messageHandler.parse('CLI_BOOTSTRAP_STACK_CREATION_FAILED', this.appConfig.stack));
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-bootstrap/src/bootstrap/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ const envFileHandler = async (
filePath = path.join(clonedDirectory, fileName);
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${
environmentVariables.deliveryToken
}\nCONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${
customHost ? '\nCONTENTSTACK_API_HOST=' + customHost : ''
}\nCONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\nCONTENTSTACK_API_HOST=${
customHost ? customHost : managementAPIHost
}${
!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''
}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}`;
}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}\nCONTENTSTACK_MANAGEMENT_TOKEN=''\nCONTENTSTACK_APP_HOST=''\nCONTENTSTACK_LIVE_EDIT_TAGS=false`;
result = await writeEnvFile(content, filePath);
break;
case 'gatsby':
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-branches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $ npm install -g @contentstack/cli-cm-branches
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-branches/1.0.18 darwin-arm64 node-v20.8.0
@contentstack/cli-cm-branches/1.0.19 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-branches/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-branches",
"description": "Contentstack CLI plugin to do branches operations",
"version": "1.0.18",
"version": "1.0.19",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down
18 changes: 10 additions & 8 deletions packages/contentstack-branches/src/utils/entry-create-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,15 +475,17 @@ export function entryCreateScript(contentType) {
try {
compareFilteredProperties.length !== 0 &&
compareFilteredProperties.forEach(async (entryDetails) => {
entryDetails = updateAssetDetailsInEntries(entryDetails);
let createdEntry = await stackSDKInstance.contentType('${contentType}').entry().create({ entry: entryDetails }).catch(error => {
throw error;
});
if(createdEntry){
if (flag.references) {
await updateReferences(entryDetails, createdEntry, references);
if(entryDetails !== undefined){
entryDetails = updateAssetDetailsInEntries(entryDetails);
let createdEntry = await stackSDKInstance.contentType('${contentType}').entry().create({ entry: entryDetails }).catch(error => {
throw error;
});
if(createdEntry){
if (flag.references) {
await updateReferences(entryDetails, createdEntry, references);
}
await updateEntry(createdEntry, entryDetails);
}
await updateEntry(createdEntry, entryDetails);
}
});
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,56 +494,70 @@ export function entryCreateUpdateScript(contentType) {
}

try {
if (contentType.options.singleton) {
compareBranchEntries.items.map(async (el) => {
if (contentType?.options?.singleton) {
compareBranchEntries?.items?.map(async (el) => {
let entryDetails = deleteUnwantedKeysFromObject(el, keysToRemove);
entryDetails = updateAssetDetailsInEntries(entryDetails);

if (baseBranchEntries && baseBranchEntries.items.length) {
let baseEntryUid = baseBranchEntries.items[0].uid;
let entry = await stackSDKInstance.contentType('${contentType}').entry(baseEntryUid);
if(entryDetails !== undefined){
entryDetails = updateAssetDetailsInEntries(entryDetails);

if (baseBranchEntries && baseBranchEntries.items.length) {
let baseEntryUid = baseBranchEntries.items[0].uid;
let entry = await stackSDKInstance.contentType('${contentType}').entry(baseEntryUid);

if (flag.references) {
await updateReferences(entryDetails, baseBranchEntries.items[0], references);
}

await updateEntry(entry, entryDetails);
} else {
let createdEntry = await stackSDKInstance.contentType('${contentType}').entry().create({ entry: entryDetails });

if (flag.references) {
await updateReferences(entryDetails, baseBranchEntries.items[0], references);
}

await updateEntry(entry, entryDetails);
} else {
let createdEntry = await stackSDKInstance.contentType('${contentType}').entry().create({ entry: entryDetails });

if (flag.references) {
await updateReferences(entryDetails, createdEntry, references);
if (flag.references) {
await updateReferences(entryDetails, createdEntry, references);
}

await updateEntry(createdEntry, entryDetails);
}

await updateEntry(createdEntry, entryDetails);
}
});
} else {
let compareMap = new Map(converter(compareBranchEntries.items));
let baseMap = new Map(converter(baseBranchEntries.items));


//NOTE: Filter distinct entries from the base and compare branches according to their titles.
//TODO: Need to discuss this approach and replace it with uid condition
let arr = uniquelyConcatenateArrays(Array.from(compareMap.keys()), Array.from(baseMap.keys()));

arr.map(async (el) => {
let entryDetails = deleteUnwantedKeysFromObject(compareMap.get(el), keysToRemove);
entryDetails = updateAssetDetailsInEntries(entryDetails);
if (compareMap.get(el) && !baseMap.get(el)) {
let createdEntry = await stackSDKInstance.contentType('${contentType}').entry().create({ entry: entryDetails });

if (flag.references) {
await updateReferences(entryDetails, createdEntry, references);
}
//NOTE: In the compare branch, entry must exist. Condition of deleted entry not handled
if(entryDetails !== undefined){
entryDetails = updateAssetDetailsInEntries(entryDetails);
if (compareMap.get(el) && !baseMap.get(el)) {
let createdEntry = await stackSDKInstance
.contentType('${contentType}')
.entry()
.create({ entry: entryDetails })
.catch(err => {
(err?.errorMessage || err?.message) ? err?.errorMessage || err?.message : 'Something went wrong!'
})

if(createdEntry){
if (flag.references) {
await updateReferences(entryDetails, createdEntry, references);
}
await updateEntry(createdEntry, entryDetails);
}
} else if (compareMap.get(el) && baseMap.get(el)) {
let baseEntry = baseMap.get(el);
let entry = await stackSDKInstance.contentType('${contentType}').entry(baseEntry.uid);

if (flag.references) {
await updateReferences(entryDetails, baseEntry, references);
}

await updateEntry(createdEntry, entryDetails);
} else if (compareMap.get(el) && baseMap.get(el)) {
let baseEntry = baseMap.get(el);
let entry = await stackSDKInstance.contentType('${contentType}').entry(baseEntry.uid);

if (flag.references) {
await updateReferences(entryDetails, baseEntry, references);
await updateEntry(entry, entryDetails);
}

await updateEntry(entry, entryDetails);
}
});
}
Expand Down
Loading
Loading