Skip to content

Commit

Permalink
chore: analyze types distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
unicornware committed Jul 29, 2023
1 parent 7439126 commit a76e4f7
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 28 deletions.
7 changes: 7 additions & 0 deletions .attw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"color": true,
"emoji": true,
"format": "ascii",
"ignoreRules": ["cjs-resolves-to-esm"],
"summary": true
}
1 change: 1 addition & 0 deletions .dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ardatan
attw
bdougie
cefc
codecov
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ yarn.lock
!**/__fixtures__/**/dist/
!**/__fixtures__/**/node_modules/
!**/typings/**/dist/
!.attw.json
!.codecov.yml
!.commitlintrc.*
!.cspell.json
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,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 }}
Expand All @@ -367,19 +370,24 @@ 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
- id: archive
name: Archive production artifacts
uses: actions/[email protected]
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 }}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,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 test:cov && 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 test:cov && 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}",
Expand Down Expand Up @@ -84,6 +85,7 @@
"@flex-development/tutils": "6.0.0-alpha.12"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.7.0",
"@commitlint/cli": "17.6.7",
"@faker-js/faker": "8.0.2",
"@flex-development/commitlint-config": "1.0.1",
Expand Down
25 changes: 15 additions & 10 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,29 @@
#
# 1. run typecheck
# 2. run tests
# 3. build project
# 3. pack project
# 4. run postbuild typecheck
# 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
# 5. analyze types
# 6. print package size report
# 7. get new package version
# 8. get release branch name
# 9. switch to release branch
# 10. stage changes
# 11. commit changes
# 12. push release branch to origin
# 13. create pull request
# 14. cleanup
#
# References:
#
# - https://cli.github.com/manual/gh_pr_create
# - https://github.com/arethetypeswrong/arethetypeswrong.github.io

yarn typecheck
yarn test:cov
yarn build
yarn pack
yarn check:types:build
attw package.tgz
yarn pkg-size
VERSION=$(jq .version package.json -r)
RELEASE_BRANCH=release/$VERSION
Expand All @@ -31,3 +35,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
Loading

0 comments on commit a76e4f7

Please sign in to comment.