From 3a9bf0f866a0a41d9e61b0d461277df1c95e2f94 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Sat, 15 Sep 2018 00:47:44 -0700 Subject: [PATCH] feat: use typescript 3.0 project references this simplifies test config a bit --- package.json | 10 ++--- src/generators/app.ts | 9 ---- templates/test/helpers/init.js | 2 - templates/test/mocha.opts | 1 - templates/test/tsconfig.json | 8 ++-- templates/tsconfig.json | 9 ++-- yarn.lock | 81 ++++++++++++++++------------------ 7 files changed, 49 insertions(+), 71 deletions(-) delete mode 100644 templates/test/helpers/init.js diff --git a/package.json b/package.json index 2b02678..14327e4 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,13 @@ "bin": "./bin/run", "bugs": "https://github.com/oclif/oclif/issues", "dependencies": { - "@oclif/command": "^1.5.0", + "@oclif/command": "^1.5.1", "@oclif/config": "^1.7.6", - "@oclif/errors": "^1.2.0", + "@oclif/errors": "^1.2.1", "@oclif/fixpack": "^2.3.0", "@oclif/plugin-help": "^2.1.2", "@oclif/plugin-not-found": "^1.2.0", - "@oclif/plugin-warn-if-update-available": "^1.5.2", + "@oclif/plugin-warn-if-update-available": "^1.5.3", "debug": "^4.0.1", "lodash": "^4.17.11", "nps-utils": "^1.7.0", @@ -23,7 +23,7 @@ "yosay": "^2.0.2" }, "devDependencies": { - "@oclif/dev-cli": "^1.18.0", + "@oclif/dev-cli": "^1.18.1", "@oclif/tslint": "^3.1.0", "@types/lodash": "^4.14.116", "@types/read-pkg": "^3.0.0", @@ -31,7 +31,7 @@ "@types/yeoman-generator": "^2.0.3", "@types/yosay": "^0.0.29", "chai": "^4.1.2", - "eslint": "^5.5.0", + "eslint": "^5.6.0", "eslint-config-oclif": "^3.1.0", "execa": "^1.0.0", "fancy-test": "^1.4.1", diff --git a/src/generators/app.ts b/src/generators/app.ts index 5490b32..951e2a2 100644 --- a/src/generators/app.ts +++ b/src/generators/app.ts @@ -361,7 +361,6 @@ class App extends Generator { if (eslintignore.trim()) this.fs.write(this.destinationPath('.eslintignore'), this._eslintignore()) } 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) } if (this.fs.exists(this.destinationPath('./package.json'))) { @@ -372,10 +371,6 @@ class App extends Generator { this.fs.writeJSON(this.destinationPath('./package.json'), sortPjson(this.pjson)) this.fs.copyTpl(this.templatePath('editorconfig'), this.destinationPath('.editorconfig'), this) if (this.circleci) { - // if (this.semantic_release) { - // this.fs.copyTpl(this.templatePath('scripts/release'), this.destinationPath('.circleci/release'), this) - // } - // this.fs.copyTpl(this.templatePath('scripts/setup_git'), this.destinationPath('.circleci/setup_git'), this) this.fs.copyTpl(this.templatePath('circle.yml.ejs'), this.destinationPath('.circleci/config.yml'), this) } if (this.appveyor) { @@ -386,10 +381,6 @@ class App extends Generator { this.fs.copyTpl(this.templatePath('LICENSE.mit'), this.destinationPath('LICENSE'), this) } - // git - // if (this.fromScratch) this.spawnCommandSync('git', ['init']) - this.fs.copyTpl(this.templatePath('gitattributes'), this.destinationPath('.gitattributes'), this) - this.fs.write(this.destinationPath('.gitignore'), this._gitignore()) switch (this.type) { diff --git a/templates/test/helpers/init.js b/templates/test/helpers/init.js deleted file mode 100644 index f8e35e6..0000000 --- a/templates/test/helpers/init.js +++ /dev/null @@ -1,2 +0,0 @@ -const path = require('path') -process.env.TS_NODE_PROJECT = path.resolve('test/tsconfig.json') diff --git a/templates/test/mocha.opts b/templates/test/mocha.opts index 2e6aea6..1e61658 100644 --- a/templates/test/mocha.opts +++ b/templates/test/mocha.opts @@ -1,4 +1,3 @@ ---require test/helpers/init.js <%= ts ? '--require ts-node/register\n--require source-map-support/register\n--watch-extensions ts\n' : '' _%> --recursive --reporter spec diff --git a/templates/test/tsconfig.json b/templates/test/tsconfig.json index 04c22f3..95898fc 100644 --- a/templates/test/tsconfig.json +++ b/templates/test/tsconfig.json @@ -1,11 +1,9 @@ { - "declaration": false, "extends": "../tsconfig", "compilerOptions": { - "sourceMap": true + "noEmit": true }, - "include": [ - "./**/*", - "../src/**/*" + "references": [ + {"path": ".."} ] } diff --git a/templates/tsconfig.json b/templates/tsconfig.json index 0ec780a..5a37265 100644 --- a/templates/tsconfig.json +++ b/templates/tsconfig.json @@ -1,16 +1,15 @@ { "compilerOptions": { "declaration": true, - "forceConsistentCasingInFileNames": true, "importHelpers": true, "module": "commonjs", - "outDir": "./lib", - "rootDirs": [ "./src" ], + "outDir": "lib", + "rootDir": "src", "strict": true, "target": "es2017", - "typeRoots": [ "./node_modules/@types" ] + "composite": true }, "include": [ - "./src/**/*" + "src/**/*" ] } diff --git a/yarn.lock b/yarn.lock index 01386d9..56ca10e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -52,47 +52,47 @@ supports-color "^5.4.0" tslib "^1" -"@oclif/command@^1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.5.0.tgz#d5276a19506349fff0254b0dd98e3b8a2bd971aa" +"@oclif/command@^1.5.0", "@oclif/command@^1.5.1": + version "1.5.1" + resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.5.1.tgz#dd2e1c1f8e55dad73036d4cab036ac3550ff8c24" dependencies: - "@oclif/errors" "^1.1.2" - "@oclif/parser" "^3.6.0" - debug "^3.1.0" - semver "^5.5.0" + "@oclif/errors" "^1.2.0" + "@oclif/parser" "^3.6.1" + debug "^4.0.1" + semver "^5.5.1" -"@oclif/config@^1.7.2", "@oclif/config@^1.7.4", "@oclif/config@^1.7.6": +"@oclif/config@^1.7.6": version "1.7.6" resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.7.6.tgz#849e5f79591c8dd29d99dd3aba0914b50e2c2e74" dependencies: debug "^4.0.1" tslib "^1.9.3" -"@oclif/dev-cli@^1.18.0": - version "1.18.0" - resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.18.0.tgz#729f8530dd183b2cbb9f92d6caee5ec5b490b5b5" +"@oclif/dev-cli@^1.18.1": + version "1.18.1" + resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.18.1.tgz#e53a6fa13749262e0fe2495e59e7e2fa38c356d5" dependencies: - "@oclif/command" "^1.5.0" - "@oclif/config" "^1.7.4" - "@oclif/errors" "^1.2.0" - "@oclif/plugin-help" "^2.1.1" - cli-ux "^4.8.1" - debug "^3.1.0" + "@oclif/command" "^1.5.1" + "@oclif/config" "^1.7.6" + "@oclif/errors" "^1.2.1" + "@oclif/plugin-help" "^2.1.2" + cli-ux "^4.8.2" + debug "^4.0.1" fs-extra "^7.0.0" - lodash "^4.17.10" + lodash "^4.17.11" normalize-package-data "^2.4.0" qqjs "^0.3.10" tslib "^1.9.3" -"@oclif/errors@^1.1.2", "@oclif/errors@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.2.0.tgz#4166952699724c25af2ab4528fe223e930655e72" +"@oclif/errors@^1.2.0", "@oclif/errors@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.2.1.tgz#3d655bec6ce7eb7df2f3cd39c23eb62f0470b77d" dependencies: clean-stack "^1.3.0" fs-extra "^7.0.0" indent-string "^3.2.0" strip-ansi "^4.0.0" - wrap-ansi "^3.0.1" + wrap-ansi "^4.0.0" "@oclif/fixpack@^2.3.0": version "2.3.0" @@ -107,7 +107,7 @@ version "1.0.0" resolved "https://registry.yarnpkg.com/@oclif/linewrap/-/linewrap-1.0.0.tgz#aedcb64b479d4db7be24196384897b5000901d91" -"@oclif/parser@^3.6.0": +"@oclif/parser@^3.6.1": version "3.6.1" resolved "https://registry.yarnpkg.com/@oclif/parser/-/parser-3.6.1.tgz#dd0ad29d9178d75a2de30314874a6167675925ed" dependencies: @@ -115,7 +115,7 @@ chalk "^2.4.1" tslib "^1.9.3" -"@oclif/plugin-help@^2.1.1", "@oclif/plugin-help@^2.1.2": +"@oclif/plugin-help@^2.1.2": version "2.1.2" resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-2.1.2.tgz#b6639e95157f563225a29b4329ce62e2e162afe9" dependencies: @@ -138,22 +138,22 @@ fast-levenshtein "^2.0.6" lodash "^4.17.10" -"@oclif/plugin-warn-if-update-available@^1.5.2": - version "1.5.2" - resolved "https://registry.yarnpkg.com/@oclif/plugin-warn-if-update-available/-/plugin-warn-if-update-available-1.5.2.tgz#b1e06a9e1c9d2f079f39831b67d2b1d8cb95d264" +"@oclif/plugin-warn-if-update-available@^1.5.3": + version "1.5.3" + resolved "https://registry.yarnpkg.com/@oclif/plugin-warn-if-update-available/-/plugin-warn-if-update-available-1.5.3.tgz#63734fd61c06558234176cb684a33bc7137facb0" dependencies: "@oclif/command" "^1.5.0" - "@oclif/config" "^1.7.2" + "@oclif/config" "^1.7.6" "@oclif/errors" "^1.2.0" chalk "^2.4.1" - debug "^3.1.0" + debug "^4.0.1" fs-extra "^7.0.0" - http-call "^5.2.1" + http-call "^5.2.2" semver "^5.5.1" "@oclif/screen@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@oclif/screen/-/screen-1.0.2.tgz#c9d7c84b0ea60ecec8dd7a9b22c012ba9967aed8" + version "1.0.3" + resolved "https://registry.yarnpkg.com/@oclif/screen/-/screen-1.0.3.tgz#da9f3481a0e386abd36ac7c0d2fe6e1d8c1058f7" "@oclif/tslint@^3.1.0": version "3.1.0" @@ -669,7 +669,7 @@ cli-table@^0.3.1: dependencies: colors "1.0.3" -cli-ux@^4.7.3, cli-ux@^4.8.1: +cli-ux@^4.7.3, cli-ux@^4.8.2: version "4.8.2" resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-4.8.2.tgz#6be3c966919727106fba875de1dc771b2567de1d" dependencies: @@ -1121,9 +1121,9 @@ eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" -eslint@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.5.0.tgz#8557fcceab5141a8197da9ffd9904f89f64425c6" +eslint@^5.6.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.6.0.tgz#b6f7806041af01f71b3f1895cbb20971ea4b6223" dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.5.3" @@ -1673,7 +1673,7 @@ hosted-git-info@^2.1.4: version "2.7.1" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" -http-call@^5.1.2, http-call@^5.2.1: +http-call@^5.1.2, http-call@^5.2.2: version "5.2.2" resolved "https://registry.yarnpkg.com/http-call/-/http-call-5.2.2.tgz#d8eb37eef701e566d44373ef19b22444ebb7c02e" dependencies: @@ -3591,13 +3591,6 @@ wrap-ansi@^2.0.0: string-width "^1.0.1" strip-ansi "^3.0.1" -wrap-ansi@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-3.0.1.tgz#288a04d87eda5c286e060dfe8f135ce8d007f8ba" - dependencies: - string-width "^2.1.1" - strip-ansi "^4.0.0" - wrap-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-4.0.0.tgz#b3570d7c70156159a2d42be5cc942e957f7b1131"