Skip to content

Commit 49cd943

Browse files
authored
Merge pull request #9 from Contentstack-Solutions/feat/CS-35686
CLI | contentstack-cli-content-type plugin required code update
2 parents 4a45da8 + 98e7f4a commit 49cd943

File tree

30 files changed

+22274
-12538
lines changed

30 files changed

+22274
-12538
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/lib

.eslintrc

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,51 @@
11
{
2-
"extends": [
3-
"oclif",
4-
"oclif-typescript"
5-
],
6-
"rules": {
2+
"extends": [
3+
// "oclif",
4+
"oclif-typescript",
5+
"plugin:@typescript-eslint/recommended"
6+
],
7+
"rules": {
8+
"@typescript-eslint/no-unused-vars": [
9+
"error",
10+
{
11+
"args": "none"
12+
}
13+
],
14+
"@typescript-eslint/prefer-namespace-keyword": "error",
15+
"@typescript-eslint/quotes": [
16+
"error",
17+
"single",
18+
{
19+
"avoidEscape": true,
20+
"allowTemplateLiterals": true
21+
}
22+
],
23+
"semi": "off",
24+
"@typescript-eslint/type-annotation-spacing": "error",
25+
"@typescript-eslint/no-redeclare": "off",
26+
"eqeqeq": [
27+
"error",
28+
"smart"
29+
],
30+
"id-match": "error",
31+
"no-eval": "error",
32+
"no-var": "error",
33+
"quotes": "off",
34+
"indent": "off",
35+
"camelcase": "off",
36+
"comma-dangle": "off",
37+
"arrow-parens": "off",
38+
"operator-linebreak": "off",
39+
"object-curly-spacing": "off",
40+
"node/no-missing-import": "off",
41+
"padding-line-between-statements": "off",
42+
"@typescript-eslint/ban-ts-ignore": "off",
743
"unicorn/no-abusive-eslint-disable": "off",
44+
"unicorn/consistent-function-scoping": "off",
845
"@typescript-eslint/no-use-before-define": "off",
9-
"@typescript-eslint/ban-ts-ignore": "off"
10-
}
11-
}
46+
"@typescript-eslint/camelcase": "off",
47+
"no-process-exit":"off",
48+
"unicorn/no-process-exit": "off",
49+
"@typescript-eslint/no-var-requires": "off"
50+
}
51+
}

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [10.x, 12.x, 14.x]
19+
node-version: [16.x, 18.x]
2020

2121
steps:
2222
- uses: actions/checkout@v2

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
build:
8+
name: Build and upload
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: "16.x"
19+
- name: Installing dependencies
20+
run: npm install
21+
- name: Build
22+
run: npm run prepack
23+
- name: Upload dist
24+
uses: actions/upload-artifact@v3
25+
with:
26+
name: lib
27+
path: lib
28+
29+
release:
30+
name: Download dist and release
31+
runs-on: ubuntu-latest
32+
needs: build
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
with:
37+
fetch-depth: 0
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v1
40+
with:
41+
node-version: "16.x"
42+
- name: Installing dependencies
43+
run: npm install
44+
- name: Download dist
45+
uses: actions/download-artifact@v3
46+
with:
47+
name: lib
48+
path: lib
49+
- name: Display dirs
50+
run: ls -R
51+
- name: Release
52+
uses: JS-DevTools/npm-publish@v1
53+
with:
54+
token: ${{ secrets.NPM_TOKEN }}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Contentstack Solutions
3+
Copyright (c) 2023 Contentstack Solutions
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 106 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -64,130 +64,172 @@ $ csdx content-type:details -a "management token" -c "content type" --no-path
6464

6565
## `csdx content-type:audit`
6666

67-
display recent changes to a Content Type
67+
Display recent changes to a Content Type
6868

6969
```
7070
USAGE
71-
$ csdx content-type:audit
71+
$ csdx content-type:audit -c <value> [-s <value> | -a <value> | -a <value>] [-k <value> | | ]
7272
73-
OPTIONS
74-
-a, --token-alias=token-alias management token alias
75-
-c, --content-type=content-type (required) Content Type UID
76-
-s, --stack=stack Stack UID
73+
FLAGS
74+
-a, --alias=<value> Alias of the management token
75+
-a, --token-alias=<value> Management token alias
76+
-c, --content-type=<value> (required) Content Type UID
77+
-k, --stack-api-key=<value> Stack API Key
78+
-s, --stack=<value> Stack UID
79+
80+
DESCRIPTION
81+
Display recent changes to a Content Type
7782
7883
EXAMPLES
79-
$ csdx content-type:audit -s "xxxxxxxxxxxxxxxxxxx" -c "home_page"
80-
$ csdx content-type:audit -a "management token" -c "home_page"
84+
$ csdx content-type:audit --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"
85+
86+
$ csdx content-type:audit --alias "management token" --content-type "home_page"
8187
```
8288

83-
_See code: [src/commands/content-type/audit.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.0.7/src/commands/content-type/audit.ts)_
89+
_See code: [src/commands/content-type/audit.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.1.0/src/commands/content-type/audit.ts)_
8490

8591
## `csdx content-type:compare`
8692

87-
compare two Content Type versions
93+
Compare two Content Type versions
8894

8995
```
9096
USAGE
91-
$ csdx content-type:compare
97+
$ csdx content-type:compare -c <value> [-s <value> | -a <value>] [-k <value> | ] [-a <value>] [-l <value> -r <value>]
98+
99+
FLAGS
100+
-a, --alias=<value> Alias of the management token
101+
-a, --token-alias=<value> Management token alias
102+
-c, --content-type=<value> (required) Content Type UID
103+
-k, --stack-api-key=<value> Stack API Key
104+
-l, --left=<value> Content Type version, i.e. prev version
105+
-r, --right=<value> Content Type version, i.e. later version
106+
-s, --stack=<value> Stack UID
92107
93-
OPTIONS
94-
-a, --token-alias=token-alias management token alias
95-
-c, --content-type=content-type (required) Content Type UID
96-
-l, --left=left Content Type version, i.e. prev version
97-
-r, --right=right Content Type version, i.e. later version
98-
-s, --stack=stack Stack UID
108+
DESCRIPTION
109+
Compare two Content Type versions
99110
100111
EXAMPLES
101-
$ csdx content-type:compare -s "xxxxxxxxxxxxxxxxxxx" -c "home_page"
102-
$ csdx content-type:compare -s "xxxxxxxxxxxxxxxxxxx" -c "home_page" -l # -r #
103-
$ csdx content-type:compare -a "management token" -c "home_page" -l # -r #
112+
$ csdx content-type:compare --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"
113+
114+
$ csdx content-type:compare --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page" --left # --right #
115+
116+
$ csdx content-type:compare --alias "management token" --content-type "home_page" --left # --right #
104117
```
105118

106-
_See code: [src/commands/content-type/compare.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.0.7/src/commands/content-type/compare.ts)_
119+
_See code: [src/commands/content-type/compare.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.1.0/src/commands/content-type/compare.ts)_
107120

108121
## `csdx content-type:compare-remote`
109122

110123
compare two Content Types on different Stacks
111124

112125
```
113126
USAGE
114-
$ csdx content-type:compare-remote
127+
$ csdx content-type:compare-remote (-o <value> -r <value>) -c <value>
115128
116-
OPTIONS
117-
-c, --content-type=content-type (required) Content Type UID
118-
-o, --origin-stack=origin-stack (required) origin Stack UID
119-
-r, --remote-stack=remote-stack (required) remote Stack UID
129+
FLAGS
130+
-c, --content-type=<value> (required) Content Type UID
131+
-o, --origin-stack=<value> (required) Origin Stack API Key
132+
-r, --remote-stack=<value> (required) Remote Stack API Key
120133
121-
EXAMPLE
122-
$ csdx content-type:compare-remote -o "xxxxxxxxxxxxxxxxxxx" -r "xxxxxxxxxxxxxxxxxxx" -c "home_page"
134+
DESCRIPTION
135+
compare two Content Types on different Stacks
136+
137+
EXAMPLES
138+
$ csdx content-type:compare-remote --origin-stack "xxxxxxxxxxxxxxxxxxx" --remote-stack "xxxxxxxxxxxxxxxxxxx" -content-type "home_page"
123139
```
124140

125-
_See code: [src/commands/content-type/compare-remote.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.0.7/src/commands/content-type/compare-remote.ts)_
141+
_See code: [src/commands/content-type/compare-remote.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.1.0/src/commands/content-type/compare-remote.ts)_
126142

127143
## `csdx content-type:details`
128144

129-
display Content Type details
145+
Display Content Type details
130146

131147
```
132148
USAGE
133-
$ csdx content-type:details
149+
$ csdx content-type:details -c <value> [-s <value> | -a <value>] [-k <value> | ] [-a <value>] [-p]
134150
135-
OPTIONS
136-
-a, --token-alias=token-alias management token alias
137-
-c, --content-type=content-type (required) Content Type UID
138-
-p, --[no-]path show path column
139-
-s, --stack=stack Stack UID
151+
FLAGS
152+
-a, --alias=<value> Alias of the management token
153+
-a, --token-alias=<value> Management token alias
154+
-c, --content-type=<value> (required) Content Type UID
155+
-k, --stack-api-key=<value> Stack API Key
156+
-p, --[no-]path show path column
157+
-s, --stack=<value> Stack UID
158+
159+
DESCRIPTION
160+
Display Content Type details
140161
141162
EXAMPLES
142-
$ csdx content-type:details -s "xxxxxxxxxxxxxxxxxxx" -c "home_page"
143-
$ csdx content-type:details -a "management token" -c "home_page"
144-
$ csdx content-type:details -a "management token" -c "home_page" --no-path
163+
$ csdx content-type:details --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"
164+
165+
$ csdx content-type:details --alias "management token" --content-type "home_page"
166+
167+
$ csdx content-type:details --alias "management token" --content-type "home_page" --no-path
145168
```
146169

147-
_See code: [src/commands/content-type/details.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.0.7/src/commands/content-type/details.ts)_
170+
_See code: [src/commands/content-type/details.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.1.0/src/commands/content-type/details.ts)_
148171

149172
## `csdx content-type:diagram`
150173

151-
create a visual diagram of a Stack's Content Types
174+
Create a visual diagram of a Stack's Content Types
152175

153176
```
154177
USAGE
155-
$ csdx content-type:diagram
156-
157-
OPTIONS
158-
-a, --token-alias=token-alias management token alias
159-
-d, --direction=portrait|landscape (required) [default: portrait] graph orientation
160-
-o, --output=output (required) full path to output
161-
-s, --stack=stack Stack UID
162-
-t, --type=svg|dot (required) [default: svg] graph output file type
178+
$ csdx content-type:diagram -o <value> -d portrait|landscape -t svg|dot [-s <value> | -a <value> | -a <value>] [-k
179+
<value> | | ]
180+
181+
FLAGS
182+
-a, --alias=<value> Alias of the management token
183+
-a, --token-alias=<value> Management token alias
184+
-d, --direction=<option> (required) [default: portrait] graph orientation
185+
<options: portrait|landscape>
186+
-k, --stack-api-key=<value> Stack API Key
187+
-o, --output=<value> (required) full path to output
188+
-s, --stack=<value> Stack UID
189+
-t, --type=<option> (required) [default: svg] graph output file type
190+
<options: svg|dot>
191+
192+
DESCRIPTION
193+
Create a visual diagram of a Stack's Content Types
163194
164195
EXAMPLES
165-
$ csdx content-type:diagram -s "xxxxxxxxxxxxxxxxxxx" -o "content-model.svg"
166-
$ csdx content-type:diagram -a "management token" -o "content-model.svg"
167-
$ csdx content-type:diagram -a "management token" -o "content-model.svg" -d "landscape"
168-
$ csdx content-type:diagram -a "management token" -o "content-model.dot" -t "dot"
196+
$ csdx content-type:diagram --stack-api-key "xxxxxxxxxxxxxxxxxxx" --output "content-model.svg"
197+
198+
$ csdx content-type:diagram --alias "management token" --output "content-model.svg"
199+
200+
$ csdx content-type:diagram --alias "management token" --output "content-model.svg" --direction "landscape"
201+
202+
$ csdx content-type:diagram --alias "management token" --output "content-model.dot" --type "dot"
169203
```
170204

171-
_See code: [src/commands/content-type/diagram.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.0.7/src/commands/content-type/diagram.ts)_
205+
_See code: [src/commands/content-type/diagram.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.1.0/src/commands/content-type/diagram.ts)_
172206

173207
## `csdx content-type:list`
174208

175-
list all Content Types in a Stack
209+
List all Content Types in a Stack
176210

177211
```
178212
USAGE
179-
$ csdx content-type:list
213+
$ csdx content-type:list [-s <value> | -a <value> | -a <value>] [-k <value> | | ] [-o title|modified]
214+
215+
FLAGS
216+
-a, --alias=<value> Alias of the management token
217+
-a, --token-alias=<value> Management token alias
218+
-k, --stack-api-key=<value> Stack API Key
219+
-o, --order=<option> [default: title] order by column
220+
<options: title|modified>
221+
-s, --stack=<value> Stack UID
180222
181-
OPTIONS
182-
-a, --token-alias=token-alias management token alias
183-
-o, --order=title|modified [default: title] order by column
184-
-s, --stack=stack Stack UID
223+
DESCRIPTION
224+
List all Content Types in a Stack
185225
186226
EXAMPLES
187-
$ csdx content-type:list -s "xxxxxxxxxxxxxxxxxxx"
188-
$ csdx content-type:list -a "management token"
189-
$ csdx content-type:list -a "management token" -o modified
227+
$ csdx content-type:list --stack-api-key "xxxxxxxxxxxxxxxxxxx"
228+
229+
$ csdx content-type:list --alias "management token"
230+
231+
$ csdx content-type:list --alias "management token" --order modified
190232
```
191233

192-
_See code: [src/commands/content-type/list.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.0.7/src/commands/content-type/list.ts)_
234+
_See code: [src/commands/content-type/list.ts](https://github.com/Contentstack-Solutions/contentstack-cli-content-type/blob/v1.1.0/src/commands/content-type/list.ts)_
193235
<!-- commandsstop -->

0 commit comments

Comments
 (0)