From 21072fb1f0b29b403a74fc729dfe01f70854c657 Mon Sep 17 00:00:00 2001 From: Labhansh Agrawal Date: Tue, 1 Oct 2019 12:36:10 +0530 Subject: [PATCH] Use concurrently to run tsc watch, Add target to build config --- package.json | 8 ++++++-- webpack.config.js | 3 +-- yarn.lock | 45 ++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 163a1c12..f6a14429 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "scripts": { "start": "echo 'please run `yarn run dev` in one tab and then `yarn run app` in another one'", "app": "electron target", - "dev": "webpack -w", - "build": "cross-env NODE_ENV=production webpack", + "dev": "concurrently -n \"Webpack,TypeScript Compiler\" \"webpack -w\" \"tsc --pretty --watch --preserveWatchOutput\" -k", + "build": "cross-env NODE_ENV=production webpack && tsc", "lint": "eslint . --ext .js,.jsx,.ts,.tsx", "test": "yarn run lint && yarn run test:unit", "test:unit": "ava test/unit", @@ -157,6 +157,9 @@ }, "build": { "appId": "co.zeit.hyper", + "directories": { + "app": "target" + }, "extraResources": [ "./bin/yarn-standalone.js", "./bin/cli.js", @@ -282,6 +285,7 @@ "ava": "0.25.0", "babel-loader": "8.0.6", "babel-preset-minify": "0.5.1", + "concurrently": "4.1.2", "copy-webpack-plugin": "5.0.4", "cross-env": "5.1.4", "electron": "3.1.3", diff --git a/webpack.config.js b/webpack.config.js index d7480dd0..c4c9e86f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -58,10 +58,9 @@ module.exports = [ { apply: compiler => { compiler.hooks.afterEmit.tap('AfterEmitPlugin', () => { - exec('cp -r ./app/node_modules ./target && tsc', (err, stdout, stderr) => { + exec('cp -r ./app/node_modules ./target', (err, stdout, stderr) => { if (stdout) process.stdout.write(stdout); if (stderr) process.stderr.write(stderr); - process.stdout.write('\nCompiled\n\n'); }); }); } diff --git a/yarn.lock b/yarn.lock index c664a89f..892f0c34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2482,6 +2482,21 @@ concordance@^3.0.0: semver "^5.3.0" well-known-symbols "^1.0.0" +concurrently@4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-4.1.2.tgz#1a683b2b5c41e9ed324c9002b9f6e4c6e1f3b6d7" + integrity sha512-Kim9SFrNr2jd8/0yNYqDTFALzUX1tvimmwFWxmp/D4mRI+kbqIIwE2RkBDrxS2ic25O1UgQMI5AtBqdtX3ynYg== + dependencies: + chalk "^2.4.2" + date-fns "^1.30.1" + lodash "^4.17.15" + read-pkg "^4.0.1" + rxjs "^6.5.2" + spawn-command "^0.0.2-1" + supports-color "^4.5.0" + tree-kill "^1.2.1" + yargs "^12.0.5" + configstore@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.1.tgz#094ee662ab83fad9917678de114faaea8fcdca90" @@ -2802,6 +2817,11 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +date-fns@^1.30.1: + version "1.30.1" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" + integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw== + date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" @@ -5397,7 +5417,7 @@ lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" -lodash@^4.13.1, lodash@^4.14.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.8.0, lodash@~4.17.4: +lodash@^4.13.1, lodash@^4.14.0, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.8.0, lodash@~4.17.4: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -7170,6 +7190,15 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" +read-pkg@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237" + integrity sha1-ljYlN48+HE1IyFhytabsfV0JMjc= + dependencies: + normalize-package-data "^2.3.2" + parse-json "^4.0.0" + pify "^3.0.0" + "readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3: version "2.3.4" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.4.tgz#c946c3f47fa7d8eabc0b6150f4a12f69a4574071" @@ -7564,7 +7593,7 @@ rxjs@^5.5.2: dependencies: symbol-observable "1.0.1" -rxjs@^6.4.0: +rxjs@^6.5.2: version "6.5.3" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== @@ -7871,6 +7900,11 @@ source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" +spawn-command@^0.0.2-1: + version "0.0.2-1" + resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0" + integrity sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A= + spawn-rx@^2.0.10: version "2.0.12" resolved "https://registry.yarnpkg.com/spawn-rx/-/spawn-rx-2.0.12.tgz#b6285294499426089beea0c3c1ec32d7fc57a376" @@ -8187,7 +8221,7 @@ supports-color@^3.2.3: dependencies: has-flag "^1.0.0" -supports-color@^4.0.0: +supports-color@^4.0.0, supports-color@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" dependencies: @@ -8431,6 +8465,11 @@ tough-cookie@~2.4.3: psl "^1.1.24" punycode "^1.4.1" +tree-kill@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.1.tgz#5398f374e2f292b9dcc7b2e71e30a5c3bb6c743a" + integrity sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q== + trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"