Skip to content

Commit f16229b

Browse files
authored
Speed up test script (#20)
The test script now builds and tests without removing the `dist` directory first. This speeds up the test script a little bit (~0.5 seconds for me, usually). Removing the directory seemed a bit excessive, particularly if someone had enabled incremental builds. A new `build:clean` script has been added to remove `dist` and build, and this is used in the `prepublishOnly` script. This should ensure the build used for publishing is always complete, with no extraneous files. Also `rimraf` is now used for deleting `dist`, to improve platform compatibility for contributors.
1 parent 74b80c1 commit f16229b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
"dist/"
1111
],
1212
"scripts": {
13-
"build": "rm -rf ./dist && tsc --project .",
13+
"build:clean": "rimraf dist && yarn build",
14+
"build": "tsc --project .",
1415
"lint": "eslint . --ext ts,js,json",
1516
"lint:fix": "yarn lint --fix",
1617
"test": "yarn build && node test",
17-
"prepublishOnly": "yarn test"
18+
"prepublishOnly": "yarn build:clean && yarn test"
1819
},
1920
"author": "",
2021
"license": "ISC",
@@ -36,6 +37,7 @@
3637
"eslint-plugin-json": "^2.1.2",
3738
"eslint-plugin-node": "^11.1.0",
3839
"pump": "^1.0.2",
40+
"rimraf": "^3.0.2",
3941
"tape": "^4.8.0",
4042
"typescript": "^4.1.2"
4143
}

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,13 @@ [email protected]:
13511351
dependencies:
13521352
glob "^7.1.3"
13531353

1354+
rimraf@^3.0.2:
1355+
version "3.0.2"
1356+
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a"
1357+
integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==
1358+
dependencies:
1359+
glob "^7.1.3"
1360+
13541361
run-parallel@^1.1.9:
13551362
version "1.1.10"
13561363
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.10.tgz#60a51b2ae836636c81377df16cb107351bcd13ef"

0 commit comments

Comments
 (0)