Skip to content

Commit

Permalink
Merge pull request #1618 from contentstack/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
cs-raj authored Oct 17, 2024
2 parents 640e1a0 + 29a4794 commit 59f262c
Show file tree
Hide file tree
Showing 40 changed files with 949 additions and 226 deletions.
62 changes: 31 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions packages/contentstack-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ EXAMPLES
$ csdx plugins
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/index.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.14/src/commands/plugins/index.ts)_

## `csdx plugins:add PLUGIN`

Expand Down Expand Up @@ -343,7 +343,7 @@ EXAMPLES
$ csdx plugins:inspect myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/inspect.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.14/src/commands/plugins/inspect.ts)_

## `csdx plugins:install PLUGIN`

Expand Down Expand Up @@ -392,7 +392,7 @@ EXAMPLES
$ csdx plugins:install someuser/someplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/install.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.14/src/commands/plugins/install.ts)_

## `csdx plugins:link PATH`

Expand All @@ -412,6 +412,7 @@ FLAGS
DESCRIPTION
Links a plugin into the CLI for development.
Installation of a linked plugin will override a user-installed or core plugin.
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
Expand All @@ -422,7 +423,7 @@ EXAMPLES
$ csdx plugins:link myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/link.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.14/src/commands/plugins/link.ts)_

## `csdx plugins:remove [PLUGIN]`

Expand Down Expand Up @@ -463,7 +464,7 @@ FLAGS
--reinstall Reinstall all plugins after uninstalling.
```

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

## `csdx plugins:uninstall [PLUGIN]`

Expand Down Expand Up @@ -491,7 +492,7 @@ EXAMPLES
$ csdx plugins:uninstall myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/uninstall.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.14/src/commands/plugins/uninstall.ts)_

## `csdx plugins:unlink [PLUGIN]`

Expand Down Expand Up @@ -535,5 +536,5 @@ DESCRIPTION
Update installed plugins.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.14/src/commands/plugins/update.ts)_
<!-- commandsstop -->
3 changes: 3 additions & 0 deletions packages/contentstack-auth/src/commands/auth/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export default class LoginCommand extends BaseCommand<typeof LoginCommand> {
}
} catch (error) {
let errorMessage = formatError(error) || 'Something went wrong while logging. Please try again.';
if (typeof errorMessage === 'object' && Object.keys(errorMessage)?.length === 0) {
console.log(error);
}
this.logger.error('login failed', errorMessage);
cliux.error('CLI_AUTH_LOGIN_FAILED');
cliux.error(errorMessage);
Expand Down
20 changes: 12 additions & 8 deletions packages/contentstack-auth/test/integration/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('contentstack-auth plugin test', () => {

describe('Check auth:login command with wrong credentials', () => {
test
.loadConfig({ root: process.cwd() })
// @ts-ignore
.stub(CliUx, 'inquire', async (inquire) => {
switch (inquire.name) {
Expand All @@ -34,24 +35,27 @@ describe('contentstack-auth plugin test', () => {
return 'WrongPassword@12345%$#@!'; // NOTE forcing wrong password
}
})
.stub(process,'exit',()=>{})
.stdout({ print: PRINT_LOGS || false })
.command(['auth:login'])
.it('Login should fail due to wrong credentials.!', (ctx) => {
expect(ctx.stdout).to.a('string').includes('Login Error\nLooks like your email or password is invalid');
expect(ctx.stdout).to.be.includes('Login Error\nLooks like your email or password is invalid. Please try again or reset your password.');
});
});

describe('Check auth:login command with --username, --password flags and wrong credentials', () => {
test
test.loadConfig({ root: process.cwd() })
.stdout({ print: PRINT_LOGS || false })
.stub(process,'exit',()=>{})
.command(['auth:login', `--username=${username}`, '--password=WrongPassword@12345%$#@!'])
.it('Login should fail due to wrong credentials.!', (ctx) => {
expect(ctx.stdout).to.a('string').includes('Login Error\nLooks like your email or password is invalid');
expect(ctx.stdout).to.a('string').includes('Login Error\nLooks like your email or password is invalid. Please try again or reset your password.');
});
});

//NOTE
describe('Check auth:login command with correct credentials.', () => {
test
test.loadConfig({ root: process.cwd() })
// @ts-ignore
.stub(CliUx, 'inquire', async (inquire) => {
switch (inquire.name) {
Expand All @@ -69,17 +73,17 @@ describe('contentstack-auth plugin test', () => {
});

describe('Check auth:logout command', () => {
test
test.loadConfig({ root: process.cwd() })
.stub(CliUx, 'inquire', async () => 'Yes')
.stdout({ print: PRINT_LOGS || false })
.command(['auth:logout'])
.command(['auth:logout','--yes'])
.it('Logout should succeed.!', (ctx) => {
expect(ctx.stdout).to.a('string').includes('Successfully logged out');
});
});

describe('Check auth:login command with --username, --password flags', () => {
test
test.loadConfig({ root: process.cwd() })
.stdout({ print: PRINT_LOGS || false })
.command(['auth:login', `-u=${username}`, `-p=${password}`])
.it('Login should succeed!', (ctx) => {
Expand All @@ -95,7 +99,7 @@ describe('contentstack-auth plugin test', () => {
after(() => {
mail = '';
});
test
test.loadConfig({ root: process.cwd() })
.stdout({ print: PRINT_LOGS || false })
.command(['whoami'])
.it('shows user email who logged in', (ctx) => {
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.1.4 darwin-arm64 node-v22.2.0
@contentstack/cli-cm-branches/1.2.0 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
4 changes: 2 additions & 2 deletions 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.1.4",
"version": "1.2.0",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand All @@ -26,7 +26,7 @@
},
"devDependencies": {
"@contentstack/cli-auth": "~1.3.22",
"@contentstack/cli-config": "~1.7.3",
"@contentstack/cli-config": "~1.8.0",
"@contentstack/cli-dev-dependencies": "~1.2.4",
"@oclif/plugin-help": "^5.1.19",
"@oclif/test": "^2.5.6",
Expand Down
Loading

0 comments on commit 59f262c

Please sign in to comment.