fix: use npm instead of yarn in CI scripts when not using yarn
* fix: use npm instead of yarn in CI scripts when not using yarn
Fixes
* chore: updated deps
* fix: add nyc
MODIFY
package.json
package.json
"@oclif/config": "^1.6.4",
"@oclif/errors": "^1.0.4",
"@oclif/plugin-help": "^1.2.4",
- "@oclif/plugin-not-found": "^1.0.5",
- "@oclif/plugin-warn-if-update-available": "^1.3.0",
+ "@oclif/plugin-not-found": "^1.0.6",
+ "@oclif/plugin-warn-if-update-available": "^1.3.1",
"debug": "^3.1.0",
"fixpack": "^2.3.1",
"lodash": "^4.17.5",
"yosay": "^2.0.2"
},
"devDependencies": {
- "@oclif/dev-cli": "^1.13.0",
+ "@oclif/dev-cli": "^1.13.1",
"@oclif/tslint": "^1.1.0",
"@types/lodash": "^4.14.107",
"@types/read-pkg": "^3.0.0",
"eslint": "^4.19.1",
"eslint-config-oclif": "^1.4.0",
"execa": "^0.10.0",
- "fancy-test": "^1.0.4",
+ "fancy-test": "^1.0.5",
"fs-extra": "^5.0.0",
"globby": "^8.0.1",
- "mocha": "^5.1.0",
+ "mocha": "^5.1.1",
"npm-run-path": "^2.0.2",
"nps": "^5.9.0",
"shelljs": "^0.8.1",

MODIFY
src/generators/app.ts
src/generators/app.ts
@@ -257,7 +257,7 @@ class App extends Generator {
this.pjson.scripts.posttest = 'eslint .'
}
if (this.mocha) {
- this.pjson.scripts.test = `mocha --forbid-only "test/**/*.test.${this._ext}"`
+ this.pjson.scripts.test = `nyc mocha --forbid-only "test/**/*.test.${this._ext}"`
} else {
this.pjson.scripts.test = 'echo NO TESTS'
}
@@ -326,13 +326,14 @@ class App extends Generator {
this.fs.copyTpl(this.templatePath('tsconfig.json'), this.destinationPath('tsconfig.json'), this)
if (this.mocha) {
this.fs.copyTpl(this.templatePath('test/tsconfig.json'), this.destinationPath('test/tsconfig.json'), this)
+ this.fs.copyTpl(this.templatePath('nycrc'), this.destinationPath('.nycrc'), this)
}
} else {
this.fs.copyTpl(this.templatePath('eslintrc'), this.destinationPath('.eslintrc'), this)
const eslintignore = this._eslintignore()
if (eslintignore.trim()) this.fs.write(this.destinationPath('.eslintignore'), this._eslintignore())
}
- if (this.mocha && !this.fs.exists('test')) {
+ if (this.mocha) {
this.fs.copyTpl(this.templatePath('test/helpers/init.js'), this.destinationPath('test/helpers/init.js'), this)
this.fs.copyTpl(this.templatePath('test/mocha.opts'), this.destinationPath('test/mocha.opts'), this)
}
@@ -413,6 +414,7 @@ class App extends Generator {
if (this.mocha) {
devDependencies.push(
'mocha@5',
+ 'nyc@11',
'chai@4',
)
if (this.type !== 'base') devDependencies.push(

MODIFY
templates/appveyor.yml.ejs
templates/appveyor.yml.ejs
environment:
nodejs_version: "9"
cache:
+<%_ if (yarn) { _%>
- '%LOCALAPPDATA%\Yarn -> appveyor.yml'
- node_modules -> yarn.lock
+<%_ } else { _%>
+ - '%AppData%\npm-cache -> appveyor.yml'
+ - node_modules -> package-lock.json
+<%_ } _%>
install:
- ps: Install-Product node $env:nodejs_version x64
- - yarn add -D nyc@11 @oclif/nyc-config@1
+<%_ if (yarn) { _%>
+ - yarn
+<%_ } else { _%>
+ - npm install
+<%_ } _%>
test_script:
<%_ if (type === 'single' || type === 'multi') { _%>
- .\bin\run --version
@@ -14,9 +23,9 @@ test_script:
<%_ } else if (type === 'plugin') { _%>
- .\bin\run --help
<%_ } _%>
- - .\node_modules\.bin\nyc --nycrc-path node_modules/@oclif/nyc-config/.nycrc yarn test
+ - <%- yarn ? 'yarn' : 'npm' %> test
after_test:
- - .\node_modules\.bin\nyc --nycrc-path node_modules/@oclif/nyc-config/.nycrc report --reporter text-lcov > coverage.lcov
+ - .\node_modules\.bin\nyc 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

MODIFY
templates/circle.yml.ejs
templates/circle.yml.ejs
@@ -5,38 +5,43 @@ jobs:
docker:
- image: node:latest
working_directory: ~/cli
- environment:
- <%_ if (mocha) { _%>
- NYC: "yarn exec nyc -- --nycrc-path node_modules/@oclif/nyc-config/.nycrc"
- <%_ } _%>
steps:
- checkout
- restore_cache: &restore_cache
keys:
- - v1-yarn-{{checksum ".circleci/config.yml"}}-{{ checksum "yarn.lock"}}
- - v1-yarn-{{checksum ".circleci/config.yml"}}
+ - v1-npm-{{checksum ".circleci/config.yml"}}-{{ checksum "<%- yarn ? 'yarn.lock' : 'package-lock.json' %>"}}
+ - v1-npm-{{checksum ".circleci/config.yml"}}
- run:
name: Install dependencies
- command: |
- .circleci/greenkeeper
- yarn add -D nyc@11 @oclif/nyc-config@1
+ command: .circleci/greenkeeper
<%_ if (['single', 'multi'].includes(type)) { _%>
- run: ./bin/run --version
<%_ } _%>
<%_ if (['single', 'multi', 'plugin'].includes(type)) { _%>
- run: ./bin/run --help
<%_ } _%>
- <%_ if (mocha) { _%>
- run:
name: Testing
- command: $NYC yarn test
+ command: <%- yarn ? 'yarn' : 'npm' %> test
+ <%_ if (mocha) { _%>
- run:
name: Submitting code coverage to codecov
command: |
- $NYC report --reporter text-lcov > coverage.lcov
+ ./node_modules/.bin/nyc report --reporter text-lcov > coverage.lcov
curl -s https://codecov.io/bash | bash
+ <%_ } _%>
+ <%_ if (!semantic_release) { _%>
+ - save_cache:
+ key: v1-yarn-{{checksum ".circleci/config.yml"}}-{{checksum "yarn.lock"}}
+ paths:
+ - ~/cli/node_modules
+ <%_ if (yarn) { _%>
+ - /usr/local/share/.cache/yarn
+ - /usr/local/share/.config/yarn
<%_ } else { _%>
- - run: yarn test
+ - ~/.npm
+ - /usr/local/lib/node_modules
+ <%_ } _%>
<%_ } _%>
node-8:
<<: *test
@@ -52,22 +57,26 @@ jobs:
- run:
name: Install dependencies
command: |
- yarn global add @oclif/semantic-release@3 semantic-release@15
- yarn --frozen-lockfile
+ <%- yarn ? 'yarn global add' : 'npm install -g' %> @oclif/semantic-release@3 semantic-release@15
+ <%- yarn ? 'yarn --frozen-lockfile' : 'npm install' %>
- run:
name: Cutting release
command: |
+ <%_ if (yarn) { _%>
export PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH
+ <%_ } _%>
semantic-release -e @oclif/semantic-release
- - run:
- name: Add dev packages to cache
- command: yarn add -D nyc@11 @oclif/nyc-config@1
- save_cache:
key: v1-yarn-{{checksum ".circleci/config.yml"}}-{{checksum "yarn.lock"}}
paths:
- ~/cli/node_modules
+ <%_ if (yarn) { _%>
- /usr/local/share/.cache/yarn
- /usr/local/share/.config/yarn
+ <%_ } else { _%>
+ - ~/.npm
+ - /usr/local/lib/node_modules
+ <%_ } _%>
<%_ } _%>
workflows:

ADD
templates/nycrc
+{
+ "extension": [
+ ".ts"
+ ],
+ "include": [
+ "src/**/*.ts"
+ ],
+ "exclude": [
+ "**/*.d.ts"
+ ],
+ "all": true
+}

MODIFY
yarn.lock
yarn.lock
strip-ansi "^4.0.0"
supports-color "^5.1.0"
-"@heroku/linewrap@^1.0.0":
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/@heroku/linewrap/-/linewrap-1.0.0.tgz#a9d4e99f0a3e423a899b775f5f3d6747a1ff15c6"
-
"@mrmlnc/readdir-enhanced@^2.2.1":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde"
call-me-maybe "^1.0.1"
glob-to-regexp "^0.3.0"
-"@oclif/command@^1.4.13", "@oclif/command@^1.4.7":
+"@oclif/command@^1.4.13":
version "1.4.13"
resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.4.13.tgz#2ed3c42142307d20337ec04eabd1be410dfa2a5e"
dependencies:
debug "^3.1.0"
semver "^5.5.0"
-"@oclif/command@^1.4.4":
- version "1.4.6"
- resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.4.6.tgz#6de7789cfc6ae6cdf177566fbfbb742d5cb8f320"
- dependencies:
- "@oclif/errors" "^1.0.3"
- "@oclif/parser" "^3.2.9"
- debug "^3.1.0"
- semver "^5.5.0"
-
-"@oclif/config@^1.4.0", "@oclif/config@^1.6.1", "@oclif/config@^1.6.4":
+"@oclif/config@^1.6.4":
version "1.6.4"
resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.6.4.tgz#4bcb51fa40646794031437d7904f0fbb56e5c072"
dependencies:
debug "^3.1.0"
-"@oclif/dev-cli@^1.13.0":
- version "1.13.0"
- resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.0.tgz#b46bf7e8cf247a1aa2acdd46be38819a2fd4febd"
+"@oclif/dev-cli@^1.13.1":
+ version "1.13.1"
+ resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.1.tgz#3a40b2c5890c86413ef3a2fcf232178cff7e897c"
dependencies:
"@oclif/command" "^1.4.13"
- "@oclif/config" "^1.6.1"
+ "@oclif/config" "^1.6.4"
"@oclif/errors" "^1.0.4"
- "@oclif/plugin-help" "^1.2.3"
- cli-ux "^3.3.28"
+ "@oclif/plugin-help" "^1.2.4"
+ cli-ux "^3.3.30"
debug "^3.1.0"
fs-extra "^5.0.0"
lodash "^4.17.5"
require-resolve "^0.0.2"
tslib "^1.9.0"
-"@oclif/errors@^1.0.3":
- version "1.0.3"
- resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.0.3.tgz#f23c024075855c7d116d041ee158f99bd51175af"
- dependencies:
- clean-stack "^1.3.0"
- fs-extra "^5.0.0"
- indent-string "^3.2.0"
- strip-ansi "^4.0.0"
- wrap-ansi "^3.0.1"
-
"@oclif/errors@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.0.4.tgz#8e34386ede530484ae3c98bc21d818c416214c66"
version "1.0.0"
resolved "https://registry.yarnpkg.com/@oclif/linewrap/-/linewrap-1.0.0.tgz#aedcb64b479d4db7be24196384897b5000901d91"
-"@oclif/parser@^3.2.9":
- version "3.2.9"
- resolved "https://registry.yarnpkg.com/@oclif/parser/-/parser-3.2.9.tgz#76d01106971e20dfcfec5be276c4e6e9edfee9ec"
- dependencies:
- "@heroku/linewrap" "^1.0.0"
-
"@oclif/parser@^3.3.2":
version "3.3.2"
resolved "https://registry.yarnpkg.com/@oclif/parser/-/parser-3.3.2.tgz#81af56d4f97beae376abb59e461005489abd9e19"
"@oclif/linewrap" "^1.0.0"
chalk "^2.3.2"
-"@oclif/plugin-help@^1.2.3", "@oclif/plugin-help@^1.2.4":
+"@oclif/plugin-help@^1.2.4":
version "1.2.4"
resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-1.2.4.tgz#1b4349f7d570445ad5cfe4f925bfd832d4552aa2"
dependencies:
widest-line "^2.0.0"
wrap-ansi "^3.0.1"
-"@oclif/plugin-not-found@^1.0.5":
- version "1.0.5"
- resolved "https://registry.yarnpkg.com/@oclif/plugin-not-found/-/plugin-not-found-1.0.5.tgz#45ed23895cb19564ca14df9b75c570670ad31a44"
+"@oclif/plugin-not-found@^1.0.6":
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/@oclif/plugin-not-found/-/plugin-not-found-1.0.6.tgz#471bf3410a3d656d8d7fa482ca9afc4f909be981"
dependencies:
"@heroku-cli/color" "^1.1.3"
- "@oclif/command" "^1.4.4"
+ "@oclif/command" "^1.4.13"
string-similarity "^1.2.0"
-"@oclif/plugin-warn-if-update-available@^1.3.0":
- version "1.3.0"
- resolved "https://registry.yarnpkg.com/@oclif/plugin-warn-if-update-available/-/plugin-warn-if-update-available-1.3.0.tgz#f332eee1560cdeed1b4f4857cb54260fe1ca2582"
+"@oclif/plugin-warn-if-update-available@^1.3.1":
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/@oclif/plugin-warn-if-update-available/-/plugin-warn-if-update-available-1.3.1.tgz#f0df2532daaa0a937750385445edea9a76f9e7ab"
dependencies:
- "@oclif/command" "^1.4.7"
- "@oclif/config" "^1.4.0"
+ "@oclif/command" "^1.4.13"
+ "@oclif/config" "^1.6.4"
"@oclif/errors" "^1.0.4"
- chalk "^2.3.2"
+ chalk "^2.4.0"
debug "^3.1.0"
fs-extra "^5.0.0"
http-call "^5.1.0"
@@ -613,6 +584,14 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.2:
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
+chalk@^2.4.0:
+ version "2.4.0"
+ resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.0.tgz#a060a297a6b57e15b61ca63ce84995daa0fe6e52"
+ dependencies:
+ ansi-styles "^3.2.1"
+ escape-string-regexp "^1.0.5"
+ supports-color "^5.3.0"
+
chardet@^0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"
@@ -664,15 +643,15 @@ cli-table@^0.3.1:
dependencies:
colors "1.0.3"
-cli-ux@^3.3.28:
- version "3.3.30"
- resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-3.3.30.tgz#525e65bda07a04e913673dfd614519373053d003"
+cli-ux@^3.3.30:
+ version "3.3.31"
+ resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-3.3.31.tgz#e4f2a380df00ebf298189b83a77ae92cdfc7355f"
dependencies:
"@oclif/linewrap" "^1.0.0"
"@oclif/screen" "^1.0.2"
ansi-styles "^3.2.1"
cardinal "^1.0.0"
- chalk "^2.3.2"
+ chalk "^2.4.0"
clean-stack "^1.3.0"
extract-stack "^1.0.0"
fs-extra "^5.0.0"
@@ -681,7 +660,7 @@ cli-ux@^3.3.28:
password-prompt "^1.0.4"
semver "^5.5.0"
strip-ansi "^4.0.0"
- supports-color "^5.3.0"
+ supports-color "^5.4.0"
cli-width@^2.0.0:
version "2.2.0"
@@ -1288,12 +1267,12 @@ extract-stack@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/extract-stack/-/extract-stack-1.0.0.tgz#b97acaf9441eea2332529624b732fc5a1c8165fa"
-fancy-test@^1.0.4:
- version "1.0.4"
- resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-1.0.4.tgz#fa689cfc98abec74a0b2f4386d92c58f1ef20f11"
+fancy-test@^1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-1.0.5.tgz#323970de576f7dc0938402c3a731ee4d59896a11"
dependencies:
lodash "^4.17.5"
- stdout-stderr "^0.1.8"
+ stdout-stderr "^0.1.9"
fast-deep-equal@^1.0.0:
version "1.1.0"
@@ -2224,9 +2203,9 @@ mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1:
dependencies:
minimist "0.0.8"
-mocha@^5.1.0:
- version "5.1.0"
- resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.1.0.tgz#5ff11cc39c0bb65330ac6c41f9086634e3e3f686"
+mocha@^5.1.1:
+ version "5.1.1"
+ resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.1.1.tgz#b774c75609dac05eb48f4d9ba1d827b97fde8a7b"
dependencies:
browser-stdout "1.3.1"
commander "2.11.0"
@@ -3063,7 +3042,7 @@ static-extend@^0.1.1:
define-property "^0.2.5"
object-copy "^0.1.0"
-stdout-stderr@^0.1.8:
+stdout-stderr@^0.1.9:
version "0.1.9"
resolved "https://registry.yarnpkg.com/stdout-stderr/-/stdout-stderr-0.1.9.tgz#9b48ee04eff955ee07776e27125d5524d9d02f57"
dependencies:
@@ -3192,6 +3171,12 @@ supports-color@^5.1.0, supports-color@^5.3.0:
dependencies:
has-flag "^3.0.0"
+supports-color@^5.4.0:
+ version "5.4.0"
+ resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54"
+ dependencies:
+ has-flag "^3.0.0"
+
table@4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36"

fix: use npm instead of yarn in CI scripts when not using yarn (#108)

* fix: use npm instead of yarn in CI scripts when not using yarn

Fixes https://github.com/oclif/oclif/issues/104

* chore: updated deps

* fix: add nyc