diff --git a/.gitignore b/.gitignore index 85c4869..91c0db0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,22 @@ -node_modules/ +.nogit/ + +# artifacts +coverage/ public/ pages/ -coverage/ + +# installs +node_modules/ + +# caches +.yarn/ +.cache/ +.rpt2_cache + +# builds +dist/ +dist_web/ +dist_serve/ +dist_ts_web/ + +# custom \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a1d614e..a95dfb6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,16 +1,16 @@ -# gitzone standard -image: hosttoday/ht-docker-node:npmci +# gitzone ci_default +image: registry.gitlab.com/hosttoday/ht-docker-node:npmci cache: paths: - - .npmci_cache/ - key: "$CI_BUILD_STAGE" + - .npmci_cache/ + key: '$CI_BUILD_STAGE' stages: -- security -- test -- release -- metadata + - security + - test + - release + - metadata # ==================== # security stage @@ -18,109 +18,103 @@ stages: mirror: stage: security script: - - npmci git mirror + - npmci git mirror tags: - - docker - - notpriv + - lossless + - docker + - notpriv snyk: + image: registry.gitlab.com/hosttoday/ht-docker-node:snyk stage: security script: - - npmci command npm install -g snyk + - npmci npm prepare - npmci command npm install --ignore-scripts - npmci command snyk test tags: - - docker - - notpriv + - lossless + - docker + - notpriv # ==================== # test stage # ==================== -testLEGACY: - stage: test - script: - - npmci node install legacy - - npmci npm install - - npmci npm test - coverage: /\d+.?\d+?\%\s*coverage/ - tags: - - docker - - notpriv - allow_failure: true -testLTS: +testStable: stage: test script: - - npmci node install lts - - npmci npm install - - npmci npm test + - npmci npm prepare + - npmci node install stable + - npmci npm install + - npmci npm test coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker - - notpriv - -testSTABLE: + - lossless + - docker + - priv + +testBuild: stage: test script: - - npmci node install stable - - npmci npm install - - npmci npm test + - npmci npm prepare + - npmci node install stable + - npmci npm install + - npmci command npm run build coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker - - notpriv + - lossless + - docker + - notpriv release: stage: release script: - - npmci node install stable - - npmci npm publish + - npmci node install stable + - npmci npm publish only: - - tags + - tags tags: - - docker - - notpriv + - lossless + - docker + - notpriv # ==================== # metadata stage # ==================== codequality: stage: metadata - image: docker:stable allow_failure: true - services: - - docker:stable-dind script: - - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - - docker run - --env SOURCE_CODE="$PWD" - --volume "$PWD":/code - --volume /var/run/docker.sock:/var/run/docker.sock - "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code - artifacts: - paths: [codeclimate.json] + - npmci command npm install -g tslint typescript + - npmci npm prepare + - npmci npm install + - npmci command "tslint -c tslint.json ./ts/**/*.ts" tags: - - docker - - priv + - lossless + - docker + - priv trigger: stage: metadata script: - - npmci trigger + - npmci trigger only: - - tags + - tags tags: - - docker - - notpriv + - lossless + - docker + - notpriv pages: - image: hosttoday/ht-docker-node:npmci stage: metadata script: - - npmci command npm install -g typedoc typescript + - npmci node install lts + - npmci command npm install -g @gitzone/tsdoc + - npmci npm prepare - npmci npm install - - npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/ + - npmci command tsdoc tags: + - lossless - docker - notpriv only: @@ -128,15 +122,5 @@ pages: artifacts: expire_in: 1 week paths: - - public - allow_failure: true - -windowsCompatibility: - image: stefanscherer/node-windows:10-build-tools - stage: metadata - script: - - npm install & npm test - coverage: /\d+.?\d+?\%\s*coverage/ - tags: - - windows + - public allow_failure: true diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..112db52 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "current file", + "type": "node", + "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" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..01d2b8d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,26 @@ +{ + "json.schemas": [ + { + "fileMatch": ["/npmextra.json"], + "schema": { + "type": "object", + "properties": { + "npmci": { + "type": "object", + "description": "settings for npmci" + }, + "gitzone": { + "type": "object", + "description": "settings for gitzone", + "properties": { + "projectType": { + "type": "string", + "enum": ["website", "element", "service", "npm"] + } + } + } + } + } + } + ] +} diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 8f1e85b..0000000 --- a/docs/index.md +++ /dev/null @@ -1,35 +0,0 @@ -# smartinteract - -smart cli interaction - -## Availabililty - -[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartinteract) -[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartinteract) -[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartinteract) -[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartinteract/) - -## Status for master - -[![build status](https://GitLab.com/pushrocks/smartinteract/badges/master/build.svg)](https://GitLab.com/pushrocks/smartinteract/commits/master) -[![coverage report](https://GitLab.com/pushrocks/smartinteract/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartinteract/commits/master) -[![npm downloads per month](https://img.shields.io/npm/dm/smartinteract.svg)](https://www.npmjs.com/package/smartinteract) -[![Dependency Status](https://david-dm.org/pushrocks/smartinteract.svg)](https://david-dm.org/pushrocks/smartinteract) -[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartinteract/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartinteract/master/dependencies/npm) -[![bitHound Code](https://www.bithound.io/github/pushrocks/smartinteract/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartinteract) -[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) -[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) -[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) - -## Usage - -Use TypeScript for best in class instellisense. - - - -For further information read the linked docs at the top of this README. - -> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) - -[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) diff --git a/npmextra.json b/npmextra.json index 8dafa1c..49012dc 100644 --- a/npmextra.json +++ b/npmextra.json @@ -1,6 +1,17 @@ { + "gitzone": { + "projectType": "npm", + "module": { + "githost": {}, + "gitscope": {}, + "gitrepo": {}, + "shortDescription": {}, + "npmPackagename": {}, + "license": {} + } + }, "npmci": { - "npmGlobalTools": ["npmts"], + "npmGlobalTools": [], "npmAccessLevel": "public" } -} +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ecd663c..e593058 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,14 +63,15 @@ } }, "@pushrocks/lik": { - "version": "3.0.13", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.13.tgz", - "integrity": "sha512-YDxYoh2UksEfUxcjSjTwLsW5j852E5FrMG62CUi1I7ZpBxf96b7P1t2pRWsQsNnHRz6FHckW/A1V6XKASB+jZA==", + "version": "3.0.17", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.17.tgz", + "integrity": "sha512-Ip56GDuW/ReBPhRVIhaqosqXu12SBW1DT3GkY8hOTiF1YNdKxiaw13QOPva6KPeTffb9DTThOu352KvjMrfxRw==", "requires": { "@pushrocks/smartdelay": "^2.0.6", "@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartrx": "^2.0.5", "@pushrocks/smarttime": "^3.0.12", + "@pushrocks/smartunique": "^3.0.1", "@types/minimatch": "^3.0.3", "minimatch": "^3.0.4", "symbol-tree": "^3.2.4" @@ -209,6 +210,17 @@ "luxon": "^1.16.0" } }, + "@pushrocks/smartunique": { + "version": "3.0.1", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartunique/-/smartunique-3.0.1.tgz", + "integrity": "sha512-xBu9ZB4C0BA0S/pbFFZn2ItPfnodPKpzrYIq1yN5XDs6OaookwcDF/iBwfS9+EYMSPENC9wAsOxg2RGMm4Qicw==", + "requires": { + "@types/shortid": "^0.0.29", + "@types/uuid": "^3.0.0", + "shortid": "^2.2.8", + "uuid": "^3.1.0" + } + }, "@pushrocks/tapbundle": { "version": "3.2.0", "resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.0.tgz", @@ -401,7 +413,7 @@ }, "@types/minimatch": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "resolved": "https://verdaccio.lossless.one/@types%2fminimatch/-/minimatch-3.0.3.tgz", "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { @@ -409,6 +421,11 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.3.tgz", "integrity": "sha512-jQ1p+SyF/z8ygPxfSPKZKMWazlCgTBSyIaC1UCUvkLHDdxdmPQtQFk02X4WFM31Z1BKMAS3MSAK0cRP2c92n6Q==" }, + "@types/shortid": { + "version": "0.0.29", + "resolved": "https://verdaccio.lossless.one/@types%2fshortid/-/shortid-0.0.29.tgz", + "integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=" + }, "@types/through": { "version": "0.0.30", "resolved": "https://verdaccio.lossless.one/@types%2fthrough/-/through-0.0.30.tgz", @@ -426,6 +443,11 @@ "@types/node": "*" } }, + "@types/uuid": { + "version": "3.4.7", + "resolved": "https://verdaccio.lossless.one/@types%2fuuid/-/uuid-3.4.7.tgz", + "integrity": "sha512-C2j2FWgQkF1ru12SjZJyMaTPxs/f6n90+5G5qNakBxKXjTBc/YTSelHh4Pz1HUDwxFXD9WvpQhOGCDC+/Y4mIQ==" + }, "agentkeepalive": { "version": "4.1.0", "resolved": "https://verdaccio.lossless.one/agentkeepalive/-/agentkeepalive-4.1.0.tgz", @@ -960,6 +982,11 @@ "resolved": "https://verdaccio.lossless.one/mute-stream/-/mute-stream-0.0.8.tgz", "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" }, + "nanoid": { + "version": "2.1.11", + "resolved": "https://verdaccio.lossless.one/nanoid/-/nanoid-2.1.11.tgz", + "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -1072,6 +1099,14 @@ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, + "shortid": { + "version": "2.2.15", + "resolved": "https://verdaccio.lossless.one/shortid/-/shortid-2.2.15.tgz", + "integrity": "sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw==", + "requires": { + "nanoid": "^2.1.0" + } + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -1275,6 +1310,11 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "uuid": { + "version": "3.4.0", + "resolved": "https://verdaccio.lossless.one/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index a98d39a..8590e8b 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "homepage": "https://gitlab.com/pushrocks/smartinteract#README", "dependencies": { - "@pushrocks/lik": "^3.0.13", + "@pushrocks/lik": "^3.0.17", "@pushrocks/smartparam": "^1.1.6", "@pushrocks/smartpromise": "^3.0.6", "@types/inquirer": "^6.5.0", @@ -36,5 +36,16 @@ "@pushrocks/tapbundle": "^3.2.0", "tslint": "^6.0.0", "tslint-config-prettier": "^1.18.0" - } + }, + "files": [ + "ts/**/*", + "ts_web/**/*", + "dist/**/*", + "dist_web/**/*", + "dist_ts_web/**/*", + "assets/**/*", + "cli.js", + "npmextra.json", + "readme.md" + ] } diff --git a/readme.md b/readme.md index 14c3dbc..c81a9b8 100644 --- a/readme.md +++ b/readme.md @@ -1,25 +1,20 @@ -# smartinteract +# @[object Object]/[object Object] +[object Object] -smart cli interaction - -## Availabililty - -[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartinteract) -[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartinteract) -[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartinteract) -[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartinteract/) +## Availabililty and Links +* [npmjs.org (npm package)](https://www.npmjs.com/package/[object Object]) +* [gitlab.com (source)](https://[object Object]/[object Object]/[object Object]) +* [github.com (source mirror)](https://github.com/[object Object]/[object Object]) +* [docs (typedoc)](https://[object Object].gitlab.io/[object Object]/) ## Status for master - -[![build status](https://GitLab.com/pushrocks/smartinteract/badges/master/build.svg)](https://GitLab.com/pushrocks/smartinteract/commits/master) -[![coverage report](https://GitLab.com/pushrocks/smartinteract/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartinteract/commits/master) -[![npm downloads per month](https://img.shields.io/npm/dm/smartinteract.svg)](https://www.npmjs.com/package/smartinteract) -[![Dependency Status](https://david-dm.org/pushrocks/smartinteract.svg)](https://david-dm.org/pushrocks/smartinteract) -[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartinteract/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartinteract/master/dependencies/npm) -[![bitHound Code](https://www.bithound.io/github/pushrocks/smartinteract/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartinteract) -[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) -[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) -[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) +[![pipeline status](https://[object Object]/[object Object]/[object Object]/badges/master/pipeline.svg)](https://[object Object]/[object Object]/[object Object]/commits/master) +[![coverage report](https://[object Object]/[object Object]/[object Object]/badges/master/coverage.svg)](https://[object Object]/[object Object]/[object Object]/commits/master) +[![npm downloads per month](https://img.shields.io/npm/dm/[object Object].svg)](https://www.npmjs.com/package/[object Object]) +[![Known Vulnerabilities](https://snyk.io/test/npm/[object Object]/badge.svg)](https://snyk.io/test/npm/[object Object]) +[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) +[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) +[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/) ## Usage @@ -56,7 +51,7 @@ myInteract.askQuestion{ // note: its an array. You can specify multiple question For further information read the linked docs at the top of this readme. -> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) +> [object Object] licensed | **©** [Lossless GmbH](https://lossless.gmbh) +| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) -[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) +[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) diff --git a/ts/index.ts b/ts/index.ts index b37afc9..f65df57 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,2 +1,2 @@ export * from './smartinteract.classes.smartinteract'; -export * from './smartinteract.classes.answerbucket'; \ No newline at end of file +export * from './smartinteract.classes.answerbucket'; diff --git a/ts/smartinteract.classes.smartinteract.ts b/ts/smartinteract.classes.smartinteract.ts index 44818e4..14d521b 100644 --- a/ts/smartinteract.classes.smartinteract.ts +++ b/ts/smartinteract.classes.smartinteract.ts @@ -16,7 +16,7 @@ export type questionType = | 'editor'; /** - * a choice + * a choice */ export interface IChoiceObject { name: string; @@ -63,7 +63,7 @@ export class SmartInteract { * skips the queue */ askQuestion(optionsArg: IQuestionObject): Promise { - let done = smartpromise.defer(); + const done = smartpromise.defer(); if (this.isValidEnv()) { plugins.inquirer .prompt([ @@ -76,9 +76,9 @@ export class SmartInteract { validate: optionsArg.validate } ]) - .then((answers) => { + .then(answers => { // adjust to the fact that now dots define paths for inquirer - let answerValue = plugins.smartparam.smartGet(answers, optionsArg.name); + const answerValue = plugins.smartparam.smartGet(answers, optionsArg.name); done.resolve({ name: optionsArg.name, value: answerValue @@ -88,7 +88,7 @@ export class SmartInteract { console.log(err); }); } else { - let answer: IAnswerObject = { + const answer: IAnswerObject = { name: optionsArg.name, value: optionsArg.default }; @@ -109,12 +109,12 @@ export class SmartInteract { * run the question queue */ runQueue() { - let done = smartpromise.defer(); - let answerBucket = new AnswerBucket(); - let handleQuestion = async () => { + const done = smartpromise.defer(); + const answerBucket = new AnswerBucket(); + const handleQuestion = async () => { if (!this.questionMap.isEmpty()) { - let oneQuestion = this.questionMap.getOneAndRemove(); - let answer: IAnswerObject = await this.askQuestion(oneQuestion); + const oneQuestion = this.questionMap.getOneAndRemove(); + const answer: IAnswerObject = await this.askQuestion(oneQuestion); answerBucket.addAnswer(answer); handleQuestion(); // recursion: as questions until empty } else { diff --git a/ts/smartinteract.plugins.ts b/ts/smartinteract.plugins.ts index 724c04a..18cc021 100644 --- a/ts/smartinteract.plugins.ts +++ b/ts/smartinteract.plugins.ts @@ -2,11 +2,7 @@ import * as lik from '@pushrocks/lik'; import * as smartparam from '@pushrocks/smartparam'; -export { - lik, - smartparam -} - +export { lik, smartparam }; // third party scope import * as inquirer from 'inquirer'; diff --git a/tslint.json b/tslint.json index 566dd3b..d4ea2e9 100644 --- a/tslint.json +++ b/tslint.json @@ -1,7 +1,17 @@ { - "extends": ["tslint:latest", "tslint-config-prettier"], - "rules": { - "semicolon": [true, "always"] + "extends": ["tslint:latest", "tslint-config-prettier"], + "rules": { + "semicolon": [true, "always"], + "no-console": false, + "ordered-imports": false, + "object-literal-sort-keys": false, + "member-ordering": { + "options":{ + "order": [ + "static-method" + ] + } } - } - \ No newline at end of file + }, + "defaultSeverity": "warning" +}