Skip to content

Commit 4f4ade8

Browse files
author
ninadhatkar
committed
Initial commit
0 parents  commit 4f4ade8

247 files changed

Lines changed: 48959 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
.todo
3+
logs
4+
contents
5+
lerna-debug.log
6+
.DS_Store
7+
contentTest
8+
build

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Contentstack CLI
2+
3+
4+
Contentstack is a headless CMS with an API-first approach that puts content at the centre. It is designed to simplify the process of publication by separating code from content.
5+
6+
Currently, the CLI is in Beta and supports content management scripts through which you can perform the following tasks:
7+
8+
## Bulk publish content
9+
Export content
10+
Import content
11+
12+
## Installing CLI
13+
### Prerequisites
14+
Contentstack account
15+
Node.js version 8 or above
16+
17+
### Installation
18+
To install CLI on your system, run the below command in your terminal:
19+
20+
```
21+
npm install -g @contentstack/cli
22+
```
23+
24+
To verify the installation, run `csdx` in the command window.
25+
26+
## Usage
27+
After the successful installation of CLI, use the `--help` parameter to display the help section of the CLI. You can even combine this parameter with a specific command to get the help section of that command.
28+
29+
```shell
30+
$ csdx --help
31+
```
32+
33+
## Namespaces
34+
**auth**: To perform [authentication-related](/packages/auth) activities
35+
36+
**cm**: To perform content management activities such as [bulk publish](/packages/contentstack-bulk-publish), [import](/packages/contentstack-import), and [export](/packages/contentstack-export) content
37+
38+
**help**: To list the helpful commands in CLI
39+
40+
**config**: To set regions and customize them
41+
42+
## Documentation
43+
44+
To get a more detailed documentation for every command, visit the [CLI section](https://www.contentstack.com/docs/developers/cli) in our docs.

install-from-code.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
# ----------------------------------
3+
# Colors
4+
# ----------------------------------
5+
NOCOLOR='\033[0m'
6+
RED='\033[0;31m'
7+
GREEN='\033[0;32m'
8+
ORANGE='\033[0;33m'
9+
BLUE='\033[0;34m'
10+
PURPLE='\033[0;35m'
11+
CYAN='\033[0;36m'
12+
LIGHTGRAY='\033[0;37m'
13+
DARKGRAY='\033[1;30m'
14+
LIGHTRED='\033[1;31m'
15+
LIGHTGREEN='\033[1;32m'
16+
YELLOW='\033[1;33m'
17+
LIGHTBLUE='\033[1;34m'
18+
LIGHTPURPLE='\033[1;35m'
19+
LIGHTCYAN='\033[1;36m'
20+
WHITE='\033[1;37m'
21+
22+
23+
mkdir -p build || { echo -e '\e[31mFailed to create build folder.' && exit 1; }
24+
cp -r dependency build
25+
npm install || { echo -e '\e[31mFailed to install root dependencies.' && exit 1; }
26+
npx lerna bootstrap
27+
npx lerna run pack || { echo -e '\e[31mInstallable tarball creation failed.' && exit 1; }
28+
echo 'Building CLI package...'
29+
npx lerna run build || { echo -e '\e[31mBuild generation failed for core module.' ; exit 1; }
30+
echo 'Built CLI package, Done!!!'
31+
cd build/@contentstack/packages
32+
echo 'Installing Contentstack CLI globally'
33+
sudo npm install -g ./contentstack-cli.tgz || { echo -e '\e[31mGlobal installation failed for CLI module!!!' ; exit 1; }
34+
echo 'Installtion, Done!!!'
35+
echo 'Testing Contentstack Command...'
36+
csdx || { echo -e '\e[31mSomething went wrong while build generation command not installed properly!!!' ; exit 1; }
37+
echo 'Installtion completed successfully!!!'

lerna.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"packages": [
3+
"packages/*"
4+
],
5+
"pack": {
6+
"ignore": "contentstack-management"
7+
},
8+
"npmClient": "npm",
9+
"version": "independent"
10+
}

package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "root",
3+
"dependencies": {
4+
"@contentstack/cli": "file:build/contentstack-cli.tgz"
5+
},
6+
"devDependencies": {
7+
"lerna": "^3.16.4"
8+
},
9+
"engines": {
10+
"node": ">=8.0.0"
11+
},
12+
"private": true,
13+
"scripts": {
14+
"clean:build": "rm -rf ./build"
15+
},
16+
"standard": {
17+
"env": "mocha",
18+
"ignore": [
19+
"**/node_modules/**",
20+
"packages/*/lib/**"
21+
]
22+
},
23+
"workspaces": [
24+
"packages/*"
25+
]
26+
}

packages/auth/.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false

packages/auth/.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "oclif"
3+
}

packages/auth/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*-debug.log
2+
*-error.log
3+
/.nyc_output
4+
/dist
5+
/tmp
6+
/logs
7+
/yarn.lock
8+
node_modules
9+
/coverage

packages/auth/README.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
@contentstack/cli-auth
2+
===
3+
4+
Authenticate yourself with the CLI
5+
6+
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
7+
[![Version](https://img.shields.io/npm/v/cli.svg)](https://npmjs.org/package/cli)
8+
[![Downloads/week](https://img.shields.io/npm/dw/cli.svg)](https://npmjs.org/package/cli)
9+
[![License](https://img.shields.io/npm/l/cli.svg)](https://github.com/contentstack/cli/blob/master/package.json)
10+
11+
<!-- toc -->
12+
* [Usage](#usage)
13+
* [Commands](#commands)
14+
<!-- tocstop -->
15+
# Usage
16+
<!-- usage -->
17+
```sh-session
18+
$ npm install -g @contentstack/cli-auth
19+
$ csdx COMMAND
20+
running command...
21+
$ csdx (-v|--version|version)
22+
@contentstack/cli-auth/0.0.1 darwin-x64 node-v10.19.0
23+
$ csdx --help [COMMAND]
24+
USAGE
25+
$ csdx COMMAND
26+
...
27+
```
28+
<!-- usagestop -->
29+
# Commands
30+
<!-- commands -->
31+
* [`csdx auth:login`](#csdx-authlogin)
32+
* [`csdx auth:logout`](#csdx-authlogout)
33+
* [`csdx auth:tokens`](#csdx-authtokens)
34+
* [`csdx auth:tokens:add`](#csdx-authtokensadd)
35+
* [`csdx auth:tokens:remove`](#csdx-authtokensremove)
36+
* [`csdx auth:whoami`](#csdx-authwhoami)
37+
38+
## `csdx auth:login`
39+
40+
Login to Contentstack and save the session for further use
41+
42+
```
43+
USAGE
44+
$ csdx auth:login
45+
46+
OPTIONS
47+
-u, --username=username Email address of your Contentstack account
48+
49+
ALIASES
50+
$ csdx login
51+
```
52+
53+
_See code: [src/commands/auth/login.js](https://github.com/contentstack/cli/blob/v0.0.1/src/commands/auth/login.js)_
54+
55+
## `csdx auth:logout`
56+
57+
Log out from Contentstack and clear the session
58+
59+
```
60+
USAGE
61+
$ csdx auth:logout
62+
63+
OPTIONS
64+
-f, --force Exclude confirmation to logout
65+
66+
ALIASES
67+
$ csdx logout
68+
```
69+
70+
_See code: [src/commands/auth/logout.js](https://github.com/contentstack/cli/blob/v0.0.1/src/commands/auth/logout.js)_
71+
72+
## `csdx auth:tokens`
73+
74+
Use to list all existing management tokens
75+
76+
```
77+
USAGE
78+
$ csdx auth:tokens
79+
80+
OPTIONS
81+
-x, --extended show extra columns
82+
--columns=columns only show provided columns (comma-separated)
83+
--csv output is csv format [alias: --output=csv]
84+
--filter=filter filter property by partial string matching, ex: name=foo
85+
--no-header hide table header from output
86+
--no-truncate do not truncate output to fit screen
87+
--output=csv|json|yaml output in a more machine friendly format
88+
--sort=sort property to sort by (prepend '-' for descending)
89+
90+
ALIASES
91+
$ csdx tokens
92+
```
93+
94+
_See code: [src/commands/auth/tokens/index.js](https://github.com/contentstack/cli/blob/v0.0.1/src/commands/auth/tokens/index.js)_
95+
96+
## `csdx auth:tokens:add`
97+
98+
Adds management/delivery tokens to your session to use it with further Contentstack/CLI command
99+
100+
```
101+
USAGE
102+
$ csdx auth:tokens:add
103+
104+
OPTIONS
105+
-a, --alias=alias
106+
-d, --delivery Set this while saving delivery token
107+
-e, --environment=environment Environment name for delivery token
108+
-f, --force Exclude confirmation to replace existing alias
109+
-k, --api-key=api-key Stack API key for the token
110+
-m, --management Set this while saving management token
111+
112+
-t, --token=token Sets token. Can be set via environment variable 'TOKEN'. We recommend to use env
113+
variable
114+
115+
DESCRIPTION
116+
by default it adds management token if either of management or delivery flags are not set
117+
118+
ALIASES
119+
$ csdx tokens:add
120+
```
121+
122+
_See code: [src/commands/auth/tokens/add.js](https://github.com/contentstack/cli/blob/v0.0.1/src/commands/auth/tokens/add.js)_
123+
124+
## `csdx auth:tokens:remove`
125+
126+
Removes stored tokens
127+
128+
```
129+
USAGE
130+
$ csdx auth:tokens:remove
131+
132+
OPTIONS
133+
-a, --alias=alias Alias (name) of the token to remove
134+
135+
-i, --ignore Ignores if token not present. Command shows show list of available aliases with multi select option
136+
to delete tokens from that list.
137+
138+
ALIASES
139+
$ csdx tokens:remove
140+
```
141+
142+
_See code: [src/commands/auth/tokens/remove.js](https://github.com/contentstack/cli/blob/v0.0.1/src/commands/auth/tokens/remove.js)_
143+
144+
## `csdx auth:whoami`
145+
146+
Display current users email address
147+
148+
```
149+
USAGE
150+
$ csdx auth:whoami
151+
152+
ALIASES
153+
$ csdx whoami
154+
```
155+
156+
_See code: [src/commands/auth/whoami.js](https://github.com/contentstack/cli/blob/v0.0.1/src/commands/auth/whoami.js)_
157+
<!-- commandsstop -->

packages/auth/bin/run

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
3+
require('@oclif/command').run()
4+
.catch(require('@oclif/errors/handle'))

0 commit comments

Comments
 (0)