Skip to content

Commit

Permalink
chore(tools): standarize scripts between @itsjavi repos
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjavi committed Aug 22, 2023
1 parent 4f59718 commit a23a760
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
pnpm exec changelogen gh release
pnpm version:publish-gh-releases
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged
pnpm hooks:pre-commit
7 changes: 1 addition & 6 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm prettier-check
pnpm type-check
pnpm lint
pnpm publint
pnpm build
pnpm test:ci
pnpm hooks:pre-push
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pnpm-lock.yaml
pnpm-workspace.yaml
build/
.next
dist/
.next/*
coverage/
Expand Down
8 changes: 8 additions & 0 deletions .scripts/tag-release-gh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env sh

# docs: https://cli.github.com/manual/gh_release_create

# CURR_VERSION=$(node .scripts/get-semver.cjs current)
# gh release create v${CURR_VERSION} --generate-notes --verify-tag --title "v${CURR_VERSION}" --draft

pnpm exec changelogen gh release
2 changes: 1 addition & 1 deletion .scripts/tag-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ echo "${new_CHANGELOG}\n${existing_CHANGELOG}" > CHANGELOG.md

# Create a new commit and tag with the current version
git add CHANGELOG.md package.json **/package.json pnpm-lock.yaml
git commit -m "chore(release): bump version to v${CURRENT_VERSION}" || exit 1
git commit -m "chore(releases): bump version to v${CURRENT_VERSION}" || exit 1
git tag -a "v${CURRENT_VERSION}" -m "v${CURRENT_VERSION}" || exit 1
6 changes: 6 additions & 0 deletions .scripts/update-changelog-gh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh

# docs: https://cli.github.com/manual/gh_release_view

CURR_VERSION=$(node .scripts/get-semver.cjs current)
gh release view v${CURR_VERSION} --jq .body --json body >> CHANGELOG.md
9 changes: 8 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
"recommendations": [
"vsls-contrib.codetour",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"yoavbls.pretty-ts-errors",
"orta.vscode-jest",
"github.vscode-github-actions"
]
}
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
'always',
[
'general',
'release',
'releases',
'deps',
'config',
'setup',
Expand Down
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,32 @@
"scripts": {
"build": "turbo build",
"clear-cache": "rm -rf packages/*/.turbo && rm -rf packages/*/.next && jest --clearCache",
"dev": "turbo run build && turbo run dev --no-deps --no-cache --parallel --concurrency 20",
"dev": "turbo run build && sleep 2 && turbo run dev --no-deps --no-cache --parallel --concurrency 20",
"format": "pnpm lint-fix && pnpm prettier-fix",
"postinstall": "pnpm lint-staged && pnpm build",
"lint": "turbo lint",
"hooks:pre-commit": "pnpm lint-staged",
"hooks:pre-push": "pnpm run quality-checks",
"postinstall": "pnpm lint-staged",
"lint": "turbo lint -- --max-warnings=0",
"lint-fix": "turbo lint-fix",
"prepare": "husky install",
"prettier-check": "prettier --check .",
"prettier-fix": "prettier --write .",
"pretty": "pnpm run format",
"preview": "pnpm build && npx -y http-server ./packages/examples/react/dist",
"publint": "turbo publint-check",
"quality-check-all": "pnpm prettier-check && pnpm lint && pnpm publint && pnpm type-check && pnpm build && pnpm test",
"test": "jest --passWithNoTests",
"test:ci": "jest --ci --passWithNoTests --coverage",
"test:coverage": "jest --passWithNoTests --coverage",
"quality-checks": "pnpm prettier-check && pnpm type-check && pnpm lint && pnpm build && pnpm publint && pnpm test:ci",
"test": "jest",
"test:ci": "jest --ci --coverage",
"test:coverage": "jest --coverage",
"type-check": "turbo type-check",
"version:bump": ".scripts/bump-version.sh patch && .scripts/tag-version.sh",
"version:bump-major": ".scripts/bump-version.sh major && .scripts/tag-version.sh",
"version:bump-minor": ".scripts/bump-version.sh minor && .scripts/tag-version.sh",
"version:bump-patch": "pnpm ws:version",
"version:publish": "pnpm run version:publish-gh-refs && pnpm run version:publish-npm",
"version:publish-gh-refs": "git push && git push --tags",
"version:publish-gh-releases": "pnpm exec changelogen gh release",
"version:publish-npm": "pnpm -r --filter='@storylite/*' exec pnpm publish"
"version:publish-gh-refs": "git push && git push -n --tags",
"version:publish-gh-releases": ".scripts/tag-release-gh.sh",
"version:publish-npm": "pnpm -r exec pnpm publish"
},
"lint-staged": {
"*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}": [
Expand Down

0 comments on commit a23a760

Please sign in to comment.