diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a4467e..69b3e08 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,20 +12,12 @@ stages: - release - metadata +before_script: + - npm install -g @shipzone/npmci + # ==================== # security stage # ==================== -mirror: - stage: security - script: - - npmci git mirror - only: - - tags - tags: - - lossless - - docker - - notpriv - auditProductionDependencies: image: registry.gitlab.com/hosttoday/ht-docker-node:npmci stage: security @@ -36,6 +28,7 @@ auditProductionDependencies: - npmci command npm audit --audit-level=high --only=prod --production tags: - docker + allow_failure: true auditDevDependencies: image: registry.gitlab.com/hosttoday/ht-docker-node:npmci @@ -96,10 +89,9 @@ codequality: only: - tags script: - - npmci command npm install -g tslint typescript + - npmci command npm install -g typescript - npmci npm prepare - npmci npm install - - npmci command "tslint -c tslint.json ./ts/**/*.ts" tags: - lossless - docker @@ -119,11 +111,10 @@ trigger: pages: stage: metadata script: - - npmci node install lts - - npmci command npm install -g @gitzone/tsdoc + - npmci node install stable - npmci npm prepare - npmci npm install - - npmci command tsdoc + - npmci command npm run buildDocs tags: - lossless - docker diff --git a/.vscode/launch.json b/.vscode/launch.json index 112db52..26e9f92 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,28 +2,10 @@ "version": "0.2.0", "configurations": [ { - "name": "current file", - "type": "node", + "command": "npm test", + "name": "Run npm test", "request": "launch", - "args": [ - "${relativeFile}" - ], - "runtimeArgs": ["-r", "@gitzone/tsrun"], - "cwd": "${workspaceRoot}", - "protocol": "inspector", - "internalConsoleOptions": "openOnSessionStart" - }, - { - "name": "test.ts", - "type": "node", - "request": "launch", - "args": [ - "test/test.ts" - ], - "runtimeArgs": ["-r", "@gitzone/tsrun"], - "cwd": "${workspaceRoot}", - "protocol": "inspector", - "internalConsoleOptions": "openOnSessionStart" + "type": "node-terminal" } ] } diff --git a/package.json b/package.json index d63bfaa..38ca582 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "type": "module", "scripts": { "test": "(tstest test/ --web)", - "build": "(tsbuild --web)" + "build": "(tsbuild --web)", + "buildDocs": "tsdoc" }, "repository": { "type": "git", @@ -58,4 +59,4 @@ "browserslist": [ "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 60ec051..b1d4f73 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartcli', - version: '4.0.0', + version: '4.0.1', description: 'easy observable cli tasks' } diff --git a/ts/smartcli.classes.smartcli.ts b/ts/smartcli.classes.smartcli.ts index 8ed3bec..0ae593c 100644 --- a/ts/smartcli.classes.smartcli.ts +++ b/ts/smartcli.classes.smartcli.ts @@ -16,8 +16,7 @@ export class Smartcli { * this Deferred contains the parsed result in the end */ public parseCompleted = plugins.smartpromise.defer(); - - + public version: string; private checkForEnvCliCall = true; @@ -29,7 +28,7 @@ export class Smartcli { /** * maps alias */ - public aliasObject: {[key: string]: string[]} = {}; + public aliasObject: { [key: string]: string[] } = {}; /** * The constructor of Smartcli @@ -46,7 +45,7 @@ export class Smartcli { /** * adds an alias, meaning one equals the other in terms of command execution. */ - public addCommandAlias(originalArg, aliasArg): void { + public addCommandAlias(originalArg: string, aliasArg: string): void { this.aliasObject[originalArg] = this.aliasObject[originalArg] || []; this.aliasObject[originalArg].push(aliasArg); } @@ -58,12 +57,12 @@ export class Smartcli { public addCommand(commandNameArg: string): plugins.smartrx.rxjs.Subject { let commandSubject: plugins.smartrx.rxjs.Subject; const existingCommandSubject = this.getCommandSubject(commandNameArg); - commandSubject = existingCommandSubject || new plugins.smartrx.rxjs.Subject(); - + commandSubject = existingCommandSubject || new plugins.smartrx.rxjs.Subject(); + this.commandObservableMap.add({ commandName: commandNameArg, subject: commandSubject, - }) + }); return commandSubject; } @@ -105,7 +104,7 @@ export class Smartcli { public addVersion(versionArg: string) { this.version = versionArg; this.addCommandAlias('v', 'version'); - this.parseCompleted.promise.then(argv => { + this.parseCompleted.promise.then((argv) => { if (argv.v) { console.log(this.version); } @@ -132,12 +131,12 @@ export class Smartcli { return; } const parsedYArgs = plugins.yargsParser(process.argv); - + // lets handle commands let counter = 0; let foundCommand = false; parsedYArgs._.map((commandPartArg) => { - counter ++; + counter++; if (typeof commandPartArg === 'number') { return true; } @@ -148,17 +147,17 @@ export class Smartcli { } else { return true; } - }) + }); for (const command of this.commandObservableMap.getArray()) { if (!parsedYArgs._[0]) { - const standardCommand = this.commandObservableMap.findSync(commandArg => { - return commandArg.commandName === "standardCommand"; + const standardCommand = this.commandObservableMap.findSync((commandArg) => { + return commandArg.commandName === 'standardCommand'; }); if (standardCommand) { standardCommand.subject.next(parsedYArgs); } else { console.log('no smartcli standard task was created or assigned.'); - }; + } break; } if (command.commandName === parsedYArgs._[0]) { @@ -166,7 +165,6 @@ export class Smartcli { break; } if (this.aliasObject[parsedYArgs[0]]) { - } } this.parseCompleted.resolve(parsedYArgs); diff --git a/ts/smartcli.plugins.ts b/ts/smartcli.plugins.ts index 585d8a2..90730e5 100644 --- a/ts/smartcli.plugins.ts +++ b/ts/smartcli.plugins.ts @@ -11,6 +11,4 @@ export { smartlog, lik, path, smartparam, smartpromise, smartrx }; // thirdparty scope import yargsParser from 'yargs-parser'; -export { - yargsParser -} +export { yargsParser };