-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
7,030 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": [ | ||
"oclif", | ||
"oclif-typescript" | ||
], | ||
"rules": { | ||
"semi": ["error", "always"], | ||
"object-curly-spacing": ["error", "always"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"require": [ | ||
"test/helpers/init.js", | ||
"ts-node/register" | ||
], | ||
"watch-extensions": [ | ||
"ts" | ||
], | ||
"recursive": true, | ||
"reporter": "spec", | ||
"timeout": 60000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,76 @@ | ||
[![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 CLI tool that allows you to deploy your Less projects to AWS while providing several other tools to facilitate your interaction with Less. | ||
|
||
- [Learn about Less](https://chuva-io.notion.site/Less-44d98337e08a46af934364700da05e3a) | ||
- [Less developer documentation](https://chuva-io.notion.site/Developer-documentation-ddbab90913494721b58eca81b3fb7552) | ||
|
||
<!-- toc --> | ||
* [Usage](#usage) | ||
* [Commands](#commands) | ||
<!-- tocstop --> | ||
# Usage | ||
<!-- usage --> | ||
```sh-session | ||
$ npm install -g @chuva.io/less-cli | ||
$ less-cli COMMAND | ||
running command... | ||
$ less-cli (--version) | ||
@chuva.io/less-cli/1.0.0-beta.5 darwin-x64 node-v16.20.0 | ||
$ less-cli --help [COMMAND] | ||
USAGE | ||
$ less-cli COMMAND | ||
... | ||
``` | ||
<!-- usagestop --> | ||
*Note: Before deploying your project make sure to `export` your `LESS_TOKEN`.* | ||
|
||
```bash | ||
$ export LESS_TOKEN=your-less-token | ||
``` | ||
|
||
# Commands | ||
<!-- commands --> | ||
* [`less-cli deploy PROJECTNAME`](#less-cli-deploy-projectname) | ||
* [`less-cli help [COMMANDS]`](#less-cli-help-commands) | ||
|
||
## `deploy` | ||
## `less-cli deploy PROJECTNAME` | ||
|
||
The `deploy` command allows you to deploy your Less project to AWS. | ||
Deploy your less project | ||
|
||
*Note: Before deploying your project make sure to `export` your `LESS_TOKEN`.* | ||
``` | ||
USAGE | ||
$ less-cli deploy PROJECTNAME | ||
```bash | ||
$ export LESS_TOKEN=your-less-token | ||
$ less-cli deploy <projectName> | ||
ARGUMENTS | ||
PROJECTNAME Name of your project | ||
DESCRIPTION | ||
Deploy your less project | ||
EXAMPLES | ||
$ less-cli deploy my-awesome-api | ||
``` | ||
|
||
### Parameters | ||
_See code: [dist/commands/deploy/index.ts](https://github.com/chuva-io/less-cli/blob/v1.0.0-beta.5/dist/commands/deploy/index.ts)_ | ||
|
||
`<projectName>` | ||
The name of your Less project. | ||
## `less-cli help [COMMANDS]` | ||
|
||
*Note: Supports alphanumeric characters and "-".* | ||
Display help for less-cli. | ||
|
||
```bash | ||
$ export LESS_TOKEN=your-less-token | ||
$ less-cli deploy invoice-microservice | ||
``` | ||
USAGE | ||
$ less-cli help [COMMANDS] [-n] | ||
--- | ||
ARGUMENTS | ||
COMMANDS Command to show help for. | ||
Do more with Less. | ||
🇨🇻 | ||
FLAGS | ||
-n, --nested-commands Include all nested commands in the output. | ||
DESCRIPTION | ||
Display help for less-cli. | ||
``` | ||
<!-- commandsstop --> | ||
Do more with Less. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env node | ||
|
||
const oclif = require('@oclif/core') | ||
|
||
const path = require('path') | ||
const project = path.join(__dirname, '..', 'tsconfig.json') | ||
|
||
// In dev mode -> use ts-node and dev plugins | ||
process.env.NODE_ENV = 'development' | ||
|
||
require('ts-node').register({project}) | ||
|
||
// In dev mode, always show stack traces | ||
oclif.settings.debug = true; | ||
|
||
// Start the CLI | ||
oclif.run().then(oclif.flush).catch(oclif.Errors.handle) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
|
||
node "%~dp0\dev" %* |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env node | ||
|
||
const oclif = require('@oclif/core') | ||
|
||
oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
|
||
node "%~dp0\run" %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Args, Command } from '@oclif/core'; | ||
import chalk from 'chalk'; | ||
import deploy from '../../helpers/deploy'; | ||
|
||
export default class Deploy extends Command { | ||
static description = 'Deploy your less project' | ||
|
||
static examples = [ | ||
'$ less-cli deploy my-awesome-api', | ||
] | ||
|
||
static flags = {} | ||
|
||
static args = { | ||
projectName: Args.string({ description: 'Name of your project', required: true }), | ||
} | ||
|
||
async run(): Promise<void> { | ||
const { args } = await this.parse(Deploy); | ||
const projectName = args.projectName; | ||
|
||
if (!/^[A-Za-z][\dA-Za-z-]*$/.test(projectName)) { | ||
console.log(chalk.redBright('Error:'), 'The projectName must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]'); | ||
this.exit(1); | ||
} | ||
|
||
if (!process.env.LESS_TOKEN) { | ||
console.log(chalk.redBright('Error:'), 'Environment variable LESS_TOKEN must be defined'); | ||
this.exit(1); | ||
} | ||
|
||
await deploy(projectName); | ||
} | ||
} |
Oops, something went wrong.