Skip to content

Commit d3380af

Browse files
author
Wil Wilsman
authored
πŸ”¨ Improve repo scripts (#231)
* πŸ”₯ Remove old webpack config * πŸ”§ Drastically improve test script * πŸ”§ Use test script coverage * πŸ”¨ Create shared build script * βœ… Fix @percy/dom test helper imports * πŸ”¨ Adjust build script regexs for windows
1 parent 0f871cf commit d3380af

30 files changed

+488
-247
lines changed

β€Ž.nycrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"exclude": ["dist", "test"],
3-
"check-coverage": true,
3+
"instrument": false,
44
"branches": 100,
55
"lines": 100,
66
"functions": 100,

β€Žkarma.config.js

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
const cwd = process.cwd();
2+
const rollup = require('./rollup.config');
3+
4+
module.exports = config => config.set({
5+
basePath: cwd,
6+
singleRun: true,
7+
frameworks: ['jasmine'],
8+
reporters: ['mocha'],
9+
10+
browsers: [
11+
'ChromeHeadless',
12+
'FirefoxHeadless'
13+
],
14+
15+
files: [
16+
// common files
17+
{ pattern: require.resolve('regenerator-runtime/runtime'), watched: false },
18+
{ pattern: require.resolve('./scripts/test-helpers'), watched: false },
19+
// local package files
20+
{ pattern: 'src/index.js', watched: false },
21+
{ pattern: 'test/helper*(s).js', watched: false },
22+
{ pattern: 'test/**/*.test.js', watched: false }
23+
],
24+
25+
// create dedicated bundles for src, test helpers, and each test suite
26+
preprocessors: {
27+
'src/index.js': ['rollup'],
28+
'test/helper*(s).js': ['rollupTestHelpers'],
29+
'test/**/*.test.js': ['rollupTestFiles']
30+
},
31+
32+
// reports look better when not randomized
33+
client: {
34+
jasmine: {
35+
random: false
36+
}
37+
},
38+
39+
// (see rollup.config.js)
40+
rollupPreprocessor: rollup.test,
41+
42+
customPreprocessors: {
43+
rollupTestHelpers: {
44+
base: 'rollup',
45+
options: rollup.testHelpers
46+
},
47+
rollupTestFiles: {
48+
base: 'rollup',
49+
options: rollup.testFiles
50+
}
51+
},
52+
53+
plugins: [
54+
'karma-chrome-launcher',
55+
'karma-firefox-launcher',
56+
'karma-jasmine',
57+
'karma-mocha-reporter',
58+
'karma-rollup-preprocessor'
59+
]
60+
});

β€Žpackage.json

+14-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"lint": "eslint --ignore-path .gitignore .",
1313
"readme": "lerna run --parallel readme",
1414
"postinstall": "lerna run --stream postinstall",
15-
"test": "lerna run --stream --concurrency=1 test -- --colors",
16-
"test:coverage": "lerna run --stream --concurrency=1 test:coverage -- --colors",
15+
"test": "lerna run --stream --concurrency=1 test",
16+
"test:coverage": "lerna run --stream --concurrency=1 test:coverage",
1717
"test:types": "lerna run --parallel test:types"
1818
},
1919
"devDependencies": {
@@ -24,6 +24,10 @@
2424
"@babel/preset-env": "^7.11.5",
2525
"@babel/register": "^7.11.5",
2626
"@oclif/dev-cli": "^1.22.2",
27+
"@rollup/plugin-alias": "^3.1.2",
28+
"@rollup/plugin-babel": "^5.2.2",
29+
"@rollup/plugin-commonjs": "^17.0.0",
30+
"@rollup/plugin-node-resolve": "^11.1.0",
2731
"babel-plugin-istanbul": "^6.0.0",
2832
"babel-plugin-module-resolver": "^4.0.0",
2933
"cross-env": "^7.0.2",
@@ -33,11 +37,19 @@
3337
"eslint-plugin-import": "^2.22.0",
3438
"eslint-plugin-node": "^11.1.0",
3539
"eslint-plugin-promise": "^4.2.1",
40+
"gaze": "^1.1.3",
3641
"jasmine": "^3.6.4",
3742
"jasmine-spec-reporter": "^6.0.0",
43+
"karma": "^6.0.2",
44+
"karma-chrome-launcher": "^3.1.0",
45+
"karma-firefox-launcher": "^2.0.0",
46+
"karma-jasmine": "^4.0.1",
47+
"karma-mocha-reporter": "^2.2.5",
48+
"karma-rollup-preprocessor": "^7.0.5",
3849
"lerna": "^4.0.0",
3950
"nock": "^13.0.4",
4051
"nyc": "^15.1.0",
52+
"rollup": "^2.38.0",
4153
"tsd": "^0.14.0"
4254
}
4355
}

β€Žpackages/cli-build/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
"node": ">=12"
1212
},
1313
"scripts": {
14-
"build": "cross-env NODE_ENV=production babel src --out-dir dist --root-mode upward",
14+
"build": "node ../../scripts/build",
1515
"lint": "eslint --ignore-path ../../.gitignore .",
1616
"postbuild": "oclif-dev manifest",
1717
"readme": "oclif-dev readme",
1818
"test": "node ../../scripts/test",
19-
"test:coverage": "nyc yarn test"
19+
"test:coverage": "yarn test --coverage"
2020
},
2121
"publishConfig": {
2222
"access": "public"

β€Žpackages/cli-command/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"node": ">=12"
1313
},
1414
"scripts": {
15-
"build": "cross-env NODE_ENV=production babel src --out-dir dist --root-mode upward",
15+
"build": "node ../../scripts/build",
1616
"lint": "eslint --ignore-path ../../.gitignore .",
1717
"test": "node ../../scripts/test",
18-
"test:coverage": "nyc yarn test",
18+
"test:coverage": "yarn test --coverage",
1919
"test:types": "tsd"
2020
},
2121
"publishConfig": {

β€Žpackages/cli-config/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
"node": ">=12"
1212
},
1313
"scripts": {
14-
"build": "cross-env NODE_ENV=production babel src --out-dir dist --root-mode upward",
14+
"build": "node ../../scripts/build",
1515
"lint": "eslint --ignore-path ../../.gitignore .",
1616
"postbuild": "oclif-dev manifest",
1717
"readme": "oclif-dev readme",
1818
"test": "node ../../scripts/test",
19-
"test:coverage": "nyc yarn test"
19+
"test:coverage": "yarn test --coverage"
2020
},
2121
"publishConfig": {
2222
"access": "public"

β€Žpackages/cli-exec/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"node": ">=12"
1313
},
1414
"scripts": {
15-
"build": "cross-env NODE_ENV=production babel src --out-dir dist --root-mode upward",
15+
"build": "node ../../scripts/build",
1616
"lint": "eslint --ignore-path ../../.gitignore .",
1717
"postbuild": "oclif-dev manifest",
1818
"readme": "oclif-dev readme",
1919
"test": "node ../../scripts/test",
20-
"test:coverage": "nyc yarn test"
20+
"test:coverage": "yarn test --coverage"
2121
},
2222
"publishConfig": {
2323
"access": "public"

β€Žpackages/cli-snapshot/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
"node": ">=12"
1212
},
1313
"scripts": {
14-
"build": "cross-env NODE_ENV=production babel src --out-dir dist --root-mode upward",
14+
"build": "node ../../scripts/build",
1515
"lint": "eslint --ignore-path ../../.gitignore .",
1616
"postbuild": "oclif-dev manifest",
1717
"readme": "oclif-dev readme",
1818
"test": "node ../../scripts/test",
19-
"test:coverage": "nyc yarn test"
19+
"test:coverage": "yarn test --coverage"
2020
},
2121
"publishConfig": {
2222
"access": "public"

β€Žpackages/cli-upload/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
"node": ">=12"
1212
},
1313
"scripts": {
14-
"build": "cross-env NODE_ENV=production babel src --out-dir dist --root-mode upward",
14+
"build": "node ../../scripts/build",
1515
"lint": "eslint --ignore-path ../../.gitignore .",
1616
"postbuild": "oclif-dev manifest",
1717
"readme": "oclif-dev readme",
1818
"test": "node ../../scripts/test",
19-
"test:coverage": "nyc yarn test"
19+
"test:coverage": "yarn test --coverage"
2020
},
2121
"publishConfig": {
2222
"access": "public"

β€Žpackages/cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"scripts": {
1818
"lint": "eslint --ignore-path ../../.gitignore .",
1919
"test": "node ../../scripts/test",
20-
"test:coverage": "nyc yarn test"
20+
"test:coverage": "yarn test --coverage"
2121
},
2222
"publishConfig": {
2323
"access": "public"

β€Žpackages/client/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"node": ">=12"
1212
},
1313
"scripts": {
14-
"build": "cross-env NODE_ENV=production babel src --out-dir dist --root-mode upward",
14+
"build": "node ../../scripts/build",
1515
"lint": "eslint --ignore-path ../../.gitignore .",
1616
"test": "node ../../scripts/test",
17-
"test:coverage": "nyc yarn test"
17+
"test:coverage": "yarn test --coverage"
1818
},
1919
"publishConfig": {
2020
"access": "public"

β€Žpackages/config/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"node": ">=12"
1313
},
1414
"scripts": {
15-
"build": "cross-env NODE_ENV=production babel src --out-dir dist --root-mode upward",
15+
"build": "node ../../scripts/build",
1616
"lint": "eslint --ignore-path ../../.gitignore .",
1717
"test": "node ../../scripts/test",
18-
"test:coverage": "nyc yarn test",
18+
"test:coverage": "yarn test --coverage",
1919
"test:types": "tsd"
2020
},
2121
"publishConfig": {

β€Žpackages/core/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
"node": ">=12"
1515
},
1616
"scripts": {
17-
"build": "cross-env NODE_ENV=production babel src --out-dir dist --root-mode upward",
17+
"build": "node ../../scripts/build",
1818
"lint": "eslint --ignore-path ../../.gitignore .",
1919
"postinstall": "node ./post-install",
2020
"test": "node ../../scripts/test",
21-
"test:coverage": "nyc yarn test",
21+
"test:coverage": "yarn test --coverage",
2222
"test:types": "tsd"
2323
},
2424
"publishConfig": {

β€Žpackages/dom/karma.conf.js

-108
This file was deleted.

0 commit comments

Comments
Β (0)