-
Notifications
You must be signed in to change notification settings - Fork 16
Fixed seed command issue when selecting the existing stack #2009
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
Draft
sunil-lakshman
wants to merge
13
commits into
development
Choose a base branch
from
fix/dx-2967
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7541c60
Fixed seed command issue when selecting the existing stack
sunil-lakshman faf2ed5
Added talisman file
sunil-lakshman 353cb3e
Fixed PR comments, Raised by copilot
sunil-lakshman 3e47303
Fixed PR comments
sunil-lakshman 385a32e
Fixed Merge Conflits
sunil-lakshman 992d062
Fixed PR comments
sunil-lakshman ca03a0f
Fixed PR comments
sunil-lakshman 6c80505
Merge branch 'development' into fix/dx-2967
sunil-lakshman 7ab32fb
Added unit testcases for contentstack seed plugin
sunil-lakshman b95500f
Fixed Merge Conflits
sunil-lakshman b73f49d
Fixed PR comments
sunil-lakshman 4817b46
Fixed Merge conflits
sunil-lakshman eb9833f
Merge pull request #2012 from contentstack/task/dx-3023
sunil-lakshman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { cliux } from '@contentstack/cli-utilities'; | ||
import ContentstackClient from '../seed/contentstack/client'; | ||
sunil-lakshman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
export const COMPASS_REPO = 'compass-starter-stack'; | ||
export const ENGLISH_LOCALE = 'en-us'; | ||
|
||
const compassScopes = { | ||
"name":"This is a compass app management token", | ||
"description":"This is a compass app management token.", | ||
"scope":[ | ||
{ | ||
"module":"content_type", | ||
"acl":{ | ||
"read":true, | ||
"write":true | ||
} | ||
}, | ||
{ | ||
"module":"branch", | ||
"branches":[ | ||
"main" | ||
], | ||
"acl":{ | ||
"read":true | ||
} | ||
} | ||
], | ||
"expires_on": "3000-01-01", | ||
sunil-lakshman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"is_email_notification_enabled":false | ||
}; | ||
|
||
interface CompassCheckParams { | ||
csClient: ContentstackClient; | ||
api_key: string; | ||
managementToken?: string; | ||
masterLocale?: string; | ||
} | ||
|
||
export async function shouldProceedForCompassApp({ | ||
csClient, | ||
api_key, | ||
managementToken, | ||
masterLocale, | ||
}: CompassCheckParams): Promise<boolean> { | ||
const stackDetails = await csClient.getStack(api_key); | ||
|
||
if (!stackDetails) { | ||
cliux.error('Failed to fetch stack details.'); | ||
return false; | ||
} | ||
|
||
if (masterLocale !== stackDetails.master_locale) { | ||
cliux.print( | ||
`Compass app requires the master locale to be set to English (en-us).`, | ||
sunil-lakshman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
{ | ||
color: 'yellow', | ||
bold: true, | ||
}, | ||
); | ||
return false; | ||
} | ||
|
||
const result = await csClient.createManagementToken(api_key, managementToken, compassScopes); | ||
|
||
if (result?.response_code === '161' || result?.response_code === '401') { | ||
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: 'red', | ||
}, | ||
); | ||
return false; | ||
} | ||
|
||
return true; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.