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

Commit

Permalink
feat: added base config object
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx authored and dxcli committed Jan 16, 2018
1 parent c85236d commit 0e9824c
Show file tree
Hide file tree
Showing 23 changed files with 875 additions and 303 deletions.
17 changes: 9 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ jobs:
- 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: ./scripts/circleci
- 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
- store_test_results:
path: ~/cli/reports
- save_cache: &save_cache
key: v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
key: v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum "scripts/circleci"}}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
paths:
- ~/cli/node_modules
- /usr/local/share/.cache/yarn
Expand All @@ -28,13 +30,12 @@ jobs:
steps:
- checkout
- restore_cache: *restore_cache
- run: yarn
- run: ./node_modules/.bin/dxcli-dev-semantic-release
- run: ./scripts/circleci release
- save_cache: *save_cache

workflows:
version: 2
test:
"@dxcli/config":
jobs:
- node-latest
- node-8
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/lib
/plugins
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
* text=auto
*.js text eol=lf
*.ts text eol=lf
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
*-debug.log
*-error.log
/.nyc_output
/coverage
/coverage.lcov
/lib
/node_modules
/tmp
/.nyc_output

*-error.log
*-debug.log
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "plugins/heroku-run"]
path = plugins/heroku-run
url = https://github.com/heroku/heroku-run
[submodule "plugins/heroku-cli-status"]
path = plugins/heroku-cli-status
url = https://github.com/heroku/heroku-cli-status
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@dxcli/config
=============

base config object and standard interfaces for dxcli components

[![Version](https://img.shields.io/npm/v/@dxcli/config.svg)](https://npmjs.org/package/@dxcli/config)
[![CircleCI](https://circleci.com/gh/dxcli/config/tree/master.svg?style=svg)](https://circleci.com/gh/dxcli/config/tree/master)
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/dxcli/config?branch=master&svg=true)](https://ci.appveyor.com/project/heroku/config/branch/master)
Expand Down
6 changes: 5 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ environment:
nodejs_version: "9"
cache:
- '%LOCALAPPDATA%\Yarn -> appveyor.yml'
- node_modules -> package.json
- 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:
- yarn test
Expand Down
51 changes: 35 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,56 @@
{
"name": "@dxcli/config",
"description": "base config object and standard interfaces for dxcli components",
"version": "0.0.0",
"author": "Jeff Dickey @jdxcode",
"bugs": "https://github.com/dxcli/config/issues",
"dependencies": {
"cli-ux": "^2.0.21"
"cli-ux": "^2.0.21",
"debug": "^3.1.0",
"fs-extra": "^5.0.0",
"load-json-file": "^4.0.0",
"lodash": "^4.17.4",
"read-pkg-up": "^3.0.0"
},
"devDependencies": {
"@dxcli/dev": "^0.0.3",
"@dxcli/dev": "^1.1.3",
"@dxcli/dev-nyc-config": "^0.0.3",
"@dxcli/dev-semantic-release": "^0.0.3",
"@dxcli/dev-tslint": "^0.0.5",
"@dxcli/dev-test": "^0.1.2",
"@dxcli/dev-tslint": "^0.0.9",
"@heroku-cli/config-edit": "^1.0.4",
"@types/ansi-styles": "^2.0.30",
"@types/chai": "^4.1.0",
"@types/fs-extra": "^5.0.0",
"@types/load-json-file": "^2.0.7",
"@types/lodash": "^4.14.92",
"@types/mocha": "^2.2.46",
"@types/node": "^9.3.0",
"@types/read-pkg-up": "^3.0.0",
"chai": "^4.1.2",
"del-cli": "^1.1.0",
"eslint": "^4.15.0",
"eslint-config-dxcli": "^1.1.2",
"eslint-config-dxcli": "^1.1.4",
"husky": "^0.14.3",
"mocha": "^4.1.0",
"nyc": "^11.4.1",
"rxjs": "^5.5.6",
"ts-node": "^4.1.0",
"typescript": "^2.6.2"
},
"dxcli": {
"workflows": {
"test": [
"eslint .",
"tsc",
"tslint -p .",
"commitlint --from master",
"tsc -p test --noEmit",
"tslint -p test",
"commitlint --from origin/master",
"mocha \"test/**/*.ts\""
],
"lint": [
"eslint .",
"tsc",
"tslint -p .",
"commitlint --from master"
"tsc -p test --noEmit",
"tslint -p test",
"commitlint --from origin/master"
]
}
},
Expand All @@ -47,13 +60,19 @@
"files": [
"/lib"
],
"homepage": "https://github.com/dxcli/config",
"keywords": [
"dxcli"
],
"license": "MIT",
"main": "lib/index.js",
"repository": "dxcli/config",
"scripts": {
"commitmsg": "dxcli-dev-commitmsg",
"lint": "dxcli-dev lint",
"test": "dxcli-dev test",
"precommit": "dxcli-dev test",
"prepare": "del-cli lib && tsc",
"commitmsg": "dxcli-dev-commitmsg"
}
"precommit": "dxcli-dev lint",
"prepare": "rm -rf lib && tsc",
"test": "dxcli-dev test"
},
"types": "lib/index.d.ts"
}
1 change: 1 addition & 0 deletions plugins/heroku-cli-status
Submodule heroku-cli-status added at df4d65
1 change: 1 addition & 0 deletions plugins/heroku-run
Submodule heroku-run added at 330d81
69 changes: 53 additions & 16 deletions scripts/circleci
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,64 @@

set -ex

duration() {
set +x
start=$(date +%s)
"$@"
end=$(date +%s)
python -c "print 'Ran $1 in %u:%02u' % ((${end} - ${start})/60, (${end} - ${start})%60)"
set -x
}

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

CLI_ENGINE_UTIL_YARN_ARGS="--frozen-lockfile"
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

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
_test() {
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
duration yarn global add greenkeeper-lockfile@1
fi
duration greenkeeper-lockfile-update
fi
greenkeeper-lockfile-update
fi

yarn install $CLI_ENGINE_UTIL_YARN_ARGS
duration yarn install $CLI_ENGINE_UTIL_YARN_ARGS

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

CWD=$(pwd)
NYC=(./node_modules/.bin/nyc --nycrc-path node_modules/@dxcli/dev-nyc-config/.nycrc)
mkdir -p reports
MOCHA_FILE="$CWD/reports/mocha.xml" \
DXCLI_MOCHA_OPTS="--reporter mocha-junit-reporter" \
DXCLI_ESLINT_OPTS="--format junit --output-file $CWD/reports/eslint.xml" \
DXCLI_TSLINT_OPTS="--format junit > $CWD/reports/tslint.xml" \
duration "${NYC[@]}" yarn test

duration "${NYC[@]}" report --reporter=text-lcov > coverage.lcov

duration curl -s https://codecov.io/bash | bash
}

NYC="./node_modules/.bin/nyc --nycrc-path node_modules/@dxcli/dev-nyc-config/.nycrc"
$NYC yarn test
$NYC report --reporter=text-lcov > coverage.lcov
_release() {
yarn --frozen-lockfile
./node_modules/.bin/dxcli-dev-semantic-release
}

curl -s https://codecov.io/bash | bash
case "$1" in
release) _release;;
*) _test;;
esac
16 changes: 16 additions & 0 deletions src/command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {IConfig} from './config'

export interface ICachedCommand {
id?: string
hidden: boolean
base: string
aliases: string[]
// help(config: IConfig): string
// helpLine(config: IConfig): [string, string | undefined]
load(): Promise<ICommand>
}

export interface ICommand extends ICachedCommand {
base: '@cli-engine/[email protected]'
run(argv: string[], config: IConfig): Promise<void>
}
Loading

0 comments on commit 0e9824c

Please sign in to comment.