Skip to content

Commit d03833c

Browse files
@contentstack/management dependency updated, code clean
1 parent 5bbe4b8 commit d03833c

File tree

4 files changed

+47
-36
lines changed

4 files changed

+47
-36
lines changed

README.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,65 +8,66 @@ Validate Fields with Regex Property of Content Type and Global Field in a Stack
88
[![License](https://img.shields.io/npm/l/cli-cm-regex-validate.svg)](https://github.com/contentstack/cli-cm-regex-validate/blob/master/package.json)
99

1010
<!-- toc -->
11-
12-
- [Usage](#usage)
13-
- [Commands](#commands)
11+
* [cli-cm-regex-validate](#cli-cm-regex-validate)
12+
* [Usage](#usage)
13+
* [Commands](#commands)
1414
<!-- tocstop -->
1515

1616
# Usage
1717

1818
<!-- usage -->
19-
2019
```sh-session
21-
$ npm install -g @contentstack/cli
22-
$ csdx plugins:install @contentstack/cli-cm-regex-validate
20+
$ npm install -g @contentstack/cli-cm-regex-validate
2321
$ csdx COMMAND
2422
running command...
25-
$ csdx (-v|--version|version)
26-
@contentstack/cli-cm-regex-validate/1.0.2 darwin-x64 node-v16.17.0
23+
$ csdx (--version)
24+
@contentstack/cli-cm-regex-validate/1.1.4 darwin-arm64 node-v16.19.0
2725
$ csdx --help [COMMAND]
2826
USAGE
2927
$ csdx COMMAND
3028
...
3129
```
32-
3330
<!-- usagestop -->
3431

3532
# Commands
3633

3734
<!-- commands -->
38-
39-
- [`csdx cm:stacks:validate-regex`](#csdx-cmstacksvalidate-regex)
35+
* [`csdx cm:stacks:validate-regex`](#csdx-cmstacksvalidate-regex)
4036

4137
## `csdx cm:stacks:validate-regex`
4238

4339
This command is used to find all the invalid regexes present in the content types and global fields of your stack.
4440

4541
```
4642
USAGE
47-
$ csdx cm:stacks:validate-regex
48-
49-
OPTIONS
50-
-a, --alias=alias Alias (name) assigned to the management token
51-
-c, --contentType To find invalid regexes within the content types
52-
53-
-f, --filePath=filePath [optional] The path or the location in your file system where the CSV output file should be
54-
stored.
43+
$ csdx cm:stacks:validate-regex [-h] [-a <value>] [-c] [-g] [-f <value>]
5544
56-
-g, --globalField To find invalid regexes within the global fields
45+
FLAGS
46+
-a, --alias=<value> Alias (name) assigned to the management token
47+
-c, --contentType To find invalid regexes within the content types
48+
-f, --filePath=<value> [optional] The path or the location in your file system where the CSV output file should be
49+
stored.
50+
-g, --globalField To find invalid regexes within the global fields
51+
-h, --help To show the flags that can be used with this CLI command
5752
58-
-h, --help To show the flags that can be used with this CLI command
53+
DESCRIPTION
54+
This command is used to find all the invalid regexes present in the content types and global fields of your stack.
5955
6056
EXAMPLES
6157
$ csdx cm:stacks:validate-regex
58+
6259
$ csdx cm:stacks:validate-regex -a <management_token_alias>
60+
6361
$ csdx cm:stacks:validate-regex -c
62+
6463
$ csdx cm:stacks:validate-regex -g
64+
6565
$ csdx cm:stacks:validate-regex -f <path/to/the/directory>
66+
6667
$ csdx cm:stacks:validate-regex -a <management_token_alias> -c -g
68+
6769
$ csdx cm:stacks:validate-regex -a <management_token_alias> -c -g -f <path/to/the/directory>
6870
```
6971

70-
_See code: [src/commands/cm/stacks/validate-regex.ts](https://github.com/contentstack/cli-cm-regex-validate/blob/v1.0.2/src/commands/cm/stacks/validate-regex.ts)_
71-
72+
_See code: [src/commands/cm/stacks/validate-regex.ts](https://github.com/contentstack/cli-cm-regex-validate/blob/v1.1.4/src/commands/cm/stacks/validate-regex.ts)_
7273
<!-- commandsstop -->

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"dependencies": {
6565
"@contentstack/cli-command": "^1.2.7",
6666
"@contentstack/cli-utilities": "^1.4.3",
67-
"@contentstack/management": "^1.2.4",
67+
"@contentstack/management": "^1.8.0",
6868
"cli-table3": "^0.6.0",
6969
"cli-ux": "^6.0.9",
7070
"inquirer": "^8.2.4",

src/utils/connect-stack.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1-
import * as contentstackSdk from '@contentstack/management'
2-
import {cli} from 'cli-ux'
3-
import processStack from './process-stack'
4-
const regexMessages = require('../../messages/index.json').validateRegex
1+
import { cli } from "cli-ux";
2+
import * as contentstackSdk from "@contentstack/management";
53

6-
export default async function connectStack(flags: any, host: string, tokenDetails: any) {
4+
import processStack from "./process-stack";
5+
const regexMessages = require("../../messages/index.json").validateRegex;
6+
7+
export default async function connectStack(
8+
flags: any,
9+
host: string,
10+
tokenDetails: any
11+
) {
712
try {
8-
const startTime = Date.now()
9-
cli.action.start(regexMessages.cliAction.connectStackStart, '', {stdout: true})
13+
const startTime = Date.now();
14+
cli.action.start(regexMessages.cliAction.connectStackStart, "", {
15+
stdout: true,
16+
});
1017
const client = contentstackSdk.client({
1118
host: host,
12-
})
13-
const stackInstance = await client.stack({api_key: tokenDetails.apiKey, management_token: tokenDetails.token})
14-
await processStack(flags, stackInstance, startTime)
19+
});
20+
const stackInstance = client.stack({
21+
api_key: tokenDetails.apiKey,
22+
management_token: tokenDetails.token,
23+
});
24+
await processStack(flags, stackInstance, startTime);
1525
} catch (error) {
16-
throw new Error(regexMessages.errors.stack.apiKey)
26+
throw new Error(regexMessages.errors.stack.apiKey);
1727
}
1828
}

0 commit comments

Comments
 (0)