Compare commits

...

95 commits
v2.0.0 ... main

Author SHA1 Message Date
renovate[bot]
5486566b59
chore(deps): update dependency ts-jest to v29.1.0 (#314)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-11 00:43:23 -04:00
renovate[bot]
993fc1df07
chore(deps): update dependency @types/node to v18.15.11 (#313)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-11 00:40:33 -04:00
renovate[bot]
241b69de25
chore(deps): update dependency rome to v12 (#312)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-11 00:34:26 -04:00
77083da638
chore: leftovers from eslint, prettier, yvm (#311) 2023-03-26 12:07:23 -04:00
f591e1b968
build: use rome as linter+formatter (#310) 2023-03-26 11:51:35 -04:00
renovate[bot]
3c8cb50170
chore(deps): update dependency prettier to v2.8.7 (#309)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-26 11:05:24 -04:00
renovate[bot]
add6f86f0a
chore(deps): update dependency @types/node to v18.15.6 (#308)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-26 10:18:19 -04:00
2d35bfd890
ci: update target branch after rename 2023-03-22 00:58:31 -04:00
renovate[bot]
e4e90d4f8d
chore(deps): update dependency prettier to v2.8.6 (#304)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-22 00:56:25 -04:00
renovate[bot]
e6263de79e
chore(deps): update codecov/codecov-action action to v3 (#300)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-22 00:46:43 -04:00
renovate[bot]
7e2e8b2bd1
chore(deps): update node.js to v18.15.0 (#305)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-22 00:44:22 -04:00
38cd4289e9
Ci/caching (#306)
* ci: add caching to CI

* ci: job dependencies

* ci: typo in ci func

ci: typo in ci func

ci: typo in ci func

ci: typo in ci func

ci: typo in ci func
2023-03-22 00:41:07 -04:00
0a2e11a67e
Build/update all the things (#303)
* build: devDependencies, yarn, node

* build: typescript+ts-jest compatibility

* ci: drop node@12, run on 14,16,18

* build: adjust linter

* test: fix assumption based on node version
2023-03-22 00:15:39 -04:00
renovate[bot]
0f82bfbdb5
chore(deps): update actions/setup-node action to v3 (#299)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-21 01:33:59 -04:00
renovate[bot]
143d281752
chore(deps): update actions/checkout action to v3 (#297)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-09 13:35:52 -05:00
renovate[bot]
827af7d2f2
chore(deps): update dependency ts-jest to v27.0.3 (#282)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-06-06 14:26:17 -04:00
renovate[bot]
bebb222c26
chore(deps): update dependency @tophat/eslint-config to v0.9.0 (#265)
* chore(deps): update dependency @tophat/eslint-config to v0.9.0

* chore: lintfix

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Marc Cataford <mcat@riseup.net>
2021-06-05 12:21:47 -04:00
Marc Cataford
58e2c74a4d
chore: leftover (#280) 2021-06-05 11:32:20 -04:00
Marc Cataford
2ec9c0e533
build: transition to Typescript without Babel (#252)
* build: ts-jest

* build: yarn latest

* build: no babel

* chore: lint

* refactor: test, types
2021-06-05 11:29:15 -04:00
Marc Cataford
548213968a
ci: push on master (#279) 2021-06-05 11:15:04 -04:00
renovate[bot]
86e6d47adf
chore(deps): update dependency eslint-plugin-prettier to v3.4.0 (#270)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Marc Cataford <c.marcandre@gmail.com>
2021-06-05 11:07:05 -04:00
renovate[bot]
60d7b5775b
chore(deps): update dependency prettier to v2.3.1 (#271)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Marc Cataford <c.marcandre@gmail.com>
2021-06-05 11:04:40 -04:00
renovate[bot]
606cb4d607
chore(deps): update dependency @types/node to v14.17.2 (#266)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Marc Cataford <c.marcandre@gmail.com>
2021-06-05 11:02:49 -04:00
renovate[bot]
6817fe9783
chore(deps): update actions/checkout action to v2 (#274)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Marc Cataford <c.marcandre@gmail.com>
2021-06-05 10:58:26 -04:00
Marc Cataford
5b34811a79
chore: dependabot config leftover (#278) 2021-06-05 10:56:47 -04:00
renovate[bot]
d14e47274f
chore(deps): update dependency eslint-config-prettier to v8 (#276)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Marc Cataford <c.marcandre@gmail.com>
2021-06-05 10:56:19 -04:00
renovate[bot]
3e61c3adb8
chore(deps): update actions/setup-node action to v2 (#275)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-06-05 10:55:52 -04:00
renovate[bot]
3ca6748593
chore(deps): update dependency jest to v27 (#277)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-06-05 10:53:27 -04:00
renovate[bot]
a65f0371e2
chore(deps): update dependency @types/jest to v26.0.23 (#255)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-06-03 23:53:52 -04:00
renovate[bot]
14be95d0ac
Add renovate.json (#253)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-06-03 23:48:19 -04:00
dependabot-preview[bot]
fbb4bf5260
Upgrade to GitHub-native Dependabot (#221)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-05-08 22:40:01 -04:00
Marc Cataford
19cafbf7f9
refactor: more cleanup (#195)
* build: unused dep, add prepack

* docs: unused badge
2021-03-19 17:15:57 -04:00
Marc Cataford
5c1ec76feb
ci: manual releases (#194)
* ci: manual releases

* build: unused dep
2021-03-19 17:09:47 -04:00
Marc Cataford
5e1dec842a
refactor: more cleanup (#164)
* chore: misplaced test file

* refactor: rename, async main

* refactor: fix types

* chore: type args

* refactor: extract package root invariant

* refactor: error behaviour on limit exceeded

* test: more precise error cov

* refactor: extract logging

* refactor: logger

* test: index fix

* refactor: move mocking downstream
2021-03-19 16:49:27 -04:00
Marc Cataford
72673970c0
refactor: mockless tests (#163)
* refactor: parametrize cwd

* test: set up helpers and validate

* refactor: remove mocks from tests

* ci: bump node

* build: bump node

* refactor: extract utils, hoist cwd up

* test: cov utils
2021-02-18 23:31:33 -05:00
Marc Cataford
5446dc4df2 chore: unbork yarn 2021-02-18 22:00:14 -05:00
dependabot-preview[bot]
da74b4d9fb
build(deps-dev): bump eslint-config-prettier from 6.11.0 to 7.2.0 (#156)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.11.0 to 7.2.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.11.0...v7.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-02-17 22:38:11 -05:00
dependabot-preview[bot]
8275f7674e
build(deps-dev): bump eslint-plugin-jest from 23.20.0 to 24.1.5 (#161)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.20.0 to 24.1.5.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.20.0...v24.1.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-02-17 22:34:31 -05:00
Marc Cataford
ac1adaa22f
build: switch to berry (#162)
* build: switch to berry

* ci: deprecated opt
2021-02-17 21:34:44 -05:00
Marc Cataford
401196d62a
refactor: move to Typescript (#146)
* chore: add swap files to ignores

* chore: set up typescript deps

* refactor: rough conversion

* chore: linting config

* refactor: isolate untestable bits

* chore: runtime mapping

* chore: move tests
2020-12-12 19:18:25 -05:00
dependabot-preview[bot]
034f4e4089
build(deps-dev): bump @babel/cli from 7.10.5 to 7.12.10 (#143)
Bumps [@babel/cli](https://github.com/babel/babel/tree/HEAD/packages/babel-cli) from 7.10.5 to 7.12.10.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.10/packages/babel-cli)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-12 10:26:35 -05:00
dependabot-preview[bot]
0d39f4b681
build(deps-dev): bump @babel/core from 7.11.1 to 7.12.10 (#144)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.11.1 to 7.12.10.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.10/packages/babel-core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-11 18:22:15 -05:00
dependabot-preview[bot]
32308e8f02
build(deps): [security] bump ini from 1.3.5 to 1.3.7 (#145)
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7. **This update includes a security fix.**
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-11 18:10:42 -05:00
dependabot-preview[bot]
d2be716818
build(deps-dev): bump jest from 26.2.1 to 26.2.2 (#82)
Bumps [jest](https://github.com/facebook/jest) from 26.2.1 to 26.2.2.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v26.2.1...v26.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-09 16:24:05 -04:00
dependabot-preview[bot]
4efe5230ca
build(deps-dev): bump @babel/core from 7.11.0 to 7.11.1 (#83)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.11.0 to 7.11.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.11.1/packages/babel-core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-09 15:04:10 -04:00
dependabot-preview[bot]
79ee5b8347
build(deps-dev): bump eslint-plugin-jest from 23.18.0 to 23.20.0 (#76)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.18.0 to 23.20.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.18.0...v23.20.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-01 12:05:17 -04:00
dependabot-preview[bot]
3f93c82674
build(deps-dev): bump eslint from 7.4.0 to 7.6.0 (#81)
Bumps [eslint](https://github.com/eslint/eslint) from 7.4.0 to 7.6.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.4.0...v7.6.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-01 11:45:38 -04:00
dependabot-preview[bot]
e2e7d4f837
build(deps-dev): bump @babel/core from 7.10.5 to 7.11.0 (#78)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.10.5 to 7.11.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.11.0/packages/babel-core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-01 10:39:52 -04:00
dependabot-preview[bot]
5609d92832
build(deps-dev): bump @babel/preset-env from 7.10.4 to 7.11.0 (#79)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.10.4 to 7.11.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.11.0/packages/babel-preset-env)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-01 10:31:50 -04:00
dependabot-preview[bot]
3eca41cb99
build(deps-dev): bump jest from 26.1.0 to 26.2.1 (#80)
Bumps [jest](https://github.com/facebook/jest) from 26.1.0 to 26.2.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v26.1.0...v26.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-31 08:27:03 -04:00
dependabot-preview[bot]
d616d38486
build(deps-dev): bump eslint-plugin-prettier from 3.1.3 to 3.1.4 (#51)
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v3.1.3...v3.1.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-15 20:32:47 -04:00
dependabot-preview[bot]
24e5404cae
build(deps-dev): bump @tophat/eslint-config from 0.6.1 to 0.7.0 (#58)
Bumps [@tophat/eslint-config](https://github.com/tophat/eslint-config) from 0.6.1 to 0.7.0.
- [Release notes](https://github.com/tophat/eslint-config/releases)
- [Changelog](https://github.com/tophat/eslint-config/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tophat/eslint-config/compare/v0.6.1...v0.7.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-15 20:09:21 -04:00
dependabot-preview[bot]
b845124433
build(deps-dev): bump jest from 26.0.1 to 26.1.0 (#61)
Bumps [jest](https://github.com/facebook/jest) from 26.0.1 to 26.1.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v26.0.1...v26.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-15 19:50:44 -04:00
dependabot-preview[bot]
7ad46696f9
build(deps-dev): bump semantic-release from 17.0.8 to 17.1.1 (#62)
Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 17.0.8 to 17.1.1.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](https://github.com/semantic-release/semantic-release/compare/v17.0.8...v17.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-15 19:44:58 -04:00
dependabot-preview[bot]
58a6956f92
build(deps-dev): bump eslint-plugin-import from 2.21.2 to 2.22.0 (#63)
Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.21.2 to 2.22.0.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.21.2...v2.22.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-15 19:40:50 -04:00
dependabot-preview[bot]
31d76f17f6
build(deps-dev): bump @babel/core from 7.10.4 to 7.10.5 (#71)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.10.4 to 7.10.5.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.5/packages/babel-core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-15 19:34:54 -04:00
dependabot-preview[bot]
b8eeb40145
build(deps-dev): bump @babel/cli from 7.10.4 to 7.10.5 (#72)
Bumps [@babel/cli](https://github.com/babel/babel/tree/HEAD/packages/babel-cli) from 7.10.4 to 7.10.5.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.5/packages/babel-cli)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-15 19:25:22 -04:00
dependabot-preview[bot]
94a8011214
build(deps-dev): bump @babel/preset-env from 7.10.2 to 7.10.4 (#64)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.10.2 to 7.10.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.4/packages/babel-preset-env)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-11 21:36:58 -04:00
dependabot-preview[bot]
dd139e659d
build(deps-dev): bump @babel/cli from 7.10.1 to 7.10.4 (#65)
Bumps [@babel/cli](https://github.com/babel/babel/tree/HEAD/packages/babel-cli) from 7.10.1 to 7.10.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.4/packages/babel-cli)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-11 21:00:04 -04:00
dependabot-preview[bot]
d0fd8358be
build(deps-dev): bump @babel/core from 7.10.2 to 7.10.4 (#66)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.10.2 to 7.10.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.4/packages/babel-core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-11 20:46:02 -04:00
dependabot-preview[bot]
923f9865f1
build(deps-dev): bump eslint-plugin-jest from 23.13.2 to 23.18.0 (#67)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.13.2 to 23.18.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.13.2...v23.18.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-11 18:31:53 -04:00
dependabot-preview[bot]
227bae7321
build(deps-dev): bump eslint from 7.2.0 to 7.4.0 (#68)
Bumps [eslint](https://github.com/eslint/eslint) from 7.2.0 to 7.4.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.2.0...v7.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-11 18:08:57 -04:00
dependabot-preview[bot]
36c458e744
build(deps): [security] bump npm from 6.14.1 to 6.14.6 (#69)
Bumps [npm](https://github.com/npm/cli) from 6.14.1 to 6.14.6. **This update includes a security fix.**
- [Release notes](https://github.com/npm/cli/releases)
- [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md)
- [Commits](https://github.com/npm/cli/compare/v6.14.1...v6.14.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-11 17:59:25 -04:00
dependabot-preview[bot]
97eff14aa5
build(deps): [security] bump npm-registry-fetch from 4.0.3 to 4.0.5 (#70)
Bumps [npm-registry-fetch](https://github.com/npm/registry-fetch) from 4.0.3 to 4.0.5. **This update includes a security fix.**
- [Release notes](https://github.com/npm/registry-fetch/releases)
- [Changelog](https://github.com/npm/npm-registry-fetch/blob/latest/CHANGELOG.md)
- [Commits](https://github.com/npm/registry-fetch/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-11 17:52:35 -04:00
dependabot-preview[bot]
3bbff855b4
build(deps-dev): bump eslint-plugin-import from 2.21.1 to 2.21.2 (#50)
Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.21.1 to 2.21.2.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.21.1...v2.21.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-10 08:40:17 -04:00
dependabot-preview[bot]
f4e457cdc7
build(deps-dev): bump @babel/preset-env from 7.10.1 to 7.10.2 (#46)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.10.1 to 7.10.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.2/packages/babel-preset-env)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-09 10:37:29 -04:00
dependabot-preview[bot]
23cde8502d
build(deps-dev): bump @babel/core from 7.10.1 to 7.10.2 (#47)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.10.1 to 7.10.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.2/packages/babel-core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-09 10:24:44 -04:00
dependabot-preview[bot]
c4b5617c56
build(deps-dev): bump eslint-plugin-import from 2.20.2 to 2.21.1 (#48)
Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.20.2 to 2.21.1.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.20.2...v2.21.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-09 09:55:55 -04:00
dependabot-preview[bot]
520728bff5
build(deps-dev): bump eslint from 7.1.0 to 7.2.0 (#49)
Bumps [eslint](https://github.com/eslint/eslint) from 7.1.0 to 7.2.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.1.0...v7.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-09 08:05:40 -04:00
dependabot-preview[bot]
3dbf478f6d
build(deps-dev): bump eslint from 7.0.0 to 7.1.0 (#37)
Bumps [eslint](https://github.com/eslint/eslint) from 7.0.0 to 7.1.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.0.0...v7.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-28 08:52:36 -04:00
dependabot-preview[bot]
13f198b50d
build(deps-dev): bump semantic-release from 17.0.7 to 17.0.8 (#38)
Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 17.0.7 to 17.0.8.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](https://github.com/semantic-release/semantic-release/compare/v17.0.7...v17.0.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-28 08:48:28 -04:00
dependabot-preview[bot]
cb69857691
build(deps-dev): bump eslint-plugin-jest from 23.13.1 to 23.13.2 (#40)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.13.1 to 23.13.2.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.13.1...v23.13.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-28 08:44:24 -04:00
dependabot-preview[bot]
ccfe9e034b
build(deps-dev): bump @babel/preset-env from 7.9.6 to 7.10.1 (#43)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.9.6 to 7.10.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.1/packages/babel-preset-env)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-28 08:28:00 -04:00
dependabot-preview[bot]
71e4d93140
build(deps-dev): bump @babel/cli from 7.8.4 to 7.10.1 (#44)
Bumps [@babel/cli](https://github.com/babel/babel/tree/HEAD/packages/babel-cli) from 7.8.4 to 7.10.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.1/packages/babel-cli)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-28 08:20:00 -04:00
dependabot-preview[bot]
b7afc6fb85
build(deps-dev): bump @babel/core from 7.9.6 to 7.10.1 (#45)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.9.6 to 7.10.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.1/packages/babel-core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-28 08:14:50 -04:00
dependabot-preview[bot]
9782699ff0
build(deps-dev): bump eslint-plugin-jest from 23.10.0 to 23.13.1 (#36)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.10.0 to 23.13.1.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.10.0...v23.13.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-23 11:27:42 -04:00
dependabot-preview[bot]
e4fd9b385e
build(deps-dev): bump eslint-plugin-jest from 23.9.0 to 23.10.0 (#33)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.9.0 to 23.10.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.9.0...v23.10.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-12 09:56:53 -04:00
dependabot-preview[bot]
ef9e514fed
build(deps-dev): bump eslint from 6.8.0 to 7.0.0 (#34)
Bumps [eslint](https://github.com/eslint/eslint) from 6.8.0 to 7.0.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v6.8.0...v7.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-12 09:49:28 -04:00
dependabot-preview[bot]
13b773a0f5
build(deps-dev): bump eslint-plugin-jest from 23.8.0 to 23.9.0 (#25)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.8.0 to 23.9.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.8.0...v23.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-06 17:43:27 -04:00
dependabot-preview[bot]
429fbe5e60
build(deps-dev): bump @babel/core from 7.8.6 to 7.9.6 (#27)
Bumps [@babel/core](https://github.com/babel/babel) from 7.8.6 to 7.9.6.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/compare/v7.8.6...v7.9.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-06 17:34:04 -04:00
dependabot-preview[bot]
3deaa55445
build(deps): [security] bump acorn from 7.1.0 to 7.1.1 (#32)
Bumps [acorn](https://github.com/acornjs/acorn) from 7.1.0 to 7.1.1. **This update includes security fixes.**
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/7.1.0...7.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Marc Cataford <c.marcandre@gmail.com>
2020-05-06 17:27:17 -04:00
dependabot-preview[bot]
37ca97aa26
build(deps-dev): bump eslint-config-prettier from 6.10.0 to 6.11.0 (#28)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.10.0 to 6.11.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.10.0...v6.11.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 09:51:34 -04:00
dependabot-preview[bot]
0f80d8db06
build(deps-dev): bump @tophat/eslint-config from 0.6.0 to 0.6.1 (#29)
Bumps [@tophat/eslint-config](https://github.com/tophat/eslint-config) from 0.6.0 to 0.6.1.
- [Release notes](https://github.com/tophat/eslint-config/releases)
- [Changelog](https://github.com/tophat/eslint-config/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tophat/eslint-config/compare/v0.6.0...v0.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 09:47:04 -04:00
dependabot-preview[bot]
77c458c20c
build(deps-dev): bump jest from 25.1.0 to 26.0.1 (#30)
Bumps [jest](https://github.com/facebook/jest) from 25.1.0 to 26.0.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v25.1.0...v26.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 09:42:18 -04:00
dependabot-preview[bot]
54ece0f127
build(deps-dev): bump semantic-release from 17.0.4 to 17.0.7 (#31)
Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 17.0.4 to 17.0.7.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](https://github.com/semantic-release/semantic-release/compare/v17.0.4...v17.0.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 09:37:40 -04:00
Marc Cataford
a932a81300
Better documentation (#19)
* docs: tips, tricks and links

* docs: tweaks

* docs: first-run details
2020-05-01 22:08:06 -04:00
dependabot-preview[bot]
f2dafe15ec
build(deps-dev): bump @babel/preset-env from 7.8.7 to 7.9.6 (#24)
Bumps [@babel/preset-env](https://github.com/babel/babel) from 7.8.7 to 7.9.6.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/compare/v7.8.7...v7.9.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-01 21:52:35 -04:00
dependabot-preview[bot]
5e77ce11c8
build(deps-dev): bump mock-fs from 4.11.0 to 4.12.0 (#23)
Bumps [mock-fs](https://github.com/tschaub/mock-fs) from 4.11.0 to 4.12.0.
- [Release notes](https://github.com/tschaub/mock-fs/releases)
- [Changelog](https://github.com/tschaub/mock-fs/blob/master/changelog.md)
- [Commits](https://github.com/tschaub/mock-fs/compare/v4.11.0...v4.12.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-01 21:48:54 -04:00
dependabot-preview[bot]
bb42bdd362
build(deps-dev): bump prettier from 1.19.1 to 2.0.5 (#22)
Bumps [prettier](https://github.com/prettier/prettier) from 1.19.1 to 2.0.5.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/1.19.1...2.0.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-01 21:45:26 -04:00
dependabot-preview[bot]
f264079e33
build(deps-dev): bump eslint-plugin-prettier from 3.1.2 to 3.1.3 (#20)
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v3.1.2...v3.1.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-01 21:41:52 -04:00
dependabot-preview[bot]
1839184785
build(deps-dev): bump eslint-plugin-import from 2.20.1 to 2.20.2 (#21)
Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.20.1 to 2.20.2.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.20.1...v2.20.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-01 21:38:01 -04:00
Marc Cataford
278f86e5cd
Add messaging around first-run behaviour (#17)
* wip: add messaging

* chore: typo
2020-05-01 21:30:42 -04:00
Marc Cataford
7d120b14c0 ci: build can be parallel with lint 2020-05-01 21:05:38 -04:00
dependabot[bot]
98686a319d
build(deps): bump acorn from 6.4.0 to 6.4.1 (#14)
Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.4.0...6.4.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-03-22 20:50:39 -04:00
allcontributors[bot]
6b94792932
docs: add msrose as a contributor (#13)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-03-08 13:19:42 -04:00
29 changed files with 5427 additions and 8749 deletions

View file

@ -25,7 +25,8 @@
"profile": "http://msrose.github.io", "profile": "http://msrose.github.io",
"contributions": [ "contributions": [
"infra", "infra",
"doc" "doc",
"code"
] ]
} }
], ],

View file

@ -1,6 +0,0 @@
module.exports = {
extends: [
"@tophat/eslint-config/base",
"@tophat/eslint-config/jest",
]
}

View file

@ -1,71 +1,102 @@
name: packwatch CI name: packwatch CI
on: [push, pull_request] on:
pull_request:
push:
branches: [main]
jobs: jobs:
lint: dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: yarn
- run: yarn lint
test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
node-version: [10.x, 12.x] node-version: [14, 16, 18]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3
uses: actions/setup-node@v1
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- run: yarn - uses: actions/cache@v3
- run: yarn test:coverage id: dependencies-cache
env:
cache-name: dependencies-cache
with:
path: .yarn
key: ${{ runner.os }}-build-${{env.cache-name}}-${{ hashFiles('**/yarn.lock') }}-node-${{ matrix.node-version }}
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
run: yarn
lint:
runs-on: ubuntu-latest
needs: dependencies
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/cache@v3
id: dependencies-cache
env:
cache-name: dependencies-cache
with:
path: .yarn
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}-node-18
- run: |
yarn
yarn lint
test:
runs-on: ubuntu-latest
needs: dependencies
strategy:
matrix:
node-version: [14, 16, 18]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v3
id: dependencies-cache
env:
cache-name: dependencies-cache
with:
path: .yarn
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}-node-${{ matrix.node-version }}
- run: |
yarn
yarn test:coverage
- name: Coverage - name: Coverage
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v3
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false fail_ci_if_error: false
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: test needs: dependencies
strategy: strategy:
matrix: matrix:
node-version: [10.x, 12.x] node-version: [14, 16, 18]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile - uses: actions/cache@v3
- run: yarn build id: dependencies-cache
release:
name: Release
runs-on: ubuntu-latest
needs: [build, lint, test]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Node setup
uses: actions/setup-node@v1
with:
node-version: 12
- name: Prepare
run: yarn && yarn build
- name: Release
env: env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} cache-name: dependencies-cache
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} with:
run: yarn semantic-release path: .yarn
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}-node-${{ matrix.node-version }}
- run: |
yarn
yarn build

30
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: packwatch release
on:
push:
tags:
- 'v*'
jobs:
release:
name: Release
runs-on: ubuntu-latest
needs: [build, lint, test]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Node setup
uses: actions/setup-node@v3
with:
node-version: 14
- name: Prepare
run: yarn && yarn build
- name: get tag
id: get_tag
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/v}
- name: Release
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn publish --access public --tag latest --new-version ${{steps.get_tag.outputs.tag}}

10
.gitignore vendored
View file

@ -6,6 +6,14 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
lerna-debug.log* lerna-debug.log*
# Yarntifacts
.yarn/*
!.yarn/releases
!.yarn/plugins
!.yarn/versions
!.yarn/sdks
.pnp.*
# Diagnostic reports (https://nodejs.org/api/report.html) # Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
@ -102,3 +110,5 @@ dist
# TernJS port file # TernJS port file
.tern-port .tern-port
*.sw[a-z]

2
.nvmrc
View file

@ -1 +1 @@
12 18.15.0

873
.yarn/releases/yarn-3.4.1.cjs vendored Executable file

File diff suppressed because one or more lines are too long

1
.yarnrc.yml Normal file
View file

@ -0,0 +1 @@
yarnPath: .yarn/releases/yarn-3.4.1.cjs

1
.yvmrc
View file

@ -1 +0,0 @@
1.22.0

31
BEST_PRACTICES.md Normal file
View file

@ -0,0 +1,31 @@
# Best Practices: tips and tricks to use Packwatch to its fullest
## Overview
Monitoring the footprint of the packages you publish can be a powerful first step towards being producing efficient, trim code that doesn't use more resources that it should and that is a no-brainer to adopt. This document compiles some suggestions on how to get the most out of packwatch for your project.
Got best practices questions or suggestions? Open an [issue](https://github.com/mcataford/packwatch/issues)!
### First-run
On the first-run, Packwatch will generate a manifest file that sets the package size and the limit to the same value. Following this, the run will return a non-zero status code. This is perfectly normal! This is meant to ensure that an initial run or a run without a manifest won't pass on CI. The next time you will run Packwatch, it will use the now-present manifest as a comparison point and proceed normally.
### Understanding `.packwatch.json`
The `.packwatch.json` file persisted in your project keeps track of the last reported package size that was commited to your version control system. At the moment, it consists of three keys:
- `packageSize`, representing the size of your package's archive as it is when packed using `npm pack`;
- `unpackedSize`, representing the _unpacked_ size of that package (i.e. once installed, what space do the published filed occupy on disk);
- `limit`, representing a threshold that will cause Packwatch to throw an error if crossed.
While the `packageSize` and `unpackedSize` are automatically populated when you update Packwatch's manifest, the `limit` value can be set manually so that you leave yourself some "head room" for growth.
#### Setting sensible thresholds
When Packwatch initializes its manifest, it will initialize the `limit` parameter to be equal to `packedSize` so that any increase in size will cause a failure. Once you determine what kind of growth you want to allow for, you can edit the manifest to increase the limit.__ Any automatic updates to the manifest will leave the `limit` value as-is__.
Setting a sensible limit is essential to avoiding "packwatch fatigue", a scenario in which packwatch fails every time your package size grows because the `limit` parameter is too close to the `packageSize` value. Usually, __having a limit that is more or less 5 kB above the `packageSize` will allow for growth while still preventing bloat to sneak in__. From there, you can readjust the `limit` value as your project grows so that the "head room" space between `packageSize` and `limit` stays adequate.
### Integrating Packwatch into your workflow
In order to monitor your project's growth accurately, it's preferrable to have Packwatch run both in your pre-commit hooks and CI pipeline. This way, you can catch bloat before commits are event pushed up and you can get another chance to catch undesired overgrowth before you merge in change bundles. This will also act as a reminder to keep the manifest up to date so that it doesn't go out sync.

View file

@ -7,7 +7,6 @@
[![codecov](https://codecov.io/gh/mcataford/packwatch/branch/master/graph/badge.svg)](https://codecov.io/gh/mcataford/packwatch) [![codecov](https://codecov.io/gh/mcataford/packwatch/branch/master/graph/badge.svg)](https://codecov.io/gh/mcataford/packwatch)
![packwatch CI](https://github.com/mcataford/packwatch/workflows/packwatch%20CI/badge.svg) ![packwatch CI](https://github.com/mcataford/packwatch/workflows/packwatch%20CI/badge.svg)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
## Overview ## Overview
@ -46,6 +45,8 @@ packwatch --update-manifest
Just commit your `.packwatch.json` manifest and you're good to go! Just commit your `.packwatch.json` manifest and you're good to go!
Check out [Packwatch's best practices tips and tricks](https://github.com/mcataford/packwatch/blob/master/BEST_PRACTICES.md) for some advice on how to make the most of it!
## Contributors ✨ ## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
@ -56,7 +57,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<table> <table>
<tr> <tr>
<td align="center"><a href="https://mcataford.github.io"><img src="https://avatars2.githubusercontent.com/u/6210361?v=4" width="100px;" alt=""/><br /><sub><b>Marc Cataford</b></sub></a><br /><a href="#ideas-mcataford" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/mcataford/packwatch/commits?author=mcataford" title="Code">💻</a> <a href="#infra-mcataford" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/mcataford/packwatch/commits?author=mcataford" title="Tests">⚠️</a> <a href="https://github.com/mcataford/packwatch/commits?author=mcataford" title="Documentation">📖</a></td> <td align="center"><a href="https://mcataford.github.io"><img src="https://avatars2.githubusercontent.com/u/6210361?v=4" width="100px;" alt=""/><br /><sub><b>Marc Cataford</b></sub></a><br /><a href="#ideas-mcataford" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/mcataford/packwatch/commits?author=mcataford" title="Code">💻</a> <a href="#infra-mcataford" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/mcataford/packwatch/commits?author=mcataford" title="Tests">⚠️</a> <a href="https://github.com/mcataford/packwatch/commits?author=mcataford" title="Documentation">📖</a></td>
<td align="center"><a href="http://msrose.github.io"><img src="https://avatars3.githubusercontent.com/u/3495264?v=4" width="100px;" alt=""/><br /><sub><b>Michael Rose</b></sub></a><br /><a href="#infra-msrose" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/mcataford/packwatch/commits?author=msrose" title="Documentation">📖</a></td> <td align="center"><a href="http://msrose.github.io"><img src="https://avatars3.githubusercontent.com/u/3495264?v=4" width="100px;" alt=""/><br /><sub><b>Michael Rose</b></sub></a><br /><a href="#infra-msrose" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/mcataford/packwatch/commits?author=msrose" title="Documentation">📖</a> <a href="https://github.com/mcataford/packwatch/commits?author=msrose" title="Code">💻</a></td>
</tr> </tr>
</table> </table>

View file

@ -1,5 +0,0 @@
{
"comments": false,
"ignore": ["**/*.test.js"],
"presets": [["@babel/preset-env", { "targets": { "node": 10 } }]]
}

View file

@ -1,3 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = { module.exports = {
transformIgnorePatterns: ['.test.js'], preset: 'ts-jest',
} testEnvironment: 'node',
};

View file

@ -1,7 +1,7 @@
{ {
"name": "packwatch", "name": "packwatch",
"version": "0.0.0", "version": "0.0.0",
"main": "dist/index.js", "main": "dist/cli.js",
"description": "📦👀 Keep an eye on your packages' footprint", "description": "📦👀 Keep an eye on your packages' footprint",
"keywords": [ "keywords": [
"npm", "npm",
@ -19,41 +19,31 @@
"author": "Marc Cataford <c.marcandre@gmail.com>", "author": "Marc Cataford <c.marcandre@gmail.com>",
"license": "MIT", "license": "MIT",
"files": [ "files": [
"dist/**/*.js" "dist/*.js"
], ],
"bin": "./dist/index.js", "bin": "./dist/cli.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/mcataford/packwatch.git" "url": "https://github.com/mcataford/packwatch.git"
}, },
"pre-commit": [
"lint",
"test"
],
"scripts": { "scripts": {
"prebuild": "rimraf dist", "prepack": "yarn build",
"build": "babel src -d dist", "prebuild": "rm -rf dist",
"lint": "eslint src *.js", "build": "tsc --project .",
"lint:fix": "yarn lint --fix", "lint": "yarn rome format src tests && yarn rome check src tests",
"test": "jest src", "lint:fix": "yarn rome format src tests --write && yarn rome check src tests --apply",
"test": "jest tests",
"test:watch": "yarn test --watchAll", "test:watch": "yarn test --watchAll",
"test:coverage": "yarn test --coverage" "test:coverage": "yarn test --coverage",
"types": "tsc --noEmit src/**/*.ts",
"types:watch": "yarn types --watch"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.8.4", "@types/jest": "^29.5.0",
"@babel/core": "^7.8.6", "@types/node": "^18.15.5",
"@babel/preset-env": "^7.8.7", "jest": "^29.5.0",
"@tophat/eslint-config": "^0.6.0", "rome": "^12.0.0",
"eslint": "^6.8.0", "ts-jest": "^29.0.5",
"eslint-config-prettier": "^6.10.0", "typescript": "^4.3.0"
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jest": "^23.8.0",
"eslint-plugin-prettier": "^3.1.2",
"jest": "^25.1.0",
"mock-fs": "^4.11.0",
"pre-commit": "^1.2.2",
"prettier": "^1.19.1",
"rimraf": "^3.0.2",
"semantic-release": "^17.0.4"
} }
} }

5
renovate.json Normal file
View file

@ -0,0 +1,5 @@
{
"extends": [
"config:base"
]
}

13
rome.json Normal file
View file

@ -0,0 +1,13 @@
{
"formatter": {
"enabled": true,
"lineWidth": 120
},
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"quoteStyle": "single"
}
}
}

9
src/cli.ts Normal file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env node
import packwatch from '.'
const isUpdatingManifest = process.argv.includes('--update-manifest')
const cwd = process.cwd()
packwatch({ cwd, isUpdatingManifest })
.catch(() => process.exit(1))
.then(() => process.exit(0))

View file

@ -1,73 +0,0 @@
const { spawnSync } = require('child_process')
const { readFileSync, writeFileSync } = require('fs')
const PACKAGE_SIZE_PATT = /package size:\s+([0-9]+\.?[0-9]*\s+[A-Za-z]+)/g
const UNPACKED_SIZE_PATT = /unpacked size:\s+([0-9]+\.?[0-9]*\s+[A-Za-z]+)/g
const SIZE_SUFFIX_PATT = /([A-Za-z]+)/
const SIZE_MAGNITUDE_PATT = /([0-9]+\.?[0-9]*)/
const MANIFEST_FILENAME = '.packwatch.json'
const FS_OPTIONS = { encoding: 'utf-8' }
function convertSizeToBytes(sizeString) {
const sizeSuffix = SIZE_SUFFIX_PATT.exec(sizeString)[1]
const sizeMagnitude = SIZE_MAGNITUDE_PATT.exec(sizeString)[1]
let multiplier = 1
if (sizeSuffix === 'kB') multiplier = 1000
else if (sizeSuffix === 'mB') {
multiplier = 1000000
}
return multiplier * parseFloat(sizeMagnitude)
}
function getCurrentPackageStats() {
const { stderr } = spawnSync('npm', ['pack', '--dry-run'], FS_OPTIONS)
const packageSize = PACKAGE_SIZE_PATT.exec(stderr)[1]
const unpackedSize = UNPACKED_SIZE_PATT.exec(stderr)[1]
return {
packageSize,
unpackedSize,
packageSizeBytes: convertSizeToBytes(packageSize),
unpackedSizeBytes: convertSizeToBytes(unpackedSize),
}
}
function getPreviousPackageStats() {
try {
const currentManifest = readFileSync(MANIFEST_FILENAME, FS_OPTIONS)
const parsedManifest = JSON.parse(currentManifest)
return {
...parsedManifest,
packageSizeBytes: convertSizeToBytes(parsedManifest.packageSize),
unpackedSizeBytes: convertSizeToBytes(parsedManifest.unpackedSize),
limitBytes: convertSizeToBytes(parsedManifest.limit),
}
} catch (e) {
return {}
}
}
function createOrUpdateManifest({ previous, current, updateLimit = false }) {
const { limit } = previous || {}
const { packageSize, unpackedSize } = current
const newManifest = {
limit: updateLimit ? packageSize : limit || packageSize,
packageSize: packageSize,
unpackedSize: unpackedSize,
}
writeFileSync(MANIFEST_FILENAME, JSON.stringify(newManifest))
}
module.exports = {
createOrUpdateManifest,
getPreviousPackageStats,
getCurrentPackageStats,
convertSizeToBytes,
MANIFEST_FILENAME,
}

View file

@ -1,100 +0,0 @@
#!/usr/bin/env node
const { existsSync } = require('fs')
const {
MANIFEST_FILENAME,
getCurrentPackageStats,
getPreviousPackageStats,
createOrUpdateManifest,
} = require('./helpers')
if (!existsSync('package.json')) {
console.log(
'🤔 There is no package.json file here. Are you in the root directory of your project?',
)
process.exit(1)
}
const isUpdatingManifest = process.argv.includes('--update-manifest')
const currentStats = getCurrentPackageStats()
/*
* If there is no manifest file yet, we can use the current package stats as
* a base to build one. The current package size becomes the limit.
*/
if (!existsSync(MANIFEST_FILENAME)) {
createOrUpdateManifest({ current: currentStats })
console.log(
`📝 No Manifest to compare against! Current package stats written to ${MANIFEST_FILENAME}!`,
)
console.log(
`Package size (${currentStats.packageSize}) adopted as new limit.`,
)
// If the update flag wasn't specified, exit with a non-zero code so we
// don't "accidentally" pass CI builds if the manifest didn't exist
process.exit(isUpdatingManifest ? 0 : 1)
}
const previousStats = getPreviousPackageStats()
const { packageSizeBytes, packageSize } = currentStats
const {
packageSize: previousSize,
packageSizeBytes: previousSizeBytes,
limit,
limitBytes,
} = previousStats
const hasExceededLimit = packageSizeBytes > limitBytes
/*
* If we are updating the manifest, we can write right away and terminate.
*/
if (isUpdatingManifest) {
createOrUpdateManifest({
previous: previousStats,
current: currentStats,
updateLimit: true,
})
console.log(
`📝 Updated the manifest! Package size: ${packageSize}, Limit: ${packageSize}`,
)
process.exit(0)
}
/*
* If there is a manifest file and the current package busts its limit
* we signal it and terminate with an error.
*/
if (hasExceededLimit) {
console.log(
`🔥🔥📦🔥🔥 Your package exceeds the limit set in ${MANIFEST_FILENAME}! ${packageSize} > ${limit}`,
)
console.log(
'Either update the limit by using the --update-manifest flag or trim down your packed files!',
)
process.exit(1)
}
/*
* If there is a manifest file and the limit is not busted, we give
* the user some feedback on how the current package compares with
* the previous one.
*/
if (packageSizeBytes > previousSizeBytes) {
console.log(
`📦 👀 Your package grew! ${packageSize} > ${previousSize} (Limit: ${limit})`,
)
} else if (packageSizeBytes < previousSizeBytes) {
console.log(
`📦 💯 Your package shrank! ${packageSize} < ${previousSize} (Limit: ${limit})`,
)
} else {
console.log(
`📦 Nothing to report! Your package is the same size as the latest manifest reports! (Limit: ${limit})`,
)
}

View file

@ -1,177 +0,0 @@
const childProcess = require('child_process')
const { readFileSync } = require('fs')
const mockFS = require('mock-fs')
jest.mock('child_process')
childProcess.spawnSync = jest.fn(() => ({ stderr: mockPackOutput }))
const {
MANIFEST_FILENAME,
convertSizeToBytes,
getCurrentPackageStats,
getPreviousPackageStats,
createOrUpdateManifest,
} = require('./helpers')
const mockPackageSize = '1.1 kB'
const mockUnpackedSize = '9000 kB'
const mockPackOutput = `
npm notice
npm notice 📦 footprint@0.0.0
npm notice === Tarball Contents ===
npm notice 732B package.json
npm notice 1.8kB dist/helpers.js
npm notice 1.9kB dist/index.js
npm notice === Tarball Details ===
npm notice name: footprint
npm notice version: 0.0.0
npm notice filename: footprint-0.0.0.tgz
npm notice package size: ${mockPackageSize}
npm notice unpacked size: ${mockUnpackedSize}
npm notice shasum: bdf33d471543cd8126338a82a27b16a9010b8dbd
npm notice integrity: sha512-ZZvTg9GVcJw8J[...]bkE0xlqQhlt4Q==
npm notice total files: 3
npm notice
`
describe('Helpers', () => {
beforeEach(() => {
mockFS.restore()
jest.restoreAllMocks()
})
afterAll(mockFS.restore)
describe('Size string conversion', () => {
it.each`
sizeString | expectedValue
${'1 B'} | ${1}
${'1.1 B'} | ${1.1}
${'1 kB'} | ${1000}
${'1.1kB'} | ${1100}
${'1 mB'} | ${1000000}
${'1.1 mB'} | ${1100000}
`(
'converts $sizeString properly to $expectedValue bytes',
({ sizeString, expectedValue }) => {
expect(convertSizeToBytes(sizeString)).toEqual(expectedValue)
},
)
})
describe('Current package statistics', () => {
it('constructs the current package report properly', () => {
const packageSizeBytes = 1100
const unpackedSizeBytes = 9000000
expect(getCurrentPackageStats()).toEqual({
packageSize: mockPackageSize,
packageSizeBytes,
unpackedSize: mockUnpackedSize,
unpackedSizeBytes,
})
})
})
describe('Previous package statistics', () => {
it('constructs the previous package report properly', () => {
const packageSize = '0.9 kB'
const packageSizeBytes = 900
const unpackedSize = '90 kB'
const unpackedSizeBytes = 90000
const limit = '1 kB'
const limitBytes = 1000
const mockReport = { packageSize, unpackedSize, limit }
mockFS({ [MANIFEST_FILENAME]: JSON.stringify(mockReport) })
expect(getPreviousPackageStats()).toEqual({
packageSize,
packageSizeBytes,
unpackedSize,
unpackedSizeBytes,
limit,
limitBytes,
})
})
it('returns an empty manifest if it fails to reads the manifest file', () => {
mockFS({
[MANIFEST_FILENAME]: 'not valid JSON',
})
expect(getPreviousPackageStats()).toEqual({})
})
})
describe('Creating or updating the manifest', () => {
const currentStats = {
packageSize: '1 kB',
unpackedSize: '10 kB',
}
const previousManifest = {
limit: '2 kB',
packageSize: '1.5 kB',
}
it('creates a anifest from the current data if no previous data is provided', () => {
mockFS({})
createOrUpdateManifest({ current: currentStats })
const writtenManifest = readFileSync(MANIFEST_FILENAME, {
encoding: 'utf-8',
})
expect(JSON.parse(writtenManifest)).toEqual({
packageSize: currentStats.packageSize,
unpackedSize: currentStats.unpackedSize,
limit: currentStats.packageSize,
})
})
it('updates the previous manifest sizes if previous data exists', () => {
mockFS({
[MANIFEST_FILENAME]: JSON.stringify(previousManifest),
})
createOrUpdateManifest({
current: currentStats,
previous: previousManifest,
updateLimit: false,
})
const writtenManifest = readFileSync(MANIFEST_FILENAME, {
encoding: 'utf-8',
})
expect(JSON.parse(writtenManifest)).toEqual({
packageSize: currentStats.packageSize,
unpackedSize: currentStats.unpackedSize,
limit: previousManifest.limit,
})
})
it('updates the previous manifest sizes and limit if previous data exists and updateLimit is set', () => {
mockFS({
[MANIFEST_FILENAME]: JSON.stringify(previousManifest),
})
createOrUpdateManifest({
current: currentStats,
previous: previousManifest,
updateLimit: true,
})
const writtenManifest = readFileSync(MANIFEST_FILENAME, {
encoding: 'utf-8',
})
expect(JSON.parse(writtenManifest)).toEqual({
packageSize: currentStats.packageSize,
unpackedSize: currentStats.unpackedSize,
limit: currentStats.packageSize,
})
})
})
})

87
src/index.ts Normal file
View file

@ -0,0 +1,87 @@
import { existsSync } from 'fs'
import { join, resolve } from 'path'
import { assertInPackageRoot } from './invariants'
import logger from './logger'
import { createOrUpdateManifest, getCurrentPackageStats, getPreviousPackageStats, mergeDefaultArguments } from './utils'
import type { PackwatchArguments } from './types'
const MANIFEST_FILENAME = '.packwatch.json'
export default async function packwatch(args: Partial<PackwatchArguments>): Promise<void> {
const { cwd, isUpdatingManifest } = mergeDefaultArguments(args)
const manifestPath = resolve(join(cwd, MANIFEST_FILENAME))
assertInPackageRoot(cwd)
const currentStats = getCurrentPackageStats(cwd)
/*
* If there is no manifest file yet, we can use the current package stats as
* a base to build one. The current package size becomes the limit.
*/
if (!existsSync(manifestPath)) {
createOrUpdateManifest({ manifestPath, current: currentStats })
logger.warn(
`📝 No Manifest to compare against! Current package stats written to ${MANIFEST_FILENAME}!\nPackage size (${currentStats.packageSize}) adopted as new limit.`,
)
if (!isUpdatingManifest) {
logger.error(
'❗ It looks like you ran PackWatch without a manifest. To prevent accidental passes in CI or hooks, packwatch will terminate with an error. If you are running packwatch for the first time in your project, this is expected!',
)
throw new Error('NO_MANIFEST_NO_UPDATE')
}
return
}
const previousStats = getPreviousPackageStats(cwd)
const { packageSizeBytes, packageSize } = currentStats
const { packageSize: previousSize, packageSizeBytes: previousSizeBytes, limit, limitBytes } = previousStats
const hasExceededLimit = limitBytes && packageSizeBytes > limitBytes
/*
* If we are updating the manifest, we can write right away and terminate.
*/
if (isUpdatingManifest) {
createOrUpdateManifest({
previous: previousStats,
current: currentStats,
updateLimit: true,
manifestPath,
})
logger.log(`📝 Updated the manifest! Package size: ${packageSize}, Limit: ${packageSize}`)
return
}
/*
* If there is a manifest file and the current package busts its limit
* we signal it and terminate with an error.
*/
if (hasExceededLimit) {
logger.error(
`🔥🔥📦🔥🔥 Your package exceeds the limit set in ${MANIFEST_FILENAME}! ${packageSize} > ${limit}\nEither update the limit by using the --update-manifest flag or trim down your packed files!`,
)
throw new Error('PACKAGE_EXCEEDS_LIMIT')
}
/*
* If there is a manifest file and the limit is not busted, we give
* the user some feedback on how the current package compares with
* the previous one.
*/
if (packageSizeBytes > previousSizeBytes) {
logger.log(`📦 👀 Your package grew! ${packageSize} > ${previousSize} (Limit: ${limit})`)
} else if (packageSizeBytes < previousSizeBytes) {
logger.log(`📦 💯 Your package shrank! ${packageSize} < ${previousSize} (Limit: ${limit})`)
} else {
logger.log(`📦 Nothing to report! Your package is the same size as the latest manifest reports! (Limit: ${limit})`)
}
return
}

14
src/invariants.ts Normal file
View file

@ -0,0 +1,14 @@
import { existsSync } from 'fs'
import { join, resolve } from 'path'
import logger from './logger'
export function assertInPackageRoot(cwd: string): void {
const packagePath = resolve(join(cwd, 'package.json'))
const packageJsonExists = existsSync(packagePath)
if (!packageJsonExists) {
logger.log('🤔 There is no package.json file here. Are you in the root directory of your project?')
throw new Error('NOT_IN_PACKAGE_ROOT')
}
}

11
src/logger.ts Normal file
View file

@ -0,0 +1,11 @@
export default {
log: (...args: unknown[]): void => {
console.log(...args)
},
warn: (...args: unknown[]): void => {
console.warn(...args)
},
error: (...args: unknown[]): void => {
console.error(...args)
},
}

13
src/types.ts Normal file
View file

@ -0,0 +1,13 @@
export type PackwatchArguments = {
cwd: string
isUpdatingManifest: boolean
}
export type Report = {
packageSize: string
unpackedSize: string
packageSizeBytes: number
unpackedSizeBytes: number
limit?: string
limitBytes?: number
}

98
src/utils.ts Normal file
View file

@ -0,0 +1,98 @@
import { spawnSync } from 'child_process'
import { readFileSync, writeFileSync } from 'fs'
import { join, resolve } from 'path'
import { type PackwatchArguments, type Report } from './types'
const PACKAGE_SIZE_PATT = /package size:\s*([0-9]+\.?[0-9]*\s+[A-Za-z]{1,2})/
const UNPACKED_SIZE_PATT = /unpacked size:\s*([0-9]+\.?[0-9]*\s+[A-Za-z]{1,2})/
const SIZE_SUFFIX_PATT = /([A-Za-z]+)/
const SIZE_MAGNITUDE_PATT = /([0-9]+\.?[0-9]*)/
const MANIFEST_FILENAME = '.packwatch.json'
export function mergeDefaultArguments(args: Partial<PackwatchArguments>): PackwatchArguments {
return {
cwd: args.cwd ?? '.',
isUpdatingManifest: args.isUpdatingManifest ?? false,
}
}
export function convertSizeToBytes(sizeString: string): number {
const sizeSuffix = SIZE_SUFFIX_PATT.exec(sizeString)?.[1] ?? ''
const sizeMagnitude = SIZE_MAGNITUDE_PATT.exec(sizeString)?.[1] ?? '0.0'
let multiplier = 1
if (sizeSuffix === 'kB') multiplier = 1000
else if (sizeSuffix === 'mB') {
multiplier = 1000000
}
return multiplier * parseFloat(sizeMagnitude)
}
export function getCurrentPackageStats(cwd: string): Report {
const { stderr } = spawnSync('npm', ['pack', '--dry-run'], {
encoding: 'utf-8',
cwd,
})
const stderrString = String(stderr)
const packageSize = PACKAGE_SIZE_PATT.exec(stderrString)?.[1] ?? '0'
const unpackedSize = UNPACKED_SIZE_PATT.exec(stderrString)?.[1] ?? '0'
return {
packageSize,
unpackedSize,
packageSizeBytes: convertSizeToBytes(packageSize),
unpackedSizeBytes: convertSizeToBytes(unpackedSize),
}
}
export function getPreviousPackageStats(cwd: string): Report {
const manifestPath = resolve(join(cwd, MANIFEST_FILENAME))
try {
const currentManifest = readFileSync(manifestPath, {
encoding: 'utf-8',
})
const parsedManifest = JSON.parse(currentManifest)
return {
...parsedManifest,
packageSizeBytes: convertSizeToBytes(parsedManifest.packageSize),
unpackedSizeBytes: convertSizeToBytes(parsedManifest.unpackedSize),
limitBytes: convertSizeToBytes(parsedManifest.limit),
}
} catch {
/* No manifest */
return {
packageSize: '0',
packageSizeBytes: 0,
unpackedSizeBytes: 0,
unpackedSize: '0',
limitBytes: 0,
}
}
}
export function createOrUpdateManifest({
previous,
current,
manifestPath,
updateLimit = false,
}: {
previous?: Report
current: Report
manifestPath: string
updateLimit?: boolean
}): void {
const { limit } = previous || {}
const { packageSize, unpackedSize } = current
const newManifest = {
limit: updateLimit ? packageSize : limit || packageSize,
packageSize: packageSize,
unpackedSize: unpackedSize,
}
writeFileSync(manifestPath, JSON.stringify(newManifest))
}

234
tests/index.test.ts Normal file
View file

@ -0,0 +1,234 @@
import { promises as fs } from 'fs'
import { tmpdir } from 'os'
import { join, resolve } from 'path'
import packwatch from '../src'
import type { Report } from '../src/types'
let workspace: string | null
function getActualPackageSizeByNodeVersion(nodeVersion: string): string {
if (nodeVersion.startsWith('v14')) return '160'
else if (nodeVersion.startsWith('v16')) return '157'
else if (nodeVersion.startsWith('v18')) return '157'
return 'unknown'
}
async function prepareWorkspace(): Promise<string> {
const workspacePath = await fs.mkdtemp(`${tmpdir()}/`)
workspace = workspacePath
return workspacePath
}
async function cleanUpWorkspace(paths: string[]): Promise<void> {
await Promise.all(paths.map(async (path) => fs.rmdir(path, { recursive: true })))
}
async function createFile(path: string, content: string): Promise<void> {
await fs.writeFile(path, content)
}
async function createPackageJson(cwd: string): Promise<void> {
const path = resolve(join(cwd, 'package.json'))
await createFile(path, '{ "name": "wow", "version": "0.0.0", "files": ["!.packwatch.json"] }')
}
async function createManifest(cwd: string, configuration: Report): Promise<void> {
const path = resolve(join(cwd, '.packwatch.json'))
await createFile(path, JSON.stringify(configuration))
}
describe('Packwatch', () => {
const actualSize = getActualPackageSizeByNodeVersion(process.version)
afterEach(async () => {
jest.restoreAllMocks()
if (workspace) {
await cleanUpWorkspace([workspace])
workspace = null
}
})
it('warns the user and errors if run away from package.json', async () => {
const workspacePath = await prepareWorkspace()
const mockLogger = jest.spyOn(console, 'log')
await expect(async () => packwatch({ cwd: workspacePath })).rejects.toThrow('NOT_IN_PACKAGE_ROOT')
expect(mockLogger.mock.calls).toHaveLength(1)
expect(mockLogger.mock.calls[0][0]).toEqual(
expect.stringMatching('There is no package.json file here. Are you in the root directory of your project?'),
)
})
describe('without manifest', () => {
it('generates the initial manifest properly', async () => {
const workspacePath = await prepareWorkspace()
await createPackageJson(workspacePath)
await expect(async () => packwatch({ cwd: workspacePath })).rejects.toThrow('NO_MANIFEST_NO_UPDATE')
const generatedManifest = await fs.readFile(resolve(join(workspacePath, '.packwatch.json')), { encoding: 'utf8' })
expect(generatedManifest).toBe(
`{"limit":"${actualSize} B","packageSize":"${actualSize} B","unpackedSize":"68 B"}`,
)
})
it('outputs expected messaging', async () => {
const workspacePath = await prepareWorkspace()
const mockWarn = jest.spyOn(console, 'warn')
const mockError = jest.spyOn(console, 'error')
await createPackageJson(workspacePath)
await expect(async () => packwatch({ cwd: workspacePath })).rejects.toThrow()
expect(mockWarn.mock.calls).toHaveLength(1)
expect(mockWarn.mock.calls[0][0]).toEqual(
expect.stringMatching(
/No Manifest to compare against! Current package stats written to \.packwatch\.json!\nPackage size \(\d+ B\) adopted as new limit\./,
),
)
expect(mockError.mock.calls).toHaveLength(1)
expect(mockError.mock.calls[0][0]).toEqual(
expect.stringMatching(
'It looks like you ran PackWatch without a manifest. To prevent accidental passes in CI or hooks, packwatch will terminate with an error. If you are running packwatch for the first time in your project, this is expected!',
),
)
})
it('outputs expected messaging when not updating the manifest', async () => {
const mockWarn = jest.spyOn(console, 'warn')
const workspacePath = await prepareWorkspace()
await createPackageJson(workspacePath)
await packwatch({ cwd: workspacePath, isUpdatingManifest: true })
expect(mockWarn.mock.calls).toHaveLength(1)
expect(mockWarn.mock.calls[0][0]).toEqual(
expect.stringMatching(
/No Manifest to compare against! Current package stats written to \.packwatch\.json!\nPackage size \(\d+ B\) adopted as new limit\./,
),
)
})
})
describe('with manifest', () => {
it('messages when the size is equal to the limit', async () => {
const workspacePath = await prepareWorkspace()
const mockLogger = jest.spyOn(console, 'log')
await createPackageJson(workspacePath)
await createManifest(workspacePath, {
limit: `${actualSize}B`,
packageSize: `${actualSize}B`,
packageSizeBytes: Number(actualSize),
unpackedSize: '150B',
unpackedSizeBytes: 150,
})
await packwatch({ cwd: workspacePath })
expect(mockLogger.mock.calls).toHaveLength(1)
expect(mockLogger.mock.calls[0][0]).toEqual(
expect.stringMatching(/Nothing to report! Your package is the same size as the latest manifest reports!/),
)
})
it('messages when the size is lower than the limit (no growth)', async () => {
const workspacePath = await prepareWorkspace()
const mockLogger = jest.spyOn(console, 'log')
await createPackageJson(workspacePath)
await createManifest(workspacePath, {
limit: '170B',
packageSize: `${actualSize}B`,
packageSizeBytes: Number(actualSize),
unpackedSize: '150B',
unpackedSizeBytes: 150,
})
await packwatch({ cwd: workspacePath })
expect(mockLogger.mock.calls).toHaveLength(1)
expect(mockLogger.mock.calls[0][0]).toEqual(
expect.stringMatching(
/Nothing to report! Your package is the same size as the latest manifest reports! \(Limit: 170B\)/,
),
)
})
it('messages when the size is lower than the limit (growth)', async () => {
const workspacePath = await prepareWorkspace()
const mockLogger = jest.spyOn(console, 'log')
await createPackageJson(workspacePath)
await createManifest(workspacePath, {
limit: '180B',
packageSize: '150B',
packageSizeBytes: 150,
unpackedSize: '140B',
unpackedSizeBytes: 140,
})
await packwatch({ cwd: workspacePath })
expect(mockLogger.mock.calls).toHaveLength(1)
expect(mockLogger.mock.calls[0][0]).toEqual(
expect.stringMatching(/Your package grew! \d+ B > 150B \(Limit: 180B\)/),
)
})
it('messages when the size is lower than the limit (shrinkage)', async () => {
const workspacePath = await prepareWorkspace()
const mockLogger = jest.spyOn(console, 'log')
await createPackageJson(workspacePath)
await createManifest(workspacePath, {
limit: '180B',
packageSize: '170B',
packageSizeBytes: 170,
unpackedSize: '140B',
unpackedSizeBytes: 140,
})
await packwatch({ cwd: workspacePath })
expect(mockLogger.mock.calls).toHaveLength(1)
expect(mockLogger.mock.calls[0][0]).toEqual(
expect.stringMatching(/Your package shrank! \d+ B < 170B \(Limit: 180B\)/),
)
})
it('messages when the size exceeds the limit', async () => {
const workspacePath = await prepareWorkspace()
const mockError = jest.spyOn(console, 'error')
await createPackageJson(workspacePath)
await createManifest(workspacePath, {
limit: '10B',
packageSize: '170B',
packageSizeBytes: 170,
unpackedSize: '140B',
unpackedSizeBytes: 140,
})
await expect(async () => packwatch({ cwd: workspacePath })).rejects.toThrow('PACKAGE_EXCEEDS_LIMIT')
expect(mockError.mock.calls).toHaveLength(1)
expect(mockError.mock.calls[0][0]).toEqual(
expect.stringMatching(
/Your package exceeds the limit set in \.packwatch\.json! \d+ B > 10B\nEither update the limit by using the --update-manifest flag or trim down your packed files!/,
),
)
})
it('messages when updating the manifest', async () => {
const workspacePath = await prepareWorkspace()
const mockLogger = jest.spyOn(console, 'log')
await createPackageJson(workspacePath)
await createManifest(workspacePath, {
limit: '10B',
packageSize: '170B',
packageSizeBytes: 170,
unpackedSize: '140B',
unpackedSizeBytes: 140,
})
await packwatch({ cwd: workspacePath, isUpdatingManifest: true })
expect(mockLogger.mock.calls).toHaveLength(1)
expect(mockLogger.mock.calls[0][0]).toEqual(
expect.stringMatching(/Updated the manifest! Package size: \d+ B, Limit: \d+ B/),
)
})
})
})

12
tests/utils.test.ts Normal file
View file

@ -0,0 +1,12 @@
import { convertSizeToBytes } from '../src/utils'
describe('utils', () => {
it.each`
initialSize | expectedSize
${'1 B'} | ${1}
${'1 kB'} | ${1000}
${'1 mB'} | ${1000000}
`('converts sizes properly ($initialSize -> $expectedSize)', ({ initialSize, expectedSize }) => {
expect(convertSizeToBytes(initialSize)).toEqual(expectedSize)
})
})

22
tsconfig.json Normal file
View file

@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"allowJs": false,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./",
"removeComments": true,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src"],
"exclude": [
"dist/**/*",
"tests/**/*"
]
}

12168
yarn.lock

File diff suppressed because it is too large Load diff