@chuva.io/less-cli
Advanced tools
Comparing version 1.0.0-beta.4 to 1.0.0-beta.5
@@ -5,3 +5,4 @@ #!/usr/bin/env node | ||
import deploy from '../commands/deploy/index.js' | ||
import deploy from '../commands/deploy/index.js'; | ||
import add_template from '../commands/add-template/index.js'; | ||
@@ -18,7 +19,7 @@ const program = new Command(); | ||
program | ||
.command('deploy <projectName>') | ||
.description('deploy your less project') | ||
.action((projectName) => { | ||
if (!/^[a-zA-Z][-a-zA-Z0-9]*$/.test(projectName)) { | ||
console.log(chalk.redBright('Error:'), 'The projectName must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]'); | ||
.command('deploy <project_name>') | ||
.description('Deploy your less project.') | ||
.action((project_name) => { | ||
if (!/^[a-zA-Z][-a-zA-Z0-9]*$/.test(project_name)) { | ||
console.log(chalk.redBright('Error:'), 'The project_name must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]'); | ||
process.exit(1); | ||
@@ -32,6 +33,30 @@ } | ||
deploy(projectName) | ||
deploy(project_name) | ||
}); | ||
const template = program | ||
.command('template') | ||
.description('Use templates to help you get your boilerplate code set up for common tasks.'); | ||
template | ||
.command('add') | ||
.description('Add a template to your project.') | ||
.option('-n, --name <name>', 'The template you want to add. Options are "mongodb-js-shared-client".') | ||
.action((str, options) => { | ||
if (!options.name) { | ||
console.log(chalk.redBright('Error:'), 'The template name is required.'); | ||
process.exit(1); | ||
} | ||
switch (options.name) { | ||
case 'mongodb-js-shared-client': | ||
add_template.create_mongodb_js_shared_client(); | ||
process.exit(0); | ||
default: | ||
console.log(chalk.redBright('Error:'), 'Invalid template provided.'); | ||
process.exit(1); | ||
} | ||
}); | ||
// Parsing the command-line arguments and executing the corresponding actions | ||
program.parse(); |
{ | ||
"name": "@chuva.io/less-cli", | ||
"version": "1.0.0-beta.4", | ||
"description": "Less is a framework that allows you to build distributed, infinitely scalable, event-driven, realtime, fault tolerant, and serverless REST APIs, Websockets, and Microservices with no DevOps and no infrastructure. This CLI allows you to deploy and monitor your Less projects.", | ||
"version": "1.0.0-beta.5", | ||
"description": "`less-cli` is a CLI tool that allows you to deploy your Less projects to AWS while providing several other tools to facilitate your interaction with Less.", | ||
"author": "Chuva, LLC", | ||
"license": "Apache-2.0", | ||
"url": "https://github.com/chuva-io/less-cli.git", | ||
"homepage": "https://bit.ly/less-framework", | ||
@@ -8,0 +9,0 @@ "type": "module", |
@@ -1,54 +0,36 @@ | ||
# less-cli | ||
[![npm version](https://badge.fury.io/js/@chuva.io%2Fless-cli.svg)](https://badge.fury.io/js/@chuva.io%2Fless-cli) | ||
`less-cli` is a command-line interface (CLI) tool that allows you to interact with Less framework, making it easier to deploy your Less projects. With `less-cli`, you can quickly deploy your Less project to the Less platform. | ||
`less-cli` is a CLI tool that allows you to deploy your Less projects to AWS while providing several other tools to facilitate your interaction with Less. | ||
## Table of Contents | ||
- [Learn about Less](https://chuva-io.notion.site/Less-44d98337e08a46af934364700da05e3a) | ||
- [Less developer documentation](https://chuva-io.notion.site/Developer-documentation-ddbab90913494721b58eca81b3fb7552) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Commands](#commands) | ||
# Commands | ||
## Installation | ||
## `deploy` | ||
To use `less-cli`, you'll need to have Node.js and npm (Node Package Manager) installed on your system. If you haven't already, you can download them from the official [Node.js website](https://nodejs.org/). | ||
The `deploy` command allows you to deploy your Less project to AWS. | ||
Once you have Node.js and npm installed, you can install `less-cli` globally using the following command: | ||
*Note: Before deploying your project make sure to `export` your `LESS_TOKEN`.* | ||
```bash | ||
npm install -g @chuva.io/less-cli | ||
$ export LESS_TOKEN=your-less-token | ||
$ less-cli deploy <projectName> | ||
``` | ||
This will make the **`less-cli`** command available globally on your system. | ||
### Parameters | ||
## Usage | ||
`<projectName>` | ||
The name of your Less project. | ||
After installation, you can use **`less-cli`** from the command line by running: | ||
*Note: Supports alphanumeric characters and "-".* | ||
```bash | ||
less-cli [COMMAND] | ||
$ export LESS_TOKEN=your-less-token | ||
$ less-cli deploy invoice-microservice | ||
``` | ||
Replace **`[COMMAND]`** with one of the available commands described below. | ||
--- | ||
## ****Commands**** | ||
### Deploy | ||
The **`deploy`** command allows you to deploy your Less project to the Less platform. | ||
```bash | ||
less-cli deploy <projectName> | ||
``` | ||
- **`<projectName>`**: The name of your Less project. It must satisfy the regular expression pattern: **`[a-zA-Z][-a-zA-Z0-9]`**. | ||
Before using the **`deploy`** command, make sure to set the **`LESS_TOKEN`** environment variable with your Less token and you running this command on the root of your less project. | ||
Example: | ||
```bash | ||
export LESS_TOKEN=your-less-token | ||
less-cli deploy my-project | ||
``` | ||
Happy deploying with **`less-cli`**! | ||
Do more with Less. | ||
🇨🇻 |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
23301
10
265
37
7