Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/workflows/sca-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ jobs:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --all-projects --fail-on=all
json: true
continue-on-error: true
- uses: contentstack/sca-policy@main
1 change: 1 addition & 0 deletions packages/contentstack-auth/messages/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"CLI_AUTH_LOGOUT_DESCRIPTION": "User session logout",
"CLI_AUTH_LOGOUT_FLAG_FORCE": "Force logging out for skipping the confirmation",
"CLI_AUTH_LOGOUT_ALREADY": "You're already logged out",
"CLI_AUTH_LOGOUT_CANCELLED": "Log out cancelled",
"CLI_AUTH_LOGOUT_NO_AUTHORIZATIONS": "No authorizations found",
"CLI_AUTH_LOGOUT_NO_AUTHORIZATIONS_USER": "No authorizations found for current user",
"CLI_AUTH_WHOAMI_LOGGED_IN_AS": "You are currently logged in with email:",
Expand Down
5 changes: 4 additions & 1 deletion packages/contentstack-auth/src/commands/auth/logout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ export default class LogoutCommand extends BaseCommand<typeof LogoutCommand> {
confirm,
isAuthenticated: oauthHandler.isAuthenticated(),
});
log.success(messageHandler.parse('CLI_AUTH_LOGOUT_ALREADY'), this.contextDetails);
const messageKey = confirm === false && oauthHandler.isAuthenticated()
? 'CLI_AUTH_LOGOUT_CANCELLED'
: 'CLI_AUTH_LOGOUT_ALREADY';
log.success(messageHandler.parse(messageKey), this.contextDetails);
}
} catch (error) {
log.debug('Logout failed.', { ...this.contextDetails, error: error.message });
Expand Down
1 change: 1 addition & 0 deletions packages/contentstack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
],
"hooks": {
"prerun": [
"./lib/hooks/prerun/init-context-for-command",
"./lib/hooks/prerun/command-deprecation-check",
"./lib/hooks/prerun/default-rate-limit-check",
"./lib/hooks/prerun/latest-version-warning"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {
cliux,
messageHandler,
managementSDKInitiator,
marketplaceSDKInitiator,
} from '@contentstack/cli-utilities';
import { CsdxContext } from '../../utils';

/**
* When an invalid command is corrected (e.g. loginasda → login), init ran with the invalid
* command so context.messageFilePath was never set. Re-build context and re-init utilities
* for the actual command so i18n prompts show human-readable text.
*/
export default async function (opts: {
Command?: { id?: string };
config?: any;
}): Promise<void> {
const config = opts?.config ?? this.config;
const commandId = opts?.Command?.id;
if (!config?.context?.messageFilePath && commandId) {
config.context = new CsdxContext({ id: commandId }, config);
messageHandler.init(config.context);
cliux.init(config.context);
managementSDKInitiator.init(config.context);
marketplaceSDKInitiator.init(config.context);
}
}
Loading
Loading