forked from oclif/plugin-plugins
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a915cec
Showing
23 changed files
with
5,173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
version: 2 | ||
jobs: | ||
node-latest: &test | ||
docker: | ||
- image: node:latest | ||
working_directory: ~/cli | ||
steps: | ||
- checkout | ||
- restore_cache: &restore_cache | ||
keys: | ||
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}} | ||
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}- | ||
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-master- | ||
- run: ./.circleci/setup_git | ||
- run: ./.circleci/greenkeeper | ||
- run: yarn exec nps ci.test | ||
- run: curl -s https://codecov.io/bash | bash | ||
- store_test_results: | ||
path: ~/cli/reports | ||
- save_cache: &save_cache | ||
key: v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}} | ||
paths: | ||
- ~/cli/node_modules | ||
- /usr/local/share/.cache/yarn | ||
- /usr/local/share/.config/yarn | ||
node-8: | ||
<<: *test | ||
docker: | ||
- image: node:8 | ||
release: | ||
<<: *test | ||
steps: | ||
- add_ssh_keys | ||
- checkout | ||
- restore_cache: *restore_cache | ||
- run: ./.circleci/setup_git | ||
- run: yarn --frozen-lockfile | ||
- run: yarn exec nps ci.release | ||
- save_cache: *save_cache | ||
|
||
workflows: | ||
version: 2 | ||
"@dxcli/plugins": | ||
jobs: | ||
- node-latest | ||
- node-8 | ||
- release: | ||
context: org-global | ||
filters: | ||
branches: {only: master} | ||
requires: | ||
- node-latest | ||
- node-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "dxcli" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* text=auto | ||
*.js text eol=lf | ||
*.ts text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*-debug.log | ||
*-error.log | ||
/.nyc_output | ||
/coverage | ||
/coverage.lcov | ||
/lib | ||
/node_modules | ||
/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@dxcli/plugins | ||
============== | ||
|
||
plugins plugin for dxcli | ||
|
||
[![Version](https://img.shields.io/npm/v/@dxcli/plugins.svg)](https://npmjs.org/package/@dxcli/plugins) | ||
[![CircleCI](https://circleci.com/gh/dxcli/plugins/tree/master.svg?style=svg)](https://circleci.com/gh/dxcli/plugins/tree/master) | ||
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/dxcli/plugins?branch=master&svg=true)](https://ci.appveyor.com/project/heroku/plugins/branch/master) | ||
[![Codecov](https://codecov.io/gh/dxcli/plugins/branch/master/graph/badge.svg)](https://codecov.io/gh/dxcli/plugins) | ||
[![Greenkeeper](https://badges.greenkeeper.io/dxcli/plugins.svg)](https://greenkeeper.io/) | ||
[![Known Vulnerabilities](https://snyk.io/test/npm/@dxcli/plugins/badge.svg)](https://snyk.io/test/npm/@dxcli/plugins) | ||
[![Downloads/week](https://img.shields.io/npm/dw/@dxcli/plugins.svg)](https://npmjs.org/package/@dxcli/plugins) | ||
[![License](https://img.shields.io/npm/l/@dxcli/plugins.svg)](https://github.com/dxcli/plugins/blob/master/package.json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
environment: | ||
nodejs_version: "9" | ||
cache: | ||
- '%LOCALAPPDATA%\Yarn -> appveyor.yml' | ||
- node_modules -> yarn.lock | ||
|
||
install: | ||
- ps: Install-Product node $env:nodejs_version x64 | ||
- git submodule sync | ||
- git submodule update --init --recursive | ||
- git config --global user.email "[email protected]" | ||
- git config --global user.name "dxcli" | ||
- yarn | ||
test_script: | ||
- .\node_modules\.bin\nps ci.test | ||
after_test: | ||
- ps: | | ||
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH | ||
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh | ||
bash codecov.sh | ||
build: off | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
const { | ||
concurrent, | ||
crossEnv, | ||
ifNotWindows, | ||
ifWindows, | ||
mkdirp, | ||
series, | ||
setColors, | ||
} = require('nps-utils') | ||
const pjson = require('./package.json') | ||
const release = pjson.devDependencies.typedoc ? ['ci.release.semantic-release', 'ci.release.typedoc'] : ['ci.release.semantic-release'] | ||
const script = (script, description) => description ? {script, description} : {script} | ||
const hidden = script => ({script, hiddenFromHelp: true}) | ||
const unixOrWindows = (unix, windows) => series(ifNotWindows(unix), ifWindows(windows)) | ||
|
||
setColors(['dim']) | ||
|
||
let ciTests = [ | ||
'ci.test.eslint', | ||
'ci.test.mocha', | ||
'ci.test.tslint', | ||
] | ||
|
||
module.exports = { | ||
scripts: { | ||
build: 'rm -rf lib && tsc', | ||
lint: { | ||
default: concurrent.nps('lint.eslint', 'lint.commitlint', 'lint.tsc', 'lint.tslint'), | ||
eslint: script('eslint .', 'lint js files'), | ||
commitlint: script('commitlint --from origin/master', 'ensure that commits are in valid conventional-changelog format'), | ||
tsc: script('tsc -p test --noEmit', 'syntax check with tsc'), | ||
tslint: script('tslint -p test', 'lint ts files'), | ||
}, | ||
test: { | ||
default: script(concurrent.nps('lint', 'test.mocha'), 'lint and run all tests'), | ||
series: script(series.nps('lint', 'test.mocha'), 'lint and run all tests in series'), | ||
mocha: { | ||
default: script('mocha --forbid-only "test/**/*.test.ts"', 'run all mocha tests'), | ||
coverage: { | ||
default: hidden(series.nps('test.mocha.nyc nps test.mocha', 'test.mocha.coverage.report')), | ||
report: hidden(series('nps "test.mocha.nyc report --reporter text-lcov" > coverage.lcov')), | ||
}, | ||
junit: hidden(series( | ||
crossEnv('MOCHA_FILE="reports/mocha.xml" ') + series.nps('test.mocha.nyc nps \\"test.mocha --reporter mocha-junit-reporter\\"'), | ||
series.nps('test.mocha.coverage.report'), | ||
)), | ||
nyc: hidden('nyc --nycrc-path node_modules/@dxcli/dev-nyc-config/.nycrc'), | ||
}, | ||
}, | ||
ci: { | ||
test: { | ||
default: hidden(series( | ||
mkdirp('reports'), | ||
unixOrWindows( | ||
concurrent.nps(...ciTests), | ||
series.nps(...ciTests), | ||
), | ||
)), | ||
mocha: hidden( | ||
unixOrWindows( | ||
series.nps('test.mocha.junit'), | ||
series.nps('test.mocha.coverage'), | ||
) | ||
), | ||
eslint: hidden( | ||
unixOrWindows( | ||
series.nps('lint.eslint --format junit --output-file reports/eslint.xml'), | ||
series.nps('lint.eslint'), | ||
) | ||
), | ||
tslint: hidden( | ||
unixOrWindows( | ||
series.nps('lint.tslint --format junit > reports/tslint.xml'), | ||
series.nps('lint.tslint'), | ||
) | ||
), | ||
}, | ||
typedoc: hidden('typedoc --out /tmp/docs src/index.ts --excludeNotExported --mode file'), | ||
release: { | ||
default: hidden(series.nps(...release)), | ||
'semantic-release': hidden('semantic-release -e @dxcli/dev-semantic-release'), | ||
typedoc: hidden(series( | ||
'git clone -b gh-pages $CIRCLE_REPOSITORY_URL gh-pages', | ||
'nps ci.typedoc', | ||
'rm -rf ./gh-pages/*', | ||
'mv /tmp/docs/* ./gh-pages', | ||
'cd gh-pages && git add . && git commit -m "updates from $CIRCLE_SHA1 [skip ci]" && git push', | ||
)), | ||
}, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"name": "@dxcli/plugins", | ||
"description": "plugins plugin for dxcli", | ||
"version": "0.0.0", | ||
"author": "Jeff Dickey @jdxcode", | ||
"bugs": "https://github.com/jdxcode/plugins/issues", | ||
"dependencies": { | ||
"@dxcli/command": "^0.1.16", | ||
"cli-ux": "^3.1.5" | ||
}, | ||
"devDependencies": { | ||
"@dxcli/config": "^0.1.24", | ||
"@dxcli/dev-nyc-config": "^0.0.3", | ||
"@dxcli/dev-semantic-release": "^0.1.0", | ||
"@dxcli/dev-test": "^0.9.4", | ||
"@dxcli/dev-tslint": "^0.0.15", | ||
"@dxcli/engine": "^0.1.7", | ||
"@types/ansi-styles": "^2.0.30", | ||
"@types/chai": "^4.1.2", | ||
"@types/lodash": "^4.14.96", | ||
"@types/mocha": "^2.2.47", | ||
"@types/nock": "^9.1.2", | ||
"@types/node": "^9.3.0", | ||
"@types/read-pkg": "^3.0.0", | ||
"@types/strip-ansi": "^3.0.0", | ||
"chai": "^4.1.2", | ||
"eslint": "^4.16.0", | ||
"eslint-config-dxcli": "^1.1.4", | ||
"husky": "^0.14.3", | ||
"mocha": "^5.0.0", | ||
"mocha-junit-reporter": "^1.17.0", | ||
"nps": "^5.7.1", | ||
"nps-utils": "^1.5.0", | ||
"nyc": "^11.4.1", | ||
"ts-node": "^4.1.0", | ||
"typescript": "^2.6.2" | ||
}, | ||
"dxcli": { | ||
"commands": "./lib/commands", | ||
"hooks": { | ||
"init": "./lib/hooks/init" | ||
} | ||
}, | ||
"engines": { | ||
"node": ">=8.0.0" | ||
}, | ||
"files": [ | ||
"/lib" | ||
], | ||
"homepage": "https://github.com/jdxcode/plugins", | ||
"keywords": [ | ||
"dxcli-plugin" | ||
], | ||
"license": "MIT", | ||
"repository": "dxcli/plugins", | ||
"scripts": { | ||
"commitmsg": "dxcli-dev-commitmsg", | ||
"precommit": "nps lint", | ||
"prepare": "nps build", | ||
"test": "nps test" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Command, {flags} from '@dxcli/command' | ||
import cli from 'cli-ux' | ||
|
||
export default class CLI extends Command { | ||
static flags = { | ||
name: flags.string({char: 'n', description: 'name to print'}) | ||
} | ||
|
||
async run() { | ||
const name = this.flags.name || 'world' | ||
cli.log(`hello ${name}!`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import {Hooks, IHook} from '@dxcli/config' | ||
import cli from 'cli-ux' | ||
|
||
const hook: IHook<Hooks['init']> = async opts => { | ||
cli.info(`example hook running ${opts.id}\nDisable by deleting ./src/hooks/init.ts`) | ||
} | ||
|
||
export default hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// this file is just here to make typescript not flatten the outDir | ||
// we can't use rootDir as this doesn't allow us to use linked plugins typescript files | ||
export default {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {expect, test} from '@dxcli/dev-test' | ||
|
||
describe('command', () => { | ||
test | ||
.stdout() | ||
.command(['hello']) | ||
.it('says hello', output => { | ||
expect(output.stdout).to.contain('hello world!') | ||
}) | ||
|
||
test | ||
.stdout() | ||
.command(['hello', '--name', 'jeff']) | ||
.it('says hello jeff', output => { | ||
expect(output.stdout).to.contain('hello jeff!') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
process.env.TS_NODE_PROJECT = 'test' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {expect, test} from '@dxcli/dev-test' | ||
|
||
describe('hooks', () => { | ||
test | ||
.stdout() | ||
.hook('init', {id: 'mycommand'}) | ||
.do(output => expect(output.stdout).to.contain('example hook running mycommand')) | ||
.it('shows a message') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--require test/helpers/init.js | ||
--require ts-node/register | ||
--require source-map-support/register | ||
--watch-extensions ts | ||
--recursive | ||
--reporter spec | ||
--timeout 5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "../tsconfig", | ||
"include": [ | ||
"./**/*" | ||
] | ||
} |
Oops, something went wrong.