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

DX | 08-08-2024 | Release #1507

Merged
merged 37 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3df87e3
fixed the SRE issues
cs-raj Jul 23, 2024
e3e34cb
feat: add flag to support variable types & respective prompt
aman19K Jul 29, 2024
23deef6
formatting & indentation
aman19K Jul 29, 2024
28bcc63
refactor: removed unused path library
aman19K Jul 29, 2024
bc513f2
Added script to update the enviornments and version bump
cs-raj Jul 29, 2024
bd29fd6
Merge pull request #1482 from contentstack/feat/DX-980
aman19K Jul 30, 2024
58e8d30
Updated management sdk version
cs-raj Jul 31, 2024
657f63b
refactor: launch create command ui text
aman19K Jul 31, 2024
a708746
Merge pull request #1486 from contentstack/fix/DX-1016-ui-text
aman19K Jul 31, 2024
40bf249
Merge branch 'development' into fix/DX-821
cs-raj Jul 31, 2024
366d7cc
Merge branch 'staging' into staging-to-development
cs-raj Jul 31, 2024
835c086
Merge pull request #1489 from contentstack/staging-to-development
cs-raj Jul 31, 2024
f91580d
Merge branch 'development' into fix/DX-821
cs-raj Jul 31, 2024
c82ea33
Merge pull request #1485 from contentstack/fix/DX-821
cs-raj Jul 31, 2024
6ba2351
Merge branch 'staging' into staging-to-dev
cs-raj Aug 2, 2024
d8ccbd2
Merge pull request #1494 from contentstack/staging-to-dev
cs-raj Aug 2, 2024
fd258cf
updated the version bumps
cs-raj Aug 2, 2024
f109e45
Merge pull request #1495 from contentstack/fix/dev
cs-raj Aug 2, 2024
727c3b5
Merge branch 'staging' into stage-to-dev
cs-raj Aug 2, 2024
98ef8e4
Merge pull request #1497 from contentstack/stage-to-dev
cs-raj Aug 2, 2024
630388e
Merge branch 'development' into fix/DX-996
cs-raj Aug 6, 2024
da72643
Merge pull request #1483 from contentstack/fix/DX-996
cs-raj Aug 6, 2024
77d5b12
Merge pull request #1503 from contentstack/main
cs-raj Aug 6, 2024
364106f
Merge branch 'staging' into stage-to-dev
cs-raj Aug 6, 2024
8859004
lock file update
cs-raj Aug 6, 2024
fdf6ffb
Merge pull request #1504 from contentstack/stage-to-dev
cs-raj Aug 6, 2024
36044ab
PR comments resolved
cs-raj Aug 6, 2024
2d0524f
Merge branch 'development' into fix/DX-888
cs-raj Aug 6, 2024
fc8e6c2
added else
cs-raj Aug 6, 2024
3069cdb
fixed setup-repo issue
cs-raj Aug 6, 2024
fb2617a
Compass app integration and removed error messages while importing a …
sunil-lakshman Aug 7, 2024
a5b13f1
Merge branch 'development' into fix/DX-888
cs-raj Aug 7, 2024
e655c53
Merge pull request #1474 from contentstack/fix/DX-888
cs-raj Aug 7, 2024
c3ccd5a
version bump for audit and import packages
cs-raj Aug 7, 2024
a112a1d
Merge pull request #1505 from contentstack/release/version-bump
cs-raj Aug 7, 2024
7855028
Merge pull request #1506 from contentstack/development
cs-raj Aug 7, 2024
26a1ea3
Changed repo name and owner name (#1509) (#1510)
sunil-lakshman Aug 9, 2024
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
695 changes: 94 additions & 601 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contentstack-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
$ csdx COMMAND
running command...
$ csdx (--version|-v)
@contentstack/cli-audit/1.6.4 darwin-arm64 node-v22.2.0
@contentstack/cli-audit/1.6.5 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
6 changes: 3 additions & 3 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.6.4",
"version": "1.6.5",
"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.19",
"@contentstack/cli-utilities": "~1.7.0",
"@contentstack/cli-utilities": "~1.7.1",
"@oclif/plugin-help": "^5",
"@oclif/plugin-plugins": "^5.0.0",
"chalk": "^4.1.2",
Expand Down Expand Up @@ -86,4 +86,4 @@
"keywords": [
"oclif"
]
}
}
13 changes: 4 additions & 9 deletions packages/contentstack-audit/src/messages/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import memoize from 'lodash/memoize';
import { escapeRegExp, validateRegex } from '@contentstack/cli-utilities';

const errors = {};

Expand Down Expand Up @@ -47,7 +46,7 @@ const auditFixMsg = {
AUDIT_FIX_CMD_DESCRIPTION: 'Perform audits and fix possible errors in the exported Contentstack data.',
WF_FIX_MSG: 'Successfully removed the workflow {uid} named {name}.',
ENTRY_MANDATORY_FIELD_FIX: `Removing the publish details from the entry with UID '{uid}' in Locale '{locale}'...`,
ENTRY_SELECT_FIELD_FIX: `Adding the value '{value}' in the select field of entry UID '{uid}'...`
ENTRY_SELECT_FIELD_FIX: `Adding the value '{value}' in the select field of entry UID '{uid}'...`,
};

const messages: typeof errors &
Expand Down Expand Up @@ -76,13 +75,9 @@ function $t(msg: string, args: Record<string, string>): string {
if (!msg) return '';

for (const key of Object.keys(args)) {
const escapedKey = escapeRegExp(key);
const escapedKeyRegex = new RegExp(`{${escapedKey}}`, 'g');
let { status } = validateRegex(escapedKeyRegex)
if (status === 'safe') {
const sanitizedValue = args[key] ? escapeRegExp(args[key]) : '';
msg = msg.replace(escapedKeyRegex, sanitizedValue || escapedKey);
}
const escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const placeholder = `{${escapedKey}}`;
msg = msg.split(placeholder).join(args[key]);
}

return msg;
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.19",
"@contentstack/cli-utilities": "~1.7.0",
"@contentstack/cli-utilities": "~1.7.1",
"chalk": "^4.0.0",
"debug": "^4.1.1",
"inquirer": "8.2.4",
Expand Down
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.9.4 darwin-arm64 node-v22.2.0
@contentstack/cli-cm-bootstrap/1.10.0 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
4 changes: 2 additions & 2 deletions 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.9.4",
"version": "1.10.0",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"scripts": {
Expand All @@ -19,7 +19,7 @@
"dependencies": {
"@contentstack/cli-cm-seed": "~1.7.6",
"@contentstack/cli-command": "~1.2.19",
"@contentstack/cli-utilities": "~1.7.0",
"@contentstack/cli-utilities": "~1.7.1",
"inquirer": "8.2.4",
"mkdirp": "^1.0.4",
"tar": "^6.2.1 "
Expand Down
6 changes: 5 additions & 1 deletion packages/contentstack-bootstrap/src/bootstrap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface BootstrapOptions {
accessToken?: string;
appType: string;
livePreviewEnabled?: boolean;
master_locale: any;
}

export interface SeedParams {
Expand Down Expand Up @@ -97,6 +98,9 @@ export default class Bootstrap {
if (this.options.seedParams.managementTokenAlias) {
cmd.push('--alias', this.options.seedParams.managementTokenAlias);
}
if (this.options.master_locale) {
cmd.push('--locale', this.options.master_locale);
}

const result = await ContentStackSeed.run(cmd);
if (result && result.api_key) {
Expand Down Expand Up @@ -127,4 +131,4 @@ export default class Bootstrap {
cliux.error(messageHandler.parse('CLI_BOOTSTRAP_STACK_CREATION_FAILED', this.appConfig.stack));
}
}
}
}
59 changes: 53 additions & 6 deletions packages/contentstack-bootstrap/src/bootstrap/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface EnviornmentVariables {
* Create delivery token
* Create enviroment
*/

let managementTokenResult: any;
export const setupEnvironments = async (
managementAPIClient: any,
api_key: string,
Expand All @@ -34,6 +34,51 @@ export const setupEnvironments = async (
.environment()
.query()
.find();

//create management token if not present
if(!managementToken){
const managementBody = {
"token":{
"name":"sample app",
"description":"This is a sample management token.",
"scope":[
{
"module":"content_type",
"acl":{
"read":true,
"write":true
}
},
{
"module":"branch",
"branches":[
"main"
],
"acl":{
"read":true
}
}
],
"expires_on": "3000-01-01",
"is_email_notification_enabled":false
}
}
managementTokenResult = await managementAPIClient
.stack({ api_key: api_key })
.managementToken()
.create(managementBody);
if(!managementTokenResult.uid){
cliux.print(
`Info: Failed to generate a management token.\nNote: Management token is not available in your plan. Please contact the admin for support.`,
{
color: 'yellow',
},
);
if ((await continueBootstrapCommand()) === 'no') {
return;
}
}
}
if (Array.isArray(environmentResult.items) && environmentResult.items.length > 0) {
for (const environment of environmentResult.items) {
if (environment.name) {
Expand Down Expand Up @@ -144,6 +189,7 @@ const envFileHandler = async (
const managementAPIHost = region?.cma?.substring('8');
const regionName = region && region.name && region.name.toLowerCase();
previewHost = region?.uiHost?.substring(8)?.replace('app', 'rest-preview');
const cdnHost = region?.cda?.substring('8');
appHost = region?.uiHost?.substring(8);
const isUSRegion = regionName === 'us' || regionName === 'na';
if (regionName !== 'eu' && !isUSRegion) {
Expand Down Expand Up @@ -194,19 +240,20 @@ const envFileHandler = async (
filePath = pathValidator(path.join(sanitizePath(clonedDirectory), sanitizePath(fileName)));
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${
environmentVariables.deliveryToken
}\n${
}\nCONTENTSTACK_BRANCH=main${
livePreviewEnabled
? `\nCONTENTSTACK_PREVIEW_TOKEN=${
environmentVariables.preview_token || `''`
}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\nCONTENTSTACK_APP_HOST=${appHost}\n`
}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\n`
: '\n'
}CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\nCONTENTSTACK_API_HOST=${
}CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${
!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''
}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}\nCONTENTSTACK_LIVE_EDIT_TAGS=false\nCONTENTSTACK_API_HOST=${
customHost ? customHost : managementAPIHost
}${
!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''
}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}\nCONTENTSTACK_LIVE_EDIT_TAGS=false`;
}\nCONTENTSTACK_APP_HOST=${appHost}\nCONTENTSTACK_MANAGEMENT_TOKEN=${managementTokenResult.uid}\nCONTENTSTACK_HOST=${cdnHost}`;
result = await writeEnvFile(content, filePath);
break;
case 'gatsby':
case 'gatsby-starter':
fileName = `.env.${environmentVariables.environment}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import config, { getAppLevelConfigByName, AppConfig } from '../../config';
import messageHandler from '../../messages';

export const DEFAULT_MASTER_LOCALE = 'en-us';
export default class BootstrapCommand extends Command {
private bootstrapManagementAPIClient: any;

Expand Down Expand Up @@ -152,6 +153,8 @@ export default class BootstrapCommand extends Command {
const yes = bootstrapCommandFlags.yes as string;

const appConfig: AppConfig = getAppLevelConfigByName(selectedAppName || selectedApp.configKey);

let master_locale = appConfig.master_locale || DEFAULT_MASTER_LOCALE;

let cloneDirectory =
(bootstrapCommandFlags.directory as string) || (bootstrapCommandFlags['project-dir'] as string);
Expand Down Expand Up @@ -187,11 +190,12 @@ export default class BootstrapCommand extends Command {
region: this.region,
appType,
livePreviewEnabled,
master_locale,
};
const bootstrap = new Bootstrap(options);
await bootstrap.run();
} catch (error: any) {
this.error(error, { exit: 1, suggestions: error.suggestions });
}
}
}
}
8 changes: 5 additions & 3 deletions packages/contentstack-bootstrap/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface AppConfig {
private?: boolean;
branch?: string;
appConfigKey?: string;
master_locale?: string;
}

const config: Configuration = {
Expand Down Expand Up @@ -49,8 +50,9 @@ const config: Configuration = {
stack: 'contentstack/stack-contentstack-angular-modularblock-example',
},
'compass-app': {
source: 'SunilLsagar/universal-demo',
stack: 'SunilLsagar/stack-universal-demo',
source: 'contentstack/contentstack-universal-demo',
stack: 'contentstack/stack-contentstack-universal-demo',
master_locale: 'en',
},
'nuxtjs-disabled': {
source: 'contentstack/contentstack-nuxtjs-vue-universal-demo',
Expand Down Expand Up @@ -98,4 +100,4 @@ export function getAppLevelConfigByName(appConfigKey: string): any {
}
config.appLevelConfig[appConfigKey].appConfigKey = appConfigKey;
return config.appLevelConfig[appConfigKey];
}
}
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.19",
"@contentstack/cli-utilities": "~1.7.0",
"@contentstack/cli-utilities": "~1.7.1",
"@oclif/core": "^3.26.5",
"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.19",
"@contentstack/cli-utilities": "~1.7.0",
"@contentstack/cli-utilities": "~1.7.1",
"bluebird": "^3.7.2",
"chalk": "^4.1.2",
"dotenv": "^16.1.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"dependencies": {
"@colors/colors": "^1.5.0",
"@contentstack/cli-cm-export": "~1.11.6",
"@contentstack/cli-cm-import": "~1.16.4",
"@contentstack/cli-cm-import": "~1.16.5",
"@contentstack/cli-command": "~1.2.19",
"@contentstack/cli-utilities": "~1.7.0",
"@contentstack/cli-utilities": "~1.7.1",
"async": "^3.2.4",
"chalk": "^4.1.0",
"child_process": "^1.0.2",
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.7.0",
"@contentstack/cli-utilities": "~1.7.1",
"contentstack": "^3.10.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"dependencies": {
"@contentstack/cli-command": "~1.2.19",
"@contentstack/cli-utilities": "~1.7.0",
"@contentstack/cli-utilities": "~1.7.1",
"chalk": "^4.0.0",
"debug": "^4.1.1",
"inquirer": "8.2.4",
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.19",
"@contentstack/cli-utilities": "~1.7.0",
"@contentstack/cli-utilities": "~1.7.1",
"chalk": "^4.1.0",
"fast-csv": "^4.3.6",
"inquirer": "8.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.2.19",
"@contentstack/cli-utilities": "~1.7.0",
"@contentstack/cli-utilities": "~1.7.1",
"@oclif/core": "^3.26.5",
"async": "^3.2.4",
"big-json": "^3.2.0",
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.16.4 darwin-arm64 node-v22.2.0
@contentstack/cli-cm-import/1.16.5 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
8 changes: 4 additions & 4 deletions packages/contentstack-import/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@contentstack/cli-cm-import",
"description": "Contentstack CLI plugin to import content into stack",
"version": "1.16.4",
"version": "1.16.5",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-audit": "~1.6.3",
"@contentstack/cli-audit": "~1.6.5",
"@contentstack/cli-command": "~1.2.19",
"@contentstack/cli-utilities": "~1.7.0",
"@contentstack/management": "~1.15.3",
"@contentstack/cli-utilities": "~1.7.1",
"@contentstack/management": "~1.17.0",
"@oclif/core": "^3.26.5",
"big-json": "^3.2.0",
"bluebird": "^3.7.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class ImportCustomRoles extends BaseClass {
this.customRoles = fsUtil.readFile(join(this.customRolesFolderPath, this.customRolesConfig.fileName),true) as Record<string, unknown>;
this.customRolesLocales = fsUtil.readFile(join(this.customRolesFolderPath, this.customRolesConfig.customRolesLocalesFileName),true) as Record<string, unknown>;
} else {
log(this.importConfig, `No such file or directory - '${this.customRolesFolderPath}'`, 'error');
log(this.importConfig, `No custom-rules are found - '${this.customRolesFolderPath}'`, 'info');
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class ImportEnvironments extends BaseClass {
unknown
>;
} else {
log(this.importConfig, `No such file or directory - '${this.environmentsFolderPath}'`, 'error');
log(this.importConfig, `No Environments Found - '${this.environmentsFolderPath}'`, 'info');
return;
}

Expand Down
Loading
Loading