Skip to content

Commit

Permalink
Merge pull request #9 from Contentstack-Solutions/feat/CS-35686
Browse files Browse the repository at this point in the history
  CLI | contentstack-cli-content-type plugin required code update
  • Loading branch information
aman19K authored Jul 3, 2023
2 parents 4a45da8 + 98e7f4a commit 49cd943
Show file tree
Hide file tree
Showing 30 changed files with 22,274 additions and 12,538 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/lib
56 changes: 48 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,51 @@
{
"extends": [
"oclif",
"oclif-typescript"
],
"rules": {
"extends": [
// "oclif",
"oclif-typescript",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "none"
}
],
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"semi": "off",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/no-redeclare": "off",
"eqeqeq": [
"error",
"smart"
],
"id-match": "error",
"no-eval": "error",
"no-var": "error",
"quotes": "off",
"indent": "off",
"camelcase": "off",
"comma-dangle": "off",
"arrow-parens": "off",
"operator-linebreak": "off",
"object-curly-spacing": "off",
"node/no-missing-import": "off",
"padding-line-between-statements": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"unicorn/no-abusive-eslint-disable": "off",
"unicorn/consistent-function-scoping": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/ban-ts-ignore": "off"
}
}
"@typescript-eslint/camelcase": "off",
"no-process-exit":"off",
"unicorn/no-process-exit": "off",
"@typescript-eslint/no-var-requires": "off"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [16.x, 18.x]

steps:
- uses: actions/checkout@v2
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release
on:
push:
branches:
- main
jobs:
build:
name: Build and upload
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Installing dependencies
run: npm install
- name: Build
run: npm run prepack
- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: lib
path: lib

release:
name: Download dist and release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Installing dependencies
run: npm install
- name: Download dist
uses: actions/download-artifact@v3
with:
name: lib
path: lib
- name: Display dirs
run: ls -R
- name: Release
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Contentstack Solutions
Copyright (c) 2023 Contentstack Solutions

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
170 changes: 106 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,130 +64,172 @@ $ csdx content-type:details -a "management token" -c "content type" --no-path

## `csdx content-type:audit`

display recent changes to a Content Type
Display recent changes to a Content Type

```
USAGE
$ csdx content-type:audit
$ csdx content-type:audit -c <value> [-s <value> | -a <value> | -a <value>] [-k <value> | | ]
OPTIONS
-a, --token-alias=token-alias management token alias
-c, --content-type=content-type (required) Content Type UID
-s, --stack=stack Stack UID
FLAGS
-a, --alias=<value> Alias of the management token
-a, --token-alias=<value> Management token alias
-c, --content-type=<value> (required) Content Type UID
-k, --stack-api-key=<value> Stack API Key
-s, --stack=<value> Stack UID
DESCRIPTION
Display recent changes to a Content Type
EXAMPLES
$ csdx content-type:audit -s "xxxxxxxxxxxxxxxxxxx" -c "home_page"
$ csdx content-type:audit -a "management token" -c "home_page"
$ csdx content-type:audit --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"
$ csdx content-type:audit --alias "management token" --content-type "home_page"
```

_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)_
_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)_

## `csdx content-type:compare`

compare two Content Type versions
Compare two Content Type versions

```
USAGE
$ csdx content-type:compare
$ csdx content-type:compare -c <value> [-s <value> | -a <value>] [-k <value> | ] [-a <value>] [-l <value> -r <value>]
FLAGS
-a, --alias=<value> Alias of the management token
-a, --token-alias=<value> Management token alias
-c, --content-type=<value> (required) Content Type UID
-k, --stack-api-key=<value> Stack API Key
-l, --left=<value> Content Type version, i.e. prev version
-r, --right=<value> Content Type version, i.e. later version
-s, --stack=<value> Stack UID
OPTIONS
-a, --token-alias=token-alias management token alias
-c, --content-type=content-type (required) Content Type UID
-l, --left=left Content Type version, i.e. prev version
-r, --right=right Content Type version, i.e. later version
-s, --stack=stack Stack UID
DESCRIPTION
Compare two Content Type versions
EXAMPLES
$ csdx content-type:compare -s "xxxxxxxxxxxxxxxxxxx" -c "home_page"
$ csdx content-type:compare -s "xxxxxxxxxxxxxxxxxxx" -c "home_page" -l # -r #
$ csdx content-type:compare -a "management token" -c "home_page" -l # -r #
$ csdx content-type:compare --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"
$ csdx content-type:compare --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page" --left # --right #
$ csdx content-type:compare --alias "management token" --content-type "home_page" --left # --right #
```

_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)_
_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)_

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

compare two Content Types on different Stacks

```
USAGE
$ csdx content-type:compare-remote
$ csdx content-type:compare-remote (-o <value> -r <value>) -c <value>
OPTIONS
-c, --content-type=content-type (required) Content Type UID
-o, --origin-stack=origin-stack (required) origin Stack UID
-r, --remote-stack=remote-stack (required) remote Stack UID
FLAGS
-c, --content-type=<value> (required) Content Type UID
-o, --origin-stack=<value> (required) Origin Stack API Key
-r, --remote-stack=<value> (required) Remote Stack API Key
EXAMPLE
$ csdx content-type:compare-remote -o "xxxxxxxxxxxxxxxxxxx" -r "xxxxxxxxxxxxxxxxxxx" -c "home_page"
DESCRIPTION
compare two Content Types on different Stacks
EXAMPLES
$ csdx content-type:compare-remote --origin-stack "xxxxxxxxxxxxxxxxxxx" --remote-stack "xxxxxxxxxxxxxxxxxxx" -content-type "home_page"
```

_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)_
_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)_

## `csdx content-type:details`

display Content Type details
Display Content Type details

```
USAGE
$ csdx content-type:details
$ csdx content-type:details -c <value> [-s <value> | -a <value>] [-k <value> | ] [-a <value>] [-p]
OPTIONS
-a, --token-alias=token-alias management token alias
-c, --content-type=content-type (required) Content Type UID
-p, --[no-]path show path column
-s, --stack=stack Stack UID
FLAGS
-a, --alias=<value> Alias of the management token
-a, --token-alias=<value> Management token alias
-c, --content-type=<value> (required) Content Type UID
-k, --stack-api-key=<value> Stack API Key
-p, --[no-]path show path column
-s, --stack=<value> Stack UID
DESCRIPTION
Display Content Type details
EXAMPLES
$ csdx content-type:details -s "xxxxxxxxxxxxxxxxxxx" -c "home_page"
$ csdx content-type:details -a "management token" -c "home_page"
$ csdx content-type:details -a "management token" -c "home_page" --no-path
$ csdx content-type:details --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"
$ csdx content-type:details --alias "management token" --content-type "home_page"
$ csdx content-type:details --alias "management token" --content-type "home_page" --no-path
```

_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)_
_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)_

## `csdx content-type:diagram`

create a visual diagram of a Stack's Content Types
Create a visual diagram of a Stack's Content Types

```
USAGE
$ csdx content-type:diagram
OPTIONS
-a, --token-alias=token-alias management token alias
-d, --direction=portrait|landscape (required) [default: portrait] graph orientation
-o, --output=output (required) full path to output
-s, --stack=stack Stack UID
-t, --type=svg|dot (required) [default: svg] graph output file type
$ csdx content-type:diagram -o <value> -d portrait|landscape -t svg|dot [-s <value> | -a <value> | -a <value>] [-k
<value> | | ]
FLAGS
-a, --alias=<value> Alias of the management token
-a, --token-alias=<value> Management token alias
-d, --direction=<option> (required) [default: portrait] graph orientation
<options: portrait|landscape>
-k, --stack-api-key=<value> Stack API Key
-o, --output=<value> (required) full path to output
-s, --stack=<value> Stack UID
-t, --type=<option> (required) [default: svg] graph output file type
<options: svg|dot>
DESCRIPTION
Create a visual diagram of a Stack's Content Types
EXAMPLES
$ csdx content-type:diagram -s "xxxxxxxxxxxxxxxxxxx" -o "content-model.svg"
$ csdx content-type:diagram -a "management token" -o "content-model.svg"
$ csdx content-type:diagram -a "management token" -o "content-model.svg" -d "landscape"
$ csdx content-type:diagram -a "management token" -o "content-model.dot" -t "dot"
$ csdx content-type:diagram --stack-api-key "xxxxxxxxxxxxxxxxxxx" --output "content-model.svg"
$ csdx content-type:diagram --alias "management token" --output "content-model.svg"
$ csdx content-type:diagram --alias "management token" --output "content-model.svg" --direction "landscape"
$ csdx content-type:diagram --alias "management token" --output "content-model.dot" --type "dot"
```

_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)_
_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)_

## `csdx content-type:list`

list all Content Types in a Stack
List all Content Types in a Stack

```
USAGE
$ csdx content-type:list
$ csdx content-type:list [-s <value> | -a <value> | -a <value>] [-k <value> | | ] [-o title|modified]
FLAGS
-a, --alias=<value> Alias of the management token
-a, --token-alias=<value> Management token alias
-k, --stack-api-key=<value> Stack API Key
-o, --order=<option> [default: title] order by column
<options: title|modified>
-s, --stack=<value> Stack UID
OPTIONS
-a, --token-alias=token-alias management token alias
-o, --order=title|modified [default: title] order by column
-s, --stack=stack Stack UID
DESCRIPTION
List all Content Types in a Stack
EXAMPLES
$ csdx content-type:list -s "xxxxxxxxxxxxxxxxxxx"
$ csdx content-type:list -a "management token"
$ csdx content-type:list -a "management token" -o modified
$ csdx content-type:list --stack-api-key "xxxxxxxxxxxxxxxxxxx"
$ csdx content-type:list --alias "management token"
$ csdx content-type:list --alias "management token" --order modified
```

_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)_
_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)_
<!-- commandsstop -->
Loading

0 comments on commit 49cd943

Please sign in to comment.