Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrote the cli with a new framework, that works. #2

Merged
merged 2 commits into from
Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true


[*.{js,jsx,json,babelrc,html,css,scss}]
indent_style = space
indent_size = 2
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Ignore
node_modules/
lib/
config.json

# Include
!src/lib
1 change: 1 addition & 0 deletions .nyc_output/8099aac905c5a2dfc9a752508fd3f6fe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions .nyc_output/8a3896d70b51ee14cce5b85aa1ff7b5f.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 0 additions & 1 deletion .sample-secrets

This file was deleted.

70 changes: 67 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
# shell-test
Create .secrets and add Github API token (See .sample-secrets)
To run: `./configurator.sh -e dev -p web`
config-cli
==========

This is a all purpose configurator for node & javascript apps

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/config-cli.svg)](https://npmjs.org/package/config-cli)
[![CircleCI](https://circleci.com/gh/Diwala/config-cli/tree/master.svg?style=shield)](https://circleci.com/gh/Diwala/config-cli/tree/master)
[![Codecov](https://codecov.io/gh/Diwala/config-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/Diwala/config-cli)
[![Downloads/week](https://img.shields.io/npm/dw/config-cli.svg)](https://npmjs.org/package/config-cli)
[![License](https://img.shields.io/npm/l/config-cli.svg)](https://github.com/Diwala/config-cli/blob/master/package.json)

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- usage -->
```sh-session
$ npm install -g configurator
```
<!-- usagestop -->
# Commands
<!-- commands -->
* [`configurator web [TOKEN] -e environment`](#configurator-hello-file)
* [`configurator help [COMMAND]`](#configurator-help-command)

## `configurator web [TOKEN] -e environment`

describe the command here

```
this is used by diwala to setup web platform config

USAGE
$ configurator web TOKEN

ARGUMENTS
TOKEN Github API token

OPTIONS
-e, --environment=environment [default: dev] environment to choose
-h, --help show CLI help

EXAMPLE
$ configurator web -e dev d589d6c3dc87d0df365110f12ce22d5b37b5awds
```

_See code: [src/commands/hello.ts](https://github.com/Diwala/config-cli/blob/v0.0.1/src/commands/hello.ts)_

## `configurator help [COMMAND]`

display help for configurator

```
USAGE
$ configurator help [COMMAND]

ARGUMENTS
COMMAND command to show help for

OPTIONS
--all see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.1.0/src/commands/help.ts)_
<!-- commandsstop -->
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

require('@oclif/command').run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/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" %*
99 changes: 0 additions & 99 deletions configurator.sh

This file was deleted.

62 changes: 62 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "configurator",
"description": "This is a all purpose configurator for node & javascript apps",
"version": "0.0.1",
"author": "Snorre lothar von Gohren Edwin @vongohren, Malith Wijenayake",
"bin": {
"configurator": "./bin/run"
},
"bugs": "https://github.com/Diwala/configurator/issues",
"dependencies": {
"@oclif/command": "^1",
"@oclif/config": "^1",
"@oclif/plugin-help": "^2",
"axios": "^0.18.0",
"ora": "^3.0.0",
"tslib": "^1"
},
"devDependencies": {
"@oclif/dev-cli": "^1",
"@oclif/test": "^1",
"@oclif/tslint": "^1",
"@types/chai": "^4",
"@types/mocha": "^5",
"@types/node": "^10",
"chai": "^4",
"globby": "^8",
"mocha": "^5",
"nyc": "^12",
"ts-node": "^7",
"tslint": "^5",
"typescript": "^3.0"
},
"engines": {
"node": ">=8.0.0"
},
"files": [
"/bin",
"/lib",
"/npm-shrinkwrap.json",
"/oclif.manifest.json"
],
"homepage": "https://github.com/Diwala/configurator",
"license": "MIT",
"main": "lib/index.js",
"oclif": {
"commands": "./lib/commands",
"bin": "configurator",
"plugins": [
"@oclif/plugin-help"
]
},
"repository": "Diwala/configurator",
"scripts": {
"postpack": "rm -f oclif.manifest.json npm-shrinkwrap.json",
"posttest": "tsc -p test --noEmit && tslint -p test -t stylish",
"prepack": "rm -rf lib && tsc && oclif-dev manifest && oclif-dev readme && npm shrinkwrap",
"prepare": "rm -rf lib && tsc",
"test": "nyc mocha --forbid-only \"test/**/*.test.ts\"",
"version": "oclif-dev readme && git add README.md"
},
"types": "lib/index.d.ts"
}
33 changes: 33 additions & 0 deletions src/commands/mobile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {Command, flags} from '@oclif/command'
import validateAndPullFile from '../lib/validateAndPullFile';
import { Platform, Environment } from '../lib/configs';

export default class Mobile extends Command {
static description = 'this is used by diwala to setup mobile config'

static examples = [
`$ configurator mobile -e dev d589d6c3dc87d0df365110f12ce22d5b37b5awds
`,
]

static flags = {
help: flags.help({char: 'h'}),
environment: flags.string({
char: 'e',
description: 'environment to choose',
required: false,
default: 'dev'
}),
}

static args = [{
name: 'token',
required:true,
description:'Github API token'
}]

async run() {
const {args, flags} = this.parse(Mobile)
await validateAndPullFile(this, args.token, <string>flags.environment, Platform.MOBILE)
}
}
33 changes: 33 additions & 0 deletions src/commands/web.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {Command, flags} from '@oclif/command'
import validateAndPullFile from '../lib/validateAndPullFile';
import { Platform, Environment } from '../lib/configs';

export default class Web extends Command {
static description = 'this is used by diwala to setup web platform config'

static examples = [
`$ configurator web -e dev d589d6c3dc87d0df365110f12ce22d5b37b5awds
`,
]

static flags = {
help: flags.help({char: 'h'}),
environment: flags.string({
char: 'e',
description: 'environment to choose',
required: false,
default: 'dev'
}),
}

static args = [{
name: 'token',
required:true,
description:'Github API token'
}]

async run() {
const {args, flags} = this.parse(Web)
await validateAndPullFile(this, args.token, <string>flags.environment, Platform.WEB)
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {run} from '@oclif/command'
Loading