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 26, 2023
1 parent 3e0685c commit 5199303
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
commitlintrc
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 @@ -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 }}
Expand All @@ -302,19 +305,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 @@ -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}",
Expand All @@ -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",
Expand Down
25 changes: 15 additions & 10 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Loading

0 comments on commit 5199303

Please sign in to comment.