From 0c6b3c8d5074421b28948be45616a5a688cbf046 Mon Sep 17 00:00:00 2001 From: Septs Date: Wed, 19 Feb 2020 14:21:30 +0800 Subject: [PATCH] use env-cmd replace cross-env --- .env.json | 11 +++++++++++ package.json | 8 ++++---- yarn.lock | 44 ++++++++++++++------------------------------ 3 files changed, 29 insertions(+), 34 deletions(-) create mode 100644 .env.json diff --git a/.env.json b/.env.json new file mode 100644 index 0000000..90c361f --- /dev/null +++ b/.env.json @@ -0,0 +1,11 @@ +{ + "production": { + "NODE_ENV": "production" + }, + "development": { + "NODE_ENV": "development" + }, + "test": { + "TS_NODE_COMPILER_OPTIONS": "{\"module\":\"commonjs\"}" + } +} diff --git a/package.json b/package.json index 2b3481e..1ba3aca 100644 --- a/package.json +++ b/package.json @@ -18,10 +18,10 @@ }, "sideEffects": false, "scripts": { - "start": "cross-env NODE_ENV=development npm-run-all --parallel \"start:tsc -- {@}\" start:rollup", + "start": "env-cmd -e development npm-run-all --parallel \"start:tsc -- {@}\" start:rollup", "start:tsc": "tsc --watch", "start:rollup": "rollup -c -w", - "build": "cross-env NODE_ENV=production npm-run-all --parallel clean \"build:tsc -- {@}\" build:rollup", + "build": "env-cmd -e production npm-run-all --parallel clean \"build:tsc -- {@}\" build:rollup", "build:tsc": "tsc", "build:rollup": "rollup -c -m", "eslint": "eslint . --ext .ts,.tsx", @@ -31,7 +31,7 @@ "doc": "npm-run-all --serial build:tsc doc:api doc:md", "doc:api": "api-extractor run --local --verbose", "doc:md": "api-documenter markdown -i temp -o api-documents", - "test": "cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\" }' mocha -r ts-node/register/transpile-only -r source-map-support/register -r jsdom-global/register --recursive src/**/*.spec.ts" + "test": "env-cmd -e test mocha -r ts-node/register/transpile-only -r source-map-support/register -r jsdom-global/register --recursive src/**/*.spec.ts" }, "devDependencies": { "@microsoft/api-documenter": "^7.7.12", @@ -41,7 +41,7 @@ "@types/mocha": "^7.0.1", "@typescript-eslint/eslint-plugin": "^2.19.0", "@typescript-eslint/parser": "^2.19.0", - "cross-env": "^7.0.0", + "env-cmd": "^10.1.0", "eslint": "^6.8.0", "eslint-watch": "^6.0.1", "jsdom": "^16.1.0", diff --git a/yarn.lock b/yarn.lock index f3dcf7e..6bc923d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -168,15 +168,6 @@ regexpp "^3.0.0" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@2.19.0": - version "2.19.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.19.0.tgz#d5ca732f22c009e515ba09fcceb5f2127d841568" - integrity sha512-zwpg6zEOPbhB3+GaQfufzlMUOO6GXCNZq6skk+b2ZkZAIoBhVoanWK255BS1g5x9bMwHpLhX0Rpn5Fc3NdCZdg== - dependencies: - "@types/json-schema" "^7.0.3" - "@typescript-eslint/typescript-estree" "2.19.0" - eslint-scope "^5.0.0" - "@typescript-eslint/experimental-utils@2.19.2": version "2.19.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.19.2.tgz#4611d44cf0f0cb460c26aa7676fc0a787281e233" @@ -196,19 +187,6 @@ "@typescript-eslint/typescript-estree" "2.19.2" eslint-visitor-keys "^1.1.0" -"@typescript-eslint/typescript-estree@2.19.0": - version "2.19.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.19.0.tgz#6bd7310b9827e04756fe712909f26956aac4b196" - integrity sha512-n6/Xa37k0jQdwpUszffi19AlNbVCR0sdvCs3DmSKMD7wBttKY31lhD2fug5kMD91B2qW4mQldaTEc1PEzvGu8w== - dependencies: - debug "^4.1.1" - eslint-visitor-keys "^1.1.0" - glob "^7.1.6" - is-glob "^4.0.1" - lodash "^4.17.15" - semver "^6.3.0" - tsutils "^3.17.1" - "@typescript-eslint/typescript-estree@2.19.2": version "2.19.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.19.2.tgz#67485b00172f400474d243c6c0be27581a579350" @@ -527,6 +505,11 @@ commander@^2.7.1: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== +commander@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" + integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -554,13 +537,6 @@ core-util-is@1.0.2: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -cross-env@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.0.tgz#5a3b2ddce51ec713ea58f2fb79ce22e65b4f5479" - integrity sha512-rV6M9ldNgmwP7bx5u6rZsTbYidzwvrwIYZnT08hSGLcQCcggofgFW+sNe7IhA1SRauPS0QuLbbX+wdNtpqE5CQ== - dependencies: - cross-spawn "^7.0.1" - cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -572,7 +548,7 @@ cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.0, cross-spawn@^7.0.1: +cross-spawn@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14" integrity sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg== @@ -709,6 +685,14 @@ end-of-stream@^1.1.0: dependencies: once "^1.4.0" +env-cmd@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/env-cmd/-/env-cmd-10.1.0.tgz#c7f5d3b550c9519f137fdac4dd8fb6866a8c8c4b" + integrity sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA== + dependencies: + commander "^4.0.0" + cross-spawn "^7.0.0" + error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"