Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
b6375fd8fa | |||
8183417c90 | |||
5e66d35125 | |||
3ff4c3ff2f | |||
6508b29bfc | |||
66fd7138ab | |||
f3ce1c1408 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
|
.yarn/
|
||||||
|
@ -1,14 +1,22 @@
|
|||||||
image: hosttoday/ht-docker-node:npmts
|
# gitzone standard
|
||||||
|
image: hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- .yarn/
|
||||||
|
key: "$CI_BUILD_STAGE"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
- page
|
- trigger
|
||||||
|
- pages
|
||||||
|
|
||||||
testLEGACY:
|
testLEGACY:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test legacy
|
- npmci test legacy
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
@ -17,6 +25,7 @@ testLTS:
|
|||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test lts
|
- npmci test lts
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
@ -24,6 +33,7 @@ testSTABLE:
|
|||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test stable
|
- npmci test stable
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
@ -36,15 +46,26 @@ release:
|
|||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
pages:
|
trigger:
|
||||||
image: hosttoday/ht-docker-node:npmpage
|
stage: trigger
|
||||||
stage: page
|
|
||||||
script:
|
script:
|
||||||
- npmci test stable
|
- npmci trigger
|
||||||
- npmci command npmpage --host gitlab
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
pages:
|
||||||
|
image: hosttoday/ht-docker-node:npmci
|
||||||
|
stage: pages
|
||||||
|
script:
|
||||||
|
- npmci command yarn global add npmpage
|
||||||
|
- npmci command npmpage
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
3
dist/smartcli.classes.smartcli.d.ts
vendored
3
dist/smartcli.classes.smartcli.d.ts
vendored
@ -1,3 +1,4 @@
|
|||||||
|
import * as smartq from 'smartq';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { Objectmap } from 'lik';
|
import { Objectmap } from 'lik';
|
||||||
export interface ICommandPromiseObject {
|
export interface ICommandPromiseObject {
|
||||||
@ -11,7 +12,7 @@ export interface ITriggerObservableObject {
|
|||||||
export declare class Smartcli {
|
export declare class Smartcli {
|
||||||
argv: any;
|
argv: any;
|
||||||
questionsDone: any;
|
questionsDone: any;
|
||||||
parseStarted: any;
|
parseStarted: smartq.Deferred<any>;
|
||||||
commands: any;
|
commands: any;
|
||||||
questions: any;
|
questions: any;
|
||||||
version: string;
|
version: string;
|
||||||
|
7
npmextra.json
Normal file
7
npmextra.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"npmci": {
|
||||||
|
"globalNpmTools": [
|
||||||
|
"npmts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "smartcli",
|
"name": "smartcli",
|
||||||
"version": "2.0.2",
|
"version": "2.0.5",
|
||||||
"description": "nodejs wrapper for CLI related tasks",
|
"description": "nodejs wrapper for CLI related tasks",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
@ -35,7 +35,7 @@
|
|||||||
"rxjs": "^5.3.0",
|
"rxjs": "^5.3.0",
|
||||||
"smartparam": "0.1.1",
|
"smartparam": "0.1.1",
|
||||||
"smartq": "^1.1.1",
|
"smartq": "^1.1.1",
|
||||||
"typings-global": "^1.0.14",
|
"typings-global": "^1.0.16",
|
||||||
"yargs": "^7.1.0"
|
"yargs": "^7.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
36
test/test.ts
36
test/test.ts
@ -1,4 +1,5 @@
|
|||||||
import { tap, expect } from 'tapbundle'
|
import { tap, expect } from 'tapbundle'
|
||||||
|
import { Subject } from 'rxjs'
|
||||||
|
|
||||||
import smartcli = require('../dist/index')
|
import smartcli = require('../dist/index')
|
||||||
|
|
||||||
@ -7,38 +8,37 @@ let smartCliTestObject: smartcli.Smartcli
|
|||||||
tap.test('should create a new Smartcli', async () => {
|
tap.test('should create a new Smartcli', async () => {
|
||||||
smartCliTestObject = new smartcli.Smartcli()
|
smartCliTestObject = new smartcli.Smartcli()
|
||||||
return expect(smartCliTestObject).be.instanceof(smartcli.Smartcli)
|
return expect(smartCliTestObject).be.instanceof(smartcli.Smartcli)
|
||||||
})
|
}).catch(tap.threw)
|
||||||
|
|
||||||
|
|
||||||
tap.test('should add an command', async () => {
|
tap.test('should add an command', async () => {
|
||||||
smartCliTestObject.addCommand('awesome')
|
return expect(smartCliTestObject.addCommand('awesome')).to.not.throw
|
||||||
})
|
}).catch(tap.threw)
|
||||||
|
|
||||||
|
|
||||||
tap.test('should start parsing a standardTask', async () => {
|
tap.test('should start parsing a standardTask', async () => {
|
||||||
smartCliTestObject.standardTask()
|
return expect(smartCliTestObject.standardTask()).to.be.instanceOf(Promise)
|
||||||
.then(() => {
|
}).catch(tap.threw)
|
||||||
console.log('this is the standard Task!')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
let hasExecuted: boolean = false
|
let hasExecuted: boolean = false
|
||||||
|
|
||||||
tap.test('should accept a command', async () => {
|
tap.test('should accept a command', async () => {
|
||||||
smartCliTestObject.addTrigger('triggerme')
|
smartCliTestObject.addTrigger('triggerme')
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
hasExecuted = true
|
hasExecuted = true
|
||||||
})
|
})
|
||||||
})
|
return expect(smartCliTestObject.addTrigger('triggerme')).to.be.instanceof(Subject)
|
||||||
|
}).catch(tap.threw)
|
||||||
|
|
||||||
tap.test('should not have executed yet', async () => {
|
tap.test('should not have executed yet', async () => {
|
||||||
expect(hasExecuted).to.be.false
|
return expect(hasExecuted).to.be.false
|
||||||
})
|
}).catch(tap.threw)
|
||||||
|
|
||||||
tap.test('should execute when triggered', async () => {
|
tap.test('should execute when triggered', async () => {
|
||||||
smartCliTestObject.trigger('triggerme')
|
smartCliTestObject.trigger('triggerme')
|
||||||
expect(hasExecuted).be.true
|
return expect(hasExecuted).be.true
|
||||||
})
|
}).catch(tap.threw)
|
||||||
|
|
||||||
|
/*tap.test('should start parsing the CLI input', async () => {
|
||||||
tap.test('should start parsing the CLI input', async () => {
|
|
||||||
smartCliTestObject.startParse()
|
smartCliTestObject.startParse()
|
||||||
})
|
return await expect(smartCliTestObject.parseStarted.promise).to.eventually.be.fulfilled
|
||||||
|
}).catch(tap.threw)*/
|
||||||
|
@ -20,7 +20,7 @@ export interface ITriggerObservableObject {
|
|||||||
export class Smartcli {
|
export class Smartcli {
|
||||||
argv: any
|
argv: any
|
||||||
questionsDone
|
questionsDone
|
||||||
parseStarted
|
parseStarted: smartq.Deferred<any>
|
||||||
commands
|
commands
|
||||||
questions
|
questions
|
||||||
version: string
|
version: string
|
||||||
|
16
yarn.lock
16
yarn.lock
@ -1598,7 +1598,7 @@ set-blocking@^2.0.0:
|
|||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
||||||
|
|
||||||
shelljs@^0.7.4:
|
shelljs@^0.7.7:
|
||||||
version "0.7.7"
|
version "0.7.7"
|
||||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1"
|
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1"
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -1899,12 +1899,12 @@ typed-promisify@^0.3.0:
|
|||||||
version "0.3.0"
|
version "0.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853"
|
resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853"
|
||||||
|
|
||||||
typings-global@^1.0.14, typings-global@^1.0.3:
|
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.3:
|
||||||
version "1.0.14"
|
version "1.0.16"
|
||||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.14.tgz#ab682720a03d6b9278869fb5c30c30d7dc61d12c"
|
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.16.tgz#489b71781af24268750c2899316400a5e482961f"
|
||||||
dependencies:
|
dependencies:
|
||||||
semver "^5.3.0"
|
semver "^5.3.0"
|
||||||
shelljs "^0.7.4"
|
shelljs "^0.7.7"
|
||||||
|
|
||||||
uglify-js@^2.6:
|
uglify-js@^2.6:
|
||||||
version "2.8.22"
|
version "2.8.22"
|
||||||
@ -1961,14 +1961,10 @@ window-size@0.1.0:
|
|||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
|
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
|
||||||
|
|
||||||
wordwrap@0.0.2:
|
wordwrap@0.0.2, wordwrap@~0.0.2:
|
||||||
version "0.0.2"
|
version "0.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
|
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
|
||||||
|
|
||||||
wordwrap@~0.0.2:
|
|
||||||
version "0.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
|
|
||||||
|
|
||||||
wrap-ansi@^2.0.0:
|
wrap-ansi@^2.0.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"
|
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"
|
||||||
|
Reference in New Issue
Block a user