diff --git a/.attw.json b/.attw.json new file mode 100644 index 00000000..a4bd686a --- /dev/null +++ b/.attw.json @@ -0,0 +1,7 @@ +{ + "color": true, + "emoji": true, + "format": "ascii", + "ignoreRules": ["cjs-resolves-to-esm"], + "summary": true +} diff --git a/.dictionary.txt b/.dictionary.txt index 6929249f..969d7ef9 100644 --- a/.dictionary.txt +++ b/.dictionary.txt @@ -1,4 +1,5 @@ ardatan +attw bdougie cefc commitlintrc diff --git a/.eslintignore b/.eslintignore index 1e90ed13..18c1c0ba 100644 --- a/.eslintignore +++ b/.eslintignore @@ -18,6 +18,7 @@ yarn.lock !**/__fixtures__/**/dist/ !**/__fixtures__/**/node_modules/ !**/typings/**/dist/ +!.attw.json !.codecov.yml !.commitlintrc.* !.cspell.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18f58cfe..6309cc5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -282,6 +282,9 @@ jobs: - gitguardian - preflight runs-on: ubuntu-latest + env: + TARFILE: | + ${{ startsWith(github.head_ref || github.ref_name, 'release/') && format('@{0}-{1}-{2}.tgz', github.repository_owner, github.event.repository.name, needs.preflight.outputs.version) || format('@{0}-{1}-{2}+{3}.tgz', github.repository_owner, github.event.repository.name, needs.preflight.outputs.version, github.event.pull_request.head.sha || github.sha) }} steps: - id: checkout name: Checkout ${{ env.REF_NAME }} @@ -302,12 +305,18 @@ jobs: with: key: ${{ runner.os }}-${{ github.run_id }} path: ${{ env.CACHE_PATH }} + - id: local-binaries + name: Add local binaries to $PATH + run: echo "$GITHUB_WORKSPACE/$CACHE_PATH/.bin" >> $GITHUB_PATH - id: pack name: Pack project - run: yarn pack -o %s-%v.tgz + run: yarn pack -o ${{ env.TARFILE }} - id: typecheck name: Run typecheck run: yarn check:types:build + - id: attw + name: Analyze types distribution + run: attw ${{ env.TARFILE }} - id: pkg-size-report name: Package size report run: yarn pkg-size @@ -315,6 +324,5 @@ jobs: name: Archive production artifacts uses: actions/upload-artifact@v3.1.2 with: - name: | - ${{ format('@{0}-{1}-{2}', github.repository_owner, github.event.repository.name, needs.preflight.outputs.version) }} - path: '*.tgz' + name: ${{ env.TARFILE }} + path: ${{ env.TARFILE }} diff --git a/package.json b/package.json index bb033c54..02bd0ad2 100644 --- a/package.json +++ b/package.json @@ -33,11 +33,12 @@ "scripts": { "build": "mkbuild", "changelog": "node --loader=./loader.mjs ./config/changelog.config", - "check:ci": "yarn dedupe --check && yarn check:format && yarn check:lint && yarn check:spelling && yarn typecheck && yarn pack -o %s-%v.tgz && yarn clean:pack && yarn check:types:build && yarn pkg-size", + "check:ci": "yarn dedupe --check && yarn check:format && yarn check:lint && yarn check:spelling && yarn typecheck && yarn pack && yarn check:types:build && attw package.tgz && yarn clean:pack && yarn pkg-size", "check:format": "prettier --check .", "check:lint": "eslint --exit-on-fatal-error --max-warnings 0 .", "check:spelling": "cspell lint --color --no-progress --relative $@ \"**\"", "check:types": "tsc -p tsconfig.typecheck.json", + "check:types:attw": "yarn pack && attw package.tgz && yarn clean:pack", "check:types:build": "bash ./scripts/typecheck-build.sh", "check:upgrades": "yarn upgrade-interactive", "clean:build": "trash ./{dist,*.tgz}", @@ -62,6 +63,7 @@ "typecheck:watch": "vitest typecheck" }, "devDependencies": { + "@arethetypeswrong/cli": "0.7.0", "@commitlint/cli": "17.6.7", "@flex-development/commitlint-config": "1.0.1", "@flex-development/decorator-regex": "1.0.0", diff --git a/scripts/release.sh b/scripts/release.sh index 65c9e803..1616071d 100644 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -3,24 +3,28 @@ # Local Release Workflow # # 1. run typecheck -# 2. build project +# 2. pack project # 3. run postbuild typecheck -# 4. print package size report -# 5. get new package version -# 6. get release branch name -# 7. switch to release branch -# 8. stage changes -# 9. commit changes -# 10. push release branch to origin -# 11. create pull request +# 4. analyze types +# 5. print package size report +# 6. get new package version +# 7. get release branch name +# 8. switch to release branch +# 9. stage changes +# 10. commit changes +# 11. push release branch to origin +# 12. create pull request +# 13. cleanup # # References: # # - https://cli.github.com/manual/gh_pr_create +# - https://github.com/arethetypeswrong/arethetypeswrong.github.io yarn typecheck -yarn build +yarn pack yarn check:types:build +attw package.tgz yarn pkg-size VERSION=$(jq .version package.json -r) RELEASE_BRANCH=release/$VERSION @@ -29,3 +33,4 @@ git add . git commit -s -m "release: $(jq .tagPrefix package.json -r)$VERSION" git push origin -u --no-verify $RELEASE_BRANCH gh pr create --assignee @me --label scope:release --web +yarn clean:pack diff --git a/yarn.lock b/yarn.lock index a7954a41..43a8ce61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -31,6 +31,13 @@ __metadata: languageName: node linkType: hard +"@andrewbranch/untar.js@npm:^1.0.0": + version: 1.0.2 + resolution: "@andrewbranch/untar.js@npm:1.0.2" + checksum: 138d4020846d83e841835a24f7ead6d97147d245988fbb1c730bea0e898d7075274966528f5b61403427e84680ce1d1cab880d357810e249ee81a260021c9fab + languageName: node + linkType: hard + "@ardatan/sync-fetch@larsgw/sync-fetch#head=worker_threads": version: 0.3.1 resolution: "@ardatan/sync-fetch@https://github.com/larsgw/sync-fetch.git#commit=3fb71aeed5ff6655421064c4e4b234f524896cd2" @@ -41,6 +48,36 @@ __metadata: languageName: node linkType: hard +"@arethetypeswrong/cli@npm:0.7.0": + version: 0.7.0 + resolution: "@arethetypeswrong/cli@npm:0.7.0" + dependencies: + "@arethetypeswrong/core": "npm:0.7.0" + chalk: "npm:^4.1.2" + cli-table3: "npm:^0.6.3" + commander: "npm:^10.0.1" + marked: "npm:^5.1.0" + marked-terminal: "npm:^5.2.0" + bin: + attw: dist/index.js + checksum: 0fdda3edd53c8578226404e67a9a864788bf548386d312eb0d2712171ded0afb762883fc8c1e7e312609ed4fef2d0dccb186823d53303ef91a6bdb586329e0fc + languageName: node + linkType: hard + +"@arethetypeswrong/core@npm:0.7.0": + version: 0.7.0 + resolution: "@arethetypeswrong/core@npm:0.7.0" + dependencies: + "@andrewbranch/untar.js": "npm:^1.0.0" + fetch-ponyfill: "npm:^7.1.0" + fflate: "npm:^0.7.4" + semver: "npm:^7.5.4" + typescript: "npm:^5.1.3" + validate-npm-package-name: "npm:^5.0.0" + checksum: e8559231446182734b64724f5b37cba57d040004cd9737d8fc1ceca8e0a80b5a57b606a9506af8b626539d0f81cc64924e9da56c6341be8b61300c0f7fb1a146 + languageName: node + linkType: hard + "@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.18.6": version: 7.18.6 resolution: "@babel/code-frame@npm:7.18.6" @@ -188,6 +225,13 @@ __metadata: languageName: node linkType: hard +"@colors/colors@npm:1.5.0": + version: 1.5.0 + resolution: "@colors/colors@npm:1.5.0" + checksum: 5e08870799494f68e5b3b79e9a337bbf5fd7e634904fbbe642769921bf158fe458c41c888f88edf051b78c5325e3339970f00b24e31421c3480bb58f02687218 + languageName: node + linkType: hard + "@commitlint/cli@npm:17.6.7": version: 17.6.7 resolution: "@commitlint/cli@npm:17.6.7" @@ -1207,6 +1251,7 @@ __metadata: version: 0.0.0-use.local resolution: "@flex-development/pkg-types@workspace:." dependencies: + "@arethetypeswrong/cli": "npm:0.7.0" "@commitlint/cli": "npm:17.6.7" "@flex-development/commitlint-config": "npm:1.0.1" "@flex-development/decorator-regex": "npm:1.0.0" @@ -2479,6 +2524,15 @@ __metadata: languageName: node linkType: hard +"ansi-escapes@npm:^6.2.0": + version: 6.2.0 + resolution: "ansi-escapes@npm:6.2.0" + dependencies: + type-fest: "npm:^3.0.0" + checksum: 32ef889ff692e3082fae4e0cf5243487342cef80a621abb23967fc0c2fefdf2556c828d07e1cea04f24de2ca34b4c342a0a5a888d2ea493f8991aef057b47ff9 + languageName: node + linkType: hard + "ansi-regex@npm:^5.0.1": version: 5.0.1 resolution: "ansi-regex@npm:5.0.1" @@ -2525,6 +2579,13 @@ __metadata: languageName: node linkType: hard +"ansicolors@npm:~0.3.2": + version: 0.3.2 + resolution: "ansicolors@npm:0.3.2" + checksum: ec244826ff48ce81097507b8d273d05b94d3378d2a83cdcd1643b71a547dcc744023fa783a4aadf1a8fc98aa6fc63e27b6e9f8855bb344b1b447973b7b8d98ae + languageName: node + linkType: hard + "aproba@npm:^1.0.3 || ^2.0.0": version: 2.0.0 resolution: "aproba@npm:2.0.0" @@ -2773,6 +2834,15 @@ __metadata: languageName: node linkType: hard +"builtins@npm:^5.0.0": + version: 5.0.1 + resolution: "builtins@npm:5.0.1" + dependencies: + semver: "npm:^7.0.0" + checksum: d84d5abbe1480218e2f15c1179993047f291052614d6bc225359dc03932c6306002e94a3c86166a815478f1c9b2934a645dbfdee31c71ad50d71f128535d0c19 + languageName: node + linkType: hard + "busboy@npm:^1.6.0": version: 1.6.0 resolution: "busboy@npm:1.6.0" @@ -2876,6 +2946,18 @@ __metadata: languageName: node linkType: hard +"cardinal@npm:^2.1.1": + version: 2.1.1 + resolution: "cardinal@npm:2.1.1" + dependencies: + ansicolors: "npm:~0.3.2" + redeyed: "npm:~2.1.0" + bin: + cdl: ./bin/cdl.js + checksum: 9e9716cde2c12612625cc1114d883c00ff19d511924772a5caad0646ef4fbf4912b52c8e35e990100ab3f08c7e8db81fce996b8407c198f7932e23ff7a79a829 + languageName: node + linkType: hard + "chai@npm:^4.3.7": version: 4.3.7 resolution: "chai@npm:4.3.7" @@ -2919,6 +3001,13 @@ __metadata: languageName: node linkType: hard +"chalk@npm:^5.2.0": + version: 5.3.0 + resolution: "chalk@npm:5.3.0" + checksum: b35496b395338e78f891796bd55d641d8907e4930a8ecbff087644241f2435d7a6764e65562b43ec8581b2cc35c68fe213ffe5bc710fb39a774f4497617a7ff2 + languageName: node + linkType: hard + "character-entities-legacy@npm:^1.0.0": version: 1.1.4 resolution: "character-entities-legacy@npm:1.1.4" @@ -3012,6 +3101,19 @@ __metadata: languageName: node linkType: hard +"cli-table3@npm:^0.6.3": + version: 0.6.3 + resolution: "cli-table3@npm:0.6.3" + dependencies: + "@colors/colors": "npm:1.5.0" + string-width: "npm:^4.2.0" + dependenciesMeta: + "@colors/colors": + optional: true + checksum: 82fe6f515833019cdb7064c7276a546c5e3fe6bae6a1db4bf4b41e4bdcf9b119b086630f991461ac8556d82330ae5284fc4942a740118be6c8bbfcc69c118d0a + languageName: node + linkType: hard + "cli-truncate@npm:^2.1.0": version: 2.1.0 resolution: "cli-truncate@npm:2.1.0" @@ -3121,10 +3223,10 @@ __metadata: languageName: node linkType: hard -"commander@npm:^10.0.0": - version: 10.0.0 - resolution: "commander@npm:10.0.0" - checksum: 1b6c9c0a4bbb4b8aa1f123445f74972c5ddd1b83e7c3fc70a74e7fa679b685dccb7a230f56c1a951e5906da1db4accc61be99884ab6a28a50898906f652efc4d +"commander@npm:^10.0.0, commander@npm:^10.0.1": + version: 10.0.1 + resolution: "commander@npm:10.0.1" + checksum: b2a03d799104eac407ca031b94126c98198594fcff41554eb253cef748de57fb1a4cdd591baa075de589f2fddf1f968d1ecd1b79e8b47570ee441ab4f3363776 languageName: node linkType: hard @@ -4427,7 +4529,7 @@ __metadata: languageName: node linkType: hard -"esprima@npm:^4.0.1": +"esprima@npm:^4.0.1, esprima@npm:~4.0.0": version: 4.0.1 resolution: "esprima@npm:4.0.1" bin: @@ -4640,6 +4742,22 @@ __metadata: languageName: node linkType: hard +"fetch-ponyfill@npm:^7.1.0": + version: 7.1.0 + resolution: "fetch-ponyfill@npm:7.1.0" + dependencies: + node-fetch: "npm:~2.6.1" + checksum: 7e5ebfeef1ebfbebf3264a828e27fd88c97c52183108d8d70235f37503929351532556295f5030587b8f5f258c6c6869eb03e002c30d2daccaaeb3fd71b9b514 + languageName: node + linkType: hard + +"fflate@npm:^0.7.4": + version: 0.7.4 + resolution: "fflate@npm:0.7.4" + checksum: 162d79df3bca9e118eeebb715934f13a0aba6f405c878fcc315e164a312e8d92aa8ba88c02b98a9b2cdc1685a93e67e14e753a177c62830490a5cb96f535f76e + languageName: node + linkType: hard + "figures@npm:^3.0.0": version: 3.2.0 resolution: "figures@npm:3.2.0" @@ -6365,6 +6483,31 @@ __metadata: languageName: node linkType: hard +"marked-terminal@npm:^5.2.0": + version: 5.2.0 + resolution: "marked-terminal@npm:5.2.0" + dependencies: + ansi-escapes: "npm:^6.2.0" + cardinal: "npm:^2.1.1" + chalk: "npm:^5.2.0" + cli-table3: "npm:^0.6.3" + node-emoji: "npm:^1.11.0" + supports-hyperlinks: "npm:^2.3.0" + peerDependencies: + marked: ^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 + checksum: 5f99ad8743745372ea80eae9711dc84ee1a0489182417403d0ea1c0123bac9f65da05fe1b756630d8c47a26c32741691fe00bdb1820ff50d74e29b051152d209 + languageName: node + linkType: hard + +"marked@npm:^5.1.0": + version: 5.1.2 + resolution: "marked@npm:5.1.2" + bin: + marked: bin/marked.js + checksum: 411637c0449c44b96b86dd33e4b131711cc5acc0c755deb227f161dfbd911c9278f42f9bd1af35e495423b7a1081d6525c17ed27c97625d8ba25d814f7f45fbe + languageName: node + linkType: hard + "mdast-util-from-markdown@npm:^0.8.5": version: 0.8.5 resolution: "mdast-util-from-markdown@npm:0.8.5" @@ -6749,9 +6892,18 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.9": - version: 2.6.9 - resolution: "node-fetch@npm:2.6.9" +"node-emoji@npm:^1.11.0": + version: 1.11.0 + resolution: "node-emoji@npm:1.11.0" + dependencies: + lodash: "npm:^4.17.21" + checksum: d94fcc48d9c3dc1f2512bf525f5c614d0b88c9c711c7d116f06ec8adc6d25082959c1c6a37fe9ae431ba4018018ca13bed256f94e61c347e4618b1276b841d3c + languageName: node + linkType: hard + +"node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.9, node-fetch@npm:~2.6.1": + version: 2.6.12 + resolution: "node-fetch@npm:2.6.12" dependencies: whatwg-url: "npm:^5.0.0" peerDependencies: @@ -6759,7 +6911,7 @@ __metadata: peerDependenciesMeta: encoding: optional: true - checksum: 8457cf62f599e9d55b01d58f87ed2110c65f83c4fcce8be0e350909995384e96a55e2b810d0e1a67a1fbe7f9930cd0998146d2dcce4843f9ed3ac0b479bd5c64 + checksum: 9db93926c26f46e727034c25a9b648a5345840052ab7fcba1760353929e99eba0225bd196aa3ed57600a98bba4722a81ea243417a9e740d8c440ff1f5b0139b4 languageName: node linkType: hard @@ -7597,6 +7749,15 @@ __metadata: languageName: node linkType: hard +"redeyed@npm:~2.1.0": + version: 2.1.1 + resolution: "redeyed@npm:2.1.1" + dependencies: + esprima: "npm:~4.0.0" + checksum: 1278b73beed9164dc01f9f1b83349e6492b2fd5811bc58d644f6850d526135eb3dce08e9d468fa6f1475b1428a732da003dc8b5972b9eca218dcdc75526b6b77 + languageName: node + linkType: hard + "regexp-tree@npm:^0.1.27": version: 0.1.27 resolution: "regexp-tree@npm:0.1.27" @@ -7882,7 +8043,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:7.5.4, semver@npm:^7.3.2, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.8, semver@npm:^7.5.0, semver@npm:^7.5.4": +"semver@npm:7.5.4, semver@npm:^7.0.0, semver@npm:^7.3.2, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.8, semver@npm:^7.5.0, semver@npm:^7.5.4": version: 7.5.4 resolution: "semver@npm:7.5.4" dependencies: @@ -8335,7 +8496,7 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:^7.1.0": +"supports-color@npm:^7.0.0, supports-color@npm:^7.1.0": version: 7.2.0 resolution: "supports-color@npm:7.2.0" dependencies: @@ -8344,6 +8505,16 @@ __metadata: languageName: node linkType: hard +"supports-hyperlinks@npm:^2.3.0": + version: 2.3.0 + resolution: "supports-hyperlinks@npm:2.3.0" + dependencies: + has-flag: "npm:^4.0.0" + supports-color: "npm:^7.0.0" + checksum: 018edbc2b3c5c1bea3b525dfc0b4fe8a3ab21cb61cd5c4b23aee11da540b81e8ff8bb022fa8eae3c87c4779533a5b4b763f31da1f76bffc27613c9b15a863a13 + languageName: node + linkType: hard + "supports-preserve-symlinks-flag@npm:^1.0.0": version: 1.0.0 resolution: "supports-preserve-symlinks-flag@npm:1.0.0" @@ -8709,6 +8880,13 @@ __metadata: languageName: node linkType: hard +"type-fest@npm:^3.0.0": + version: 3.13.1 + resolution: "type-fest@npm:3.13.1" + checksum: a7941a4d64ce006701a99f822b746c9e9ef5add1543b319db035ca1ed31935f939fe4bdf01a7e2dffebce1fe13139aaee45eefe0b810e441efaa7e8eca3bf055 + languageName: node + linkType: hard + "typed-array-buffer@npm:^1.0.0": version: 1.0.0 resolution: "typed-array-buffer@npm:1.0.0" @@ -8772,7 +8950,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:5.1.6, typescript@npm:^4.6.4 || ^5.0.0": +"typescript@npm:5.1.6, typescript@npm:^4.6.4 || ^5.0.0, typescript@npm:^5.1.3": version: 5.1.6 resolution: "typescript@npm:5.1.6" bin: @@ -8782,7 +8960,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A5.1.6#optional!builtin, typescript@patch:typescript@npm%3A^4.6.4 || ^5.0.0#optional!builtin": +"typescript@patch:typescript@npm%3A5.1.6#optional!builtin, typescript@patch:typescript@npm%3A^4.6.4 || ^5.0.0#optional!builtin, typescript@patch:typescript@npm%3A^5.1.3#optional!builtin": version: 5.1.6 resolution: "typescript@patch:typescript@npm%3A5.1.6#optional!builtin::version=5.1.6&hash=1f5320" bin: @@ -8946,6 +9124,15 @@ __metadata: languageName: node linkType: hard +"validate-npm-package-name@npm:^5.0.0": + version: 5.0.0 + resolution: "validate-npm-package-name@npm:5.0.0" + dependencies: + builtins: "npm:^5.0.0" + checksum: 18d5883d8bd10fa56fdeee755802f19b8b769313a85892b7291e50d8bdbb237b077d1ab7a0ae9612666719baa9fb5d1daf36e0b7ff318b0b2a61a54fba122a49 + languageName: node + linkType: hard + "value-or-promise@npm:1.0.12, value-or-promise@npm:^1.0.11, value-or-promise@npm:^1.0.12": version: 1.0.12 resolution: "value-or-promise@npm:1.0.12"