Skip to content

Commit

Permalink
#10: Migrate to oclif
Browse files Browse the repository at this point in the history
  • Loading branch information
FabyoSK committed Sep 13, 2023
1 parent 0be7813 commit d8ed506
Show file tree
Hide file tree
Showing 26 changed files with 7,106 additions and 463 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dist
10 changes: 10 additions & 0 deletions .eslintrc
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"]
}
}
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ node_modules/
.DS_Store

# Log files
*.log
*.log

*-debug.log
*-error.log
/.idea
/.nyc_output
/dist
/lib
/package-lock.json
/tmp
oclif.manifest.json
12 changes: 12 additions & 0 deletions .mocharc.json
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
}
94 changes: 79 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,100 @@
[![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)
* [`less-cli template add`](#less-cli-template-add)

## `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.

```
USAGE
$ less-cli help [COMMANDS] [-n]
ARGUMENTS
COMMANDS Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for less-cli.
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.19/src/commands/help.ts)_

## `less-cli template add`

Use templates to help you get your boilerplate code set up for common tasks.

```bash
$ export LESS_TOKEN=your-less-token
$ less-cli deploy invoice-microservice
```
USAGE
$ less-cli template add [-n <value>]
---
FLAGS
-n, --name=<value> The template you want to add. Options are "mongodb-js-shared-client".
DESCRIPTION
Use templates to help you get your boilerplate code set up for common tasks.
EXAMPLES
$ less-cli template add --name awesome-template
```

Do more with Less.
_See code: [dist/commands/template/add.ts](https://github.com/chuva-io/less-cli/blob/v1.0.0-beta.5/dist/commands/template/add.ts)_
<!-- commandsstop -->
Do more with Less.
🇨🇻
17 changes: 17 additions & 0 deletions bin/dev
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)
3 changes: 3 additions & 0 deletions bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\dev" %*
59 changes: 0 additions & 59 deletions bin/index.js

This file was deleted.

5 changes: 5 additions & 0 deletions bin/run
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'))
3 changes: 3 additions & 0 deletions bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
89 changes: 66 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,74 @@
"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",
"bin": {
"less-cli": "./bin/run"
},
"url": "https://github.com/chuva-io/less-cli.git",
"homepage": "https://bit.ly/less-framework",
"type": "module",
"exports": "./bin/index.js",
"bin": {
"less-cli": "bin/index.js"
"license": "Apache-2.0",
"main": "dist/index.js",
"repository": "chuva-io/less-cli",
"files": [
"/bin",
"/dist",
"/npm-shrinkwrap.json",
"/oclif.manifest.json"
],
"dependencies": {
"@oclif/core": "^2",
"@oclif/plugin-help": "^5",
"@oclif/plugin-plugins": "^3.5.0",
"adm-zip": "^0.5.10",
"axios": "^1.4.0",
"chalk": "4.1.0",
"glob": "^10.3.4",
"js-yaml": "^4.1.0",
"ora": "^5.0.0",
"ws": "^8.13.0"
},
"devDependencies": {
"@oclif/test": "^2.5.3",
"@types/chai": "^4",
"@types/mocha": "^9.0.0",
"@types/node": "^16.18.50",
"chai": "^4",
"eslint": "^7.32.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-oclif": "^4",
"eslint-config-oclif-typescript": "^1.0.3",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"mocha": "^9",
"oclif": "^3.15.0",
"shx": "^0.3.3",
"ts-node": "^10.9.1",
"tslib": "^2.6.2",
"typescript": "^4.9.5"
},
"oclif": {
"bin": "less-cli",
"dirname": "less-cli",
"commands": "./dist/commands",
"plugins": [
"@oclif/plugin-help"
],
"topicSeparator": " "
},
"scripts": {
"build": "shx rm -rf dist && tsc -b",
"dev":"yarn build && node ./bin/run",
"lint": "eslint . --ext .ts --config .eslintrc",
"postpack": "shx rm -f oclif.manifest.json",
"posttest": "yarn lint",
"prepack": "yarn build && oclif manifest && oclif readme",
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
"version": "oclif readme && git add README.md"
},
"engines": {
"node": ">=12.0.0"
},
"bugs": "https://github.com/chuva-io/less-cli/issues",
"keywords": [
"distributed",
"infinite scale",
Expand All @@ -36,22 +96,5 @@
"less",
"less-cli"
],
"dependencies": {
"adm-zip": "^0.5.10",
"axios": "^1.4.0",
"chalk": "^5.3.0",
"commander": "^11.0.0",
"glob": "^10.3.4",
"js-yaml": "^4.1.0",
"ora": "^7.0.1",
"ws": "^8.13.0"
},
"main": "bin/index.js",
"devDependencies": {},
"bugs": {
"url": "https://bitbucket.org/chuva-io/less-cli-client/issues"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
"types": "dist/index.d.ts"
}
Loading

0 comments on commit d8ed506

Please sign in to comment.