Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: added command_not_found hook
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 20, 2018
1 parent bac0dac commit a5db89e
Show file tree
Hide file tree
Showing 8 changed files with 477 additions and 183 deletions.
13 changes: 7 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
- checkout
- restore_cache: &restore_cache
keys:
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum "scripts/circleci"}}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum "scripts/circleci"}}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum "scripts/circleci"}}-{{checksum ".circleci/config.yml"}}-master-
- run: ./scripts/circleci test
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/test"}}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/test"}}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/test"}}-{{checksum ".circleci/config.yml"}}-master-
- run: ./.circleci/test
- store_test_results:
path: ~/cli/reports
- save_cache: &save_cache
key: v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum "scripts/circleci"}}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
key: v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/test"}}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
paths:
- ~/cli/node_modules
- /usr/local/share/.cache/yarn
Expand All @@ -30,7 +30,8 @@ jobs:
steps:
- checkout
- restore_cache: *restore_cache
- run: ./scripts/circleci release
- run: yarn --frozen-lockfile
- run: ./node_modules/.bin/nps ci.release
- save_cache: *save_cache

workflows:
Expand Down
35 changes: 35 additions & 0 deletions .circleci/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

set -ex

PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH

if [[ ! -z "$GIT_EMAIL" ]] & [[ ! -z "$GIT_USERNAME" ]]; then
git config --global push.default simple
git config --global user.email "$GIT_EMAIL"
git config --global user.user "$GIT_USERNAME"
fi

git submodule sync
git submodule update --init --recursive

CLI_ENGINE_UTIL_YARN_ARGS="--frozen-lockfile"

if [[ "$CIRCLE_BRANCH" == greenkeeper/* ]]; then
CLI_ENGINE_GREENKEEPER_BRANCH=1
CLI_ENGINE_UTIL_YARN_ARGS=""
if [[ ! -x "$(command -v greenkeeper-lockfile-update)" ]]; then
yarn global add greenkeeper-lockfile@1
fi
greenkeeper-lockfile-update
fi

yarn install $CLI_ENGINE_UTIL_YARN_ARGS

if [[ "$CLI_ENGINE_GREENKEEPER_BRANCH" == 1 ]]; then
greenkeeper-lockfile-upload
fi

mkdir -p reports
./node_modules/.bin/nps ci
curl -s https://codecov.io/bash | bash
76 changes: 76 additions & 0 deletions package-scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const {concurrent, series} = require('nps-utils')

module.exports = {
scripts: {
build: 'rm -rf lib && tsc',
lint: {
default: concurrent.nps('lint.eslint', 'lint.commitlint', 'lint.tsc', 'lint.tslint'),
eslint: {
script: 'eslint .',
description: 'lint js files',
},
commitlint: {
script: 'commitlint --from origin/master',
description: 'ensure that commits are in valid conventional-changelog format',
},
tsc: {
script: 'tsc -p test --noEmit',
description: 'syntax check with tsc',
},
tslint: {
script: 'tslint -p test',
description: 'lint ts files',
},
},
test: {
default: {
script: concurrent.nps('lint', 'test.mocha'),
description: 'lint and run all tests',
},
mocha: {
script: 'mocha "test/**/*.test.ts"',
description: 'run all mocha tests',
},
},
ci: {
default: {
script: concurrent.nps(
'ci.mocha',
'ci.eslint',
'ci.tslint',
),
hiddenFromHelp: true,
},
mocha: {
default: {
script: series.nps('ci.mocha.test', 'ci.mocha.report'),
hiddenFromHelp: true,
},
test: {
script: 'MOCHA_FILE="reports/mocha.xml" nps "ci.mocha.nyc nps \\"test.mocha --reporter mocha-junit-reporter\\""',
hiddenFromHelp: true,
},
report: {
script: series.nps('ci.mocha.nyc report --reporter text-lcov > coverage.lcov'),
hiddenFromHelp: true,
},
nyc: {
script: 'nyc --nycrc-path node_modules/@dxcli/dev-nyc-config/.nycrc',
hiddenFromHelp: true,
},
},
eslint: {
script: series.nps('lint.eslint --format junit --output-file reports/eslint.xml'),
hiddenFromHelp: true,
},
tslint: {
script: series.nps('lint.tslint --format junit > reports/tslint.xml'),
hiddenFromHelp: true,
},
release: {
script: 'dxcli-dev-semantic-release',
hiddenFromHelp: true,
},
},
},
}
31 changes: 7 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
"read-pkg": "^3.0.0"
},
"devDependencies": {
"@dxcli/dev": "^1.1.3",
"@dxcli/dev-nyc-config": "^0.0.3",
"@dxcli/dev-semantic-release": "^0.0.3",
"@dxcli/dev-test": "^0.4.1",
"@dxcli/dev-test": "^0.6.0",
"@dxcli/dev-tslint": "^0.0.15",
"@heroku-cli/config-edit": "^1.0.4",
"@types/ansi-styles": "^2.0.30",
Expand All @@ -27,32 +26,17 @@
"@types/node": "^9.3.0",
"@types/read-pkg": "^3.0.0",
"chai": "^4.1.2",
"eslint": "^4.15.0",
"eslint": "^4.16.0",
"eslint-config-dxcli": "^1.1.4",
"husky": "^0.14.3",
"mocha": "^5.0.0",
"nps": "^5.7.1",
"nps-utils": "^1.5.0",
"nyc": "^11.4.1",
"rxjs": "^5.5.6",
"ts-node": "^4.1.0",
"typescript": "^2.6.2"
},
"dxcli": {
"workflows": {
"test": [
"eslint .",
"tsc -p test --noEmit",
"tslint -p test --exclude \"plugins/**\"",
"commitlint --from origin/master",
"mocha \"test/**/*.ts\""
],
"lint": [
"eslint .",
"tsc -p test --noEmit",
"tslint -p test --exclude \"plugins/**\"",
"commitlint --from origin/master"
]
}
},
"engines": {
"node": ">=8.0.0"
},
Expand All @@ -68,10 +52,9 @@
"repository": "dxcli/config",
"scripts": {
"commitmsg": "dxcli-dev-commitmsg",
"lint": "dxcli-dev lint",
"precommit": "dxcli-dev lint",
"prepare": "rm -rf lib && tsc",
"test": "dxcli-dev test"
"precommit": "nps lint",
"prepare": "nps build",
"test": "nps test"
},
"types": "lib/index.d.ts"
}
65 changes: 0 additions & 65 deletions scripts/circleci

This file was deleted.

1 change: 1 addition & 0 deletions src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {IPlugin, IPluginModule} from './plugin'
export interface Hooks {
init: {id: string}
update: {}
'command_not_found': {id: string},
'plugins:parse': {
module: IPluginModule
pjson: IPlugin
Expand Down
5 changes: 4 additions & 1 deletion test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
--require test/helpers/init.js
--require ts-node/register
--require source-map-support/register
--watch-extensions ts--recursive
--watch-extensions ts
--recursive
--reporter spec
--timeout 5000
Loading

0 comments on commit a5db89e

Please sign in to comment.