# slappforge-sigma-cli

> CLI based toolkit to be used with SLAppForge Sigma projects

Latest version **2.0.1** (published 2022-09-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install slappforge-sigma-cli
pnpm add slappforge-sigma-cli
yarn add slappforge-sigma-cli
bun add slappforge-sigma-cli
```

Provides the command `sigma`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2022-09-08 |
| First published | 2020-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 85.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | SLAppForge |
| Maintainers | slappforge-admin |
| Keywords | aws, sigma, slappforge, serverless, lambda, nodejs, python, cli, ci/cd |

## Links

- npm: https://www.npmjs.com/package/slappforge-sigma-cli
- npm.io page: https://npm.io/package/slappforge-sigma-cli

## Dependencies (8)

- [ora](https://npm.io/package/ora.md) ^4.0.4
- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [jszip](https://npm.io/package/jszip.md) ^3.5.0
- [moment](https://npm.io/package/moment.md) ^2.27.0
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.702.0
- [inquirer](https://npm.io/package/inquirer.md) ^7.2.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.5
- [cli-table3](https://npm.io/package/cli-table3.md) ^0.6.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2022-09-08
- 1.0.0-beta.7 (beta) — 2020-07-28
- 2.0.0 — 2021-01-20
- 1.0.0 — 2020-08-10
- 1.0.0-beta.6 — 2020-07-13
- 1.0.0-beta.5 — 2020-07-08
- 1.0.0-beta.4 — 2020-07-07
- 1.0.0-beta.3 — 2020-07-07
- 1.0.0-beta.1 — 2020-07-01

## README

<div style="text-align:center">
    <img src="https://s3.amazonaws.com/resources.sigma.slappforge.com/slappforge_logo_color.png" alt="SLAppForge" width="300"/>
</div>

# **SLAppForge Sigma CLI**

```
 ██████╗██╗ ██████╗ ███╗   ███╗ █████╗      ██████╗██╗     ██╗
██╔════╝██║██╔════╝ ████╗ ████║██╔══██╗    ██╔════╝██║     ██║
███████╗██║██║  ███╗██╔████╔██║███████║    ██║     ██║     ██║
╚════██║██║██║   ██║██║╚██╔╝██║██╔══██║    ██║     ██║     ██║
███████║██║╚██████╔╝██║ ╚═╝ ██║██║  ██║    ╚██████╗███████╗██║
╚══════╝╚═╝ ╚═════╝ ╚═╝     ╚═╝╚═╝  ╚═╝     ╚═════╝╚══════╝╚═╝
```

**SLAppForge Sigma CLI** is a command line based toolkit that can be used to,
* Validate
* Build
* Deploy

a serverless application project created using [SLAppForge Sigma](https://sigma.slappforge.com/) Serverless IDE.

> ⚠️ This toolkit is still in **beta** and hence **not recommended** for any production critical use cases.

> ℹ️ This toolkit only supports AWS based deployments at the moment. GCP based deployments will be supported in the future.



## Installation

### Prerequisites

Following should be installed in the system where this toolkit is executed

* **[NodeJS](https://nodejs.org/en/)** (version 10 or newer)

  Currently installed `node` version can be checked using the below command.
  ```
  node -v
  ```
* **NPM**

  Currently installed `npm` version can be checked using the below command.
  ```
  npm -v
  ```

In case NodeJS and NPM are not installed, you can follow [this guide](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm#using-a-node-installer-to-install-nodejs-and-npm) to install them on your system.

### 🔧 Installing Sigma CLI

Sigma CLI can be installed as a global node module using the below command.
```
npm install slappforge-sigma-cli -g
```

Once installed, the `sigma` command will be available system-wide.


## Usage

This toolkit can be used to validate, build or deploy a SLAppForge Sigma generated project. In each case, the toolkit should be **invoked from the root directory** of the Sigma project (i.e. the directory that contains the `appState.json` file).

**All the operation logs will be written to the `stderr` of the console, while the final operation output will be  written to the `stdout` of the console.**

<br/>

### 📖 `help` command

```
sigma help
```

This command lists all the available commands of this toolkit.

<br/>

### AWS Commands

<br/>

#### 🔍 `validate` command

```
sigma aws validate
```

This command validates whether the current directory has a valid AWS based Sigma serverless project and also if it is a version supported by this Sigma CLI.

> Sigma CLI only supports building and deploying projects created by Sigma 1.4.0 or newer versions. If your project was created using an older Sigma version, please open the project using a newer Sigma version and re-save it into your VCS repository.

#### Command Options

_This command does not have any options_

#### Command Output `stdout`

_This command does not output any value upon the successful completion_


<br/>

#### 🔨 `build` command

```
sigma aws build [-opts]
```

This command builds the project in the current directory and generates the deployment package as a `zip` file into a given location on the local file system. The name of the generated `zip` file will be of the following format.

**build_projectName_version_buildTimestamp.zip** (e.g.: build_MyProject_1.0.0_1593063620507.zip)

Optionally this command can upload the generated deployment package into a given S3 bucket as well.

#### Command Options

|Option | Required | Description | Default Value|
|--- |:---: |--- |---|
|`--buildDir` | :x: | File system location to save the generated deployment package | `./sigma-builds`|
|`--s3Bucket` | :x: | S3 bucket to upload the generated deployment package. If this is not provided, S3 upload will not be attempted. |- |
|`--s3Prefix` | :x: | S3 prefix to be added for the generated deployment package name |- |
|`--awsProfile` | :x: | AWS profile to be used for uploading the generated deployment package to S3 |`default` |
|`--awsKey` | :x: | AWS access key to be used for uploading the generated deployment package to S3. This will be ignored if the `--awsProfile` option is provided. |- |
|`--awsSecret` | :x: | AWS access secret to be used for uploading the generated deployment package to S3. **This is required if `--awsKey` is provided.** | -|

#### Command Output `stdout`

* If **only the local build was executed** (without attempting S3 upload), **relative file path** of the generated deployment artifact will be the output.<br/>
e.g.: `./sigma_builds/build_MyProject_1.0.0_1593063620507.zip`

* If S3 upload was also successful, **S3 URL** of the generated deployment artifact will be the output.<br/>
e.g.: `s3://myBucket/my-sigma-builds/build_MyProject_1.0.0_1593063620507.zip`

<br/>

#### 🚀 `deploy` command

```
sigma aws deploy [-opts]
```

This command deploys the project in the current directory to the given AWS account. Prior to the deployment step, this will automatically invoke the build step as well.

#### Command Options

|Option | Required | Description | Default Value|
|--- |:---: |--- |---|
|`--depPackage` | :x: | S3 URL of a pre-built deployment package. <br/>e.g.: `s3://myBucket/my-sigma-builds/build_MyProject_1.0.0_1593063620507.zip` <br/><br/>_If this is provided, project build stage will be skipped and `--buildDir`, `--s3Bucket`, `--s3Prefix` options will be ignored._ |-|
|`--buildDir` | :x: | File system location to save the generated deployment package | `./sigma-builds`|
|`--s3Bucket` | :x: | S3 bucket to upload the generated deployment package and to upload the CloudFormation template if it is larger than 50kB. **This is required if `--depPackage` is not provided or the CloudFormation template is larger than 50kB.** |- |
|`--s3Prefix` | :x: | S3 prefix to be added for the generated deployment package name and to the CloudFormation template file name if the template is larger than 50kB. |- |
|`--awsProfile` | :x: | AWS profile to be used for uploading the generated deployment package to S3 |`default` |
|`--awsKey` | :x: | AWS access key to be used for uploading the generated deployment package to S3. This will be ignored if the `--awsProfile` option is provided. |- |
|`--awsSecret` | :x: | AWS access secret to be used for uploading the generated deployment package to S3. **This is required if `--awsKey` is provided.** |-|
|`--stackName` | :x: | Name of the CloudFormation stack to be created.<br/><br/> This can contain only alphanumeric characters (case-sensitive) and hyphens. It must start with an alphabetic character and can't be longer than 128 characters. |Will be of the format `ProjectName-ProjectVersion-Stack` (e.g.: `MyProject-1-0-0-Stack`)|
|`--autoDepMode` | :x: | Whether to automatically carry out the deployment without waiting for any user confirmation.<br/><br/> If this is set to `true`, CLI will not prompt for user confirmation in any of the deployment steps. Instead it will take the following actions, **unless any of them were overridden by specific command line arguments**. <br/><br/> - Change set deployment will start automatically, just after the generation.<br/><br/> - In case the stack is in an unrecoverable (non-updatable) state, deployment will be aborted.<br/> (*This can be overridden by providing the `--deleteUnrecoverable` option.*) |`false`|
|`--deleteUnrecoverable` | :x: | In case the stack is in an unrecoverable (non-updatable) state, whether to **delete the existing stack** and retry the deployment. |`false`|
|`--templateParam` | :x: | A CloudFormation template parameter to be used during the deployment. The value of this option should be in the format `paramKey:paramValue`.<br/><br/> This option can be provided multiple times for multiple parameters. |-|
|`--templateParamFile` | :x: | A path to a JSON file containing the CloudFormation template parameters to be used during the deployment. <br/><br/>**Parameters provided from this file will be overridden by parameters provided as `--templateParam`, if the key is same.** |-|

#### Command Output `stdout`

The final status of the CloudFormation stack, followed by the list of CloudFormation outputs of the stack.<br/>
e.g.:
```
CREATE_COMPLETE
 MyLambda                             arn:aws:lambda:us-east-1:123456789123:function:MyLambda               ARN of Lambda function MyLambda
 httpApigMyEventAPIRoutePOSTnotify    https://abcd123efg.execute-api.us-east-1.amazonaws.com/prod/notify    POST endpoint for route /notify on API MyEventAPI
 snsusEast1MyNotificationTopic        arn:aws:sns:us-east-1:123456789123:MyNotificationTopic                ARN of SNS topic MyNotificationTopic
```

---
_Source: https://npm.io/package/slappforge-sigma-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
