From 71dd89f3c54eb8006695db2c45f6d6e49bc8d494 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Sat, 3 Feb 2018 11:35:01 -0800 Subject: [PATCH] fix: ran generator --- .circleci/config.yml | 40 +++++++++++++++++++------------- .circleci/greenkeeper | 25 ++++++++++++++++++++ .circleci/release | 11 --------- .circleci/setup_git | 12 ---------- .circleci/test | 29 ----------------------- appveyor.yml | 9 +++----- package-scripts.js | 53 ------------------------------------------- package.json | 15 +++++------- tsconfig.json | 1 + yarn.lock | 2 +- 10 files changed, 60 insertions(+), 137 deletions(-) create mode 100755 .circleci/greenkeeper delete mode 100755 .circleci/release delete mode 100755 .circleci/setup_git delete mode 100755 .circleci/test delete mode 100644 package-scripts.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 7d4806b..d1dfbf2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,38 +5,46 @@ jobs: docker: - image: node:latest working_directory: ~/cli + environment: + NYC: "yarn exec nyc -- --nycrc-path node_modules/@anycli/nyc-config/.nycrc" + MOCHA_FILE: "reports/mocha.xml" steps: - checkout - restore_cache: &restore_cache keys: - - v0-yarn-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}} - - v0-yarn-{{checksum ".circleci/config.yml"}}-{{ .Branch }}- - - v0-yarn-{{checksum ".circleci/config.yml"}}-master- - - run: .circleci/test + - v0-yarn-{{checksum ".circleci/config.yml"}}-{{ checksum "yarn.lock"}} + - v0-yarn-{{checksum ".circleci/config.yml"}} + - run: .circleci/greenkeeper + - run: yarn add -D nyc@11 @anycli/nyc-config@0 mocha-junit-reporter@1 @commitlint/cli@6 @commitlint/config-conventional@6 + - run: | + mkdir -p reports + $NYC yarn test --reporter mocha-junit-reporter + $NYC report --reporter text-lcov > coverage.lcov + curl -s https://codecov.io/bash | bash + - run: yarn exec commitlint -- -x @commitlint/config-conventional --from origin/master - store_test_results: &store_test_results path: ~/cli/reports - - save_cache: &save_cache - key: v0-yarn-{{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 - steps: - - checkout - - restore_cache: *restore_cache - - run: .circleci/test - - store_test_results: *store_test_results release: <<: *test steps: - add_ssh_keys - checkout - restore_cache: *restore_cache - - run: .circleci/release + - run: yarn global add @anycli/semantic-release@1 semantic-release@12 + - run: yarn --frozen-lockfile + - run: | + export PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH + semantic-release -e @anycli/semantic-release + - save_cache: + key: v0-yarn-{{checksum ".circleci/config.yml"}}-{{checksum "yarn.lock"}} + paths: + - ~/cli/node_modules + - /usr/local/share/.cache/yarn + - /usr/local/share/.config/yarn workflows: version: 2 diff --git a/.circleci/greenkeeper b/.circleci/greenkeeper new file mode 100755 index 0000000..bf73a3e --- /dev/null +++ b/.circleci/greenkeeper @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -ex + +PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH + +if [[ "$CIRCLE_BRANCH" != greenkeeper/* ]]; then + yarn + # yarn check + exit 0 +fi + +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.name "$GIT_USERNAME" +fi + +if [[ ! -x "$(command -v greenkeeper-lockfile-update)" ]]; then + yarn global add greenkeeper-lockfile@1 +fi + +greenkeeper-lockfile-update +yarn +greenkeeper-lockfile-upload diff --git a/.circleci/release b/.circleci/release deleted file mode 100755 index 1e441bd..0000000 --- a/.circleci/release +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -.circleci/setup_git - -PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH - -yarn global add @anycli/semantic-release@1 semantic-release@12 -yarn install --frozen-lockfile -semantic-release -e @anycli/semantic-release diff --git a/.circleci/setup_git b/.circleci/setup_git deleted file mode 100755 index ac22623..0000000 --- a/.circleci/setup_git +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -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.name "$GIT_USERNAME" -fi - -git submodule sync -git submodule update --init --recursive diff --git a/.circleci/test b/.circleci/test deleted file mode 100755 index 09d6b99..0000000 --- a/.circleci/test +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -.circleci/setup_git - -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 - -yarn add -D nyc @anycli/nyc-config -yarn test - -curl -s https://codecov.io/bash | bash diff --git a/appveyor.yml b/appveyor.yml index 9bf8c43..87593df 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,14 +6,11 @@ cache: install: - ps: Install-Product node $env:nodejs_version x64 - - git submodule sync - - git submodule update --init --recursive - - git config --global user.email "anycli@example.com" - - git config --global user.name "anycli" - - yarn add -D nyc @anycli/nyc-config + - yarn add -D nyc@11 @anycli/nyc-config@0 test_script: - - yarn test + - .\node_modules\.bin\nyc --nycrc-path node_modules/@anycli/nyc-config/.nycrc yarn test after_test: + - .\node_modules\.bin\nyc --nycrc-path node_modules/@anycli/nyc-config/.nycrc report --reporter text-lcov > coverage.lcov - ps: | $env:PATH = 'C:\msys64\usr\bin;' + $env:PATH Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh diff --git a/package-scripts.js b/package-scripts.js deleted file mode 100644 index 04f01b6..0000000 --- a/package-scripts.js +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-disable unicorn/filename-case */ - -const { - setColors, - concurrent, - crossEnv, - mkdirp, - series, -} = require('nps-utils') - -setColors(['dim']) - -const script = (script, description) => description ? {script, description} : {script} - -const linters = { - eslint: script(series('nps build', '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'), -} - -let mocha = 'mocha --forbid-only "test/**/*.test.ts"' -if (process.env.CI) { - if (process.env.CIRCLECI) { - // add mocha junit reporter - mocha = crossEnv(`MOCHA_FILE=reports/mocha.xml ${mocha} --reporter mocha-junit-reporter`) - // add eslint reporter - linters.eslint.script = `${linters.eslint.script} --format junit --output-file reports/eslint.xml` - // add tslint reporter - linters.tslint.script = `${linters.tslint.script} --format junit > reports/tslint.xml` - } - // add code coverage reporting with nyc - const nyc = 'nyc --nycrc-path node_modules/@anycli/nyc-config/.nycrc' - const nycReport = `${nyc} report --reporter text-lcov > coverage.lcov` - mocha = series(`${nyc} ${mocha}`, nycReport) -} - -let test = concurrent({ - ...linters, - test: series('nps build', mocha), -}) - -if (process.env.CI) test = series(mkdirp('reports'), test) - -module.exports = { - scripts: { - ...linters, - build: series('rm -rf lib', 'tsc'), - lint: concurrent(linters), - test, - mocha, - }, -} diff --git a/package.json b/package.json index fb5a4d6..861e952 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,6 @@ }, "devDependencies": { "@anycli/tslint": "^0.2.5", - "@commitlint/cli": "^6.1.0", - "@commitlint/config-conventional": "^6.1.0", "@heroku/linewrap": "^1.0.0", "@types/chai": "^4.1.2", "@types/lodash": "^4.14.100", @@ -22,13 +20,11 @@ "@types/node-notifier": "^0.0.28", "@types/read-pkg": "^3.0.0", "chai": "^4.1.2", + "concurrently": "^3.5.1", "eslint": "^4.17.0", "eslint-config-anycli": "^1.3.2", "husky": "^0.14.3", "mocha": "^5.0.0", - "mocha-junit-reporter": "^1.17.0", - "nps": "^5.7.1", - "nps-utils": "^1.5.0", "ts-node": "^4.1.0", "typescript": "^2.7.1" }, @@ -46,10 +42,11 @@ "main": "lib/index.js", "repository": "anycli/parser", "scripts": { - "commitmsg": "commitlint -x @commitlint/config-conventional -e $GIT_PARAMS", - "precommit": "nps lint -l warn", - "prepublishOnly": "nps build", - "test": "nps test -l warn" + "build": "rm -rf lib && tsc", + "lint": "concurrently -p command \"eslint .\" \"tsc -p test --noEmit\" \"tslint -p test\"", + "posttest": "yarn run lint", + "prepublishOnly": "yarn run build", + "test": "mocha --forbid-only \"test/**/*.test.ts\"" }, "types": "lib/index.d.ts" } diff --git a/tsconfig.json b/tsconfig.json index e297a39..12491d2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,7 @@ "noUnusedLocals": true, "noUnusedParameters": true, "outDir": "./lib", + "pretty": true, "rootDirs": [ "./src" ], diff --git a/yarn.lock b/yarn.lock index e447b30..ba2e1d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -476,7 +476,7 @@ concat-stream@^1.6.0: readable-stream "^2.2.2" typedarray "^0.0.6" -concurrently@^3.4.0: +concurrently@^3.4.0, concurrently@^3.5.1: version "3.5.1" resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-3.5.1.tgz#ee8b60018bbe86b02df13e5249453c6ececd2521" dependencies: