Skip to content

Commit

Permalink
Added validation message and fixed PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sunil-lakshman committed Jul 8, 2024
1 parent d3d7d59 commit 8a2c0e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/contentstack-bootstrap/src/commands/cm/bootstrap.ts
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,10 +153,11 @@ export default class BootstrapCommand extends Command {
const yes = bootstrapCommandFlags.yes as string;

const appConfig: AppConfig = getAppLevelConfigByName(selectedAppName || selectedApp.configKey);
let master_locale = "en-us";
if( selectedApp.configKey == "compass-app" || selectedAppName == "Compass App"){
master_locale = "en";
}
// let master_locale = "en-us";
// if( selectedApp.configKey == "compass-app" || selectedAppName == "Compass App"){
// master_locale = "en";
// }
let master_locale = appConfig.master_locale || DEFAULT_MASTER_LOCALE;

let cloneDirectory =
(bootstrapCommandFlags.directory as string) || (bootstrapCommandFlags['project-dir'] as string);
Expand Down
1 change: 1 addition & 0 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
5 changes: 5 additions & 0 deletions packages/contentstack-seed/src/seed/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ export default class ContentModelSeeder {

async shouldProceed(api_key: string) {
let count;
const stack_details = await this.csClient.getStack(api_key);
if(this.options.master_locale != stack_details.master_locale){
cliux.print(`You will face some issues in bootstrap app due to change of Master locale.`);
return false;
}
count = await this.csClient.getContentTypeCount(api_key, this.managementToken);

if (count > 0 && this._options.skipStackConfirmation !== 'yes') {
Expand Down

0 comments on commit 8a2c0e2

Please sign in to comment.