Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate scripts to use wireit for improved build process #2

Merged
merged 3 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/build-lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:

- name: πŸ— Cache Layer
uses: actions/cache@v4
# id: yarn_cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn_config.outputs.cache_folder }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
Expand All @@ -53,9 +52,15 @@ jobs:

- name: πŸš€ Build Typescript
run: yarn build
env:
WIREIT_LOGGER: metrics

- name: πŸš€ Run ESLint
run: yarn lint
env:
WIREIT_LOGGER: metrics

- name: πŸš€ Run Test
run: yarn test
env:
WIREIT_LOGGER: metrics
6 changes: 5 additions & 1 deletion .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:

permissions:
contents: read
id-token: write

steps:
- name: ‡️ Checkout repository
Expand Down Expand Up @@ -54,8 +55,11 @@ jobs:
run: yarn build
env:
NODE_ENV: production
WIREIT_LOGGER: metrics

- name: πŸš€ Publish
run: yarn run publish --yes
run: yarn run publish -- --yes
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
WIREIT_LOGGER: metrics
10 changes: 10 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,26 @@ jobs:
- name: πŸ— Install dependencies
run: yarn install --immutable

- name: πŸ—ƒοΈ Cache Wireit
uses: google/wireit@setup-github-actions-caching/v2

- name: πŸš€ Build Typescript
run: yarn build
env:
WIREIT_LOGGER: metrics

- name: πŸš€ Run ESLint
run: yarn lint
env:
WIREIT_LOGGER: metrics

- name: πŸ§ͺ Run Test
run: yarn test
env:
WIREIT_LOGGER: metrics

- name: πŸ€– Get Release
run: yarn release -y
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
WIREIT_LOGGER: metrics
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ dist
.env

.tmp

.wireit
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"toman",
"tsbuildinfo",
"vazirmatn",
"wireit",
"Ψ§ΩΎΩ„ΫŒΪ©ΫŒΨ΄Ω†",
"Ψ¨Ω†Ψ―ΫŒΩ„",
"سافاری",
Expand Down
87 changes: 66 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,15 @@
"packages/*"
],
"scripts": {
"b": "yarn run build",
"build": "lerna run build",
"c": "yarn run clean",
"cb": "yarn run clean && yarn run build",
"clean": "git add -v . && git clean -d -x -f --exclude=node_modules --exclude='*.env' --exclude=_data --exclude='.pnp*' --exclude=.yarn",
"f": "yarn run format",
"format": "yarn run format:prettier && yarn run format:eslint",
"format:eslint": "yarn run lint:es --fix",
"format:prettier": "prettier . --ignore-path .prettierignore --write",
"l": "yarn run lint",
"lint": "yarn run lint:es & yarn run lint:ts",
"lint:es": "eslint . --config .eslintrc.json --ext .ts --ext .js --ext .cjs --ext .mjs --ignore-path .prettierignore",
"lint:ts": "lerna run build:ts",
"publish": "lerna publish from-package",
"pull": "git pull",
"release": "lerna version",
"rl": "yarn run pull && yarn run clean && yarn run build && yarn run test && yarn run release",
"t": "yarn run test",
"test": "lerna run test",
"upd": "yarn set version latest; yarn up '*'; yarn up '*' -R; yarn dlx @yarnpkg/sdks vscode; yarn dedupe"
"build": "wireit",
"clean": "wireit",
"format": "wireit",
"lint": "wireit",
"lint:es": "wireit",
"publish": "wireit",
"release": "wireit",
"test": "wireit",
"upd": "yarn set version latest && yarn up '*' && yarn up '*' -R && yarn dlx @yarnpkg/sdks vscode && yarn dedupe"
},
"devDependencies": {
"@lerna-lite/changed": "^3.10.1",
Expand All @@ -60,7 +49,8 @@
"prettier": "^3.4.2",
"prettier-plugin-packagejson": "^2.5.6",
"prettier-plugin-tailwindcss": "^0.6.9",
"typescript": "^5.6.3"
"typescript": "^5.6.3",
"wireit": "^0.14.9"
},
"dependenciesMeta": {
"[email protected]": {
Expand All @@ -71,5 +61,60 @@
"engines": {
"node": ">=18.16.0",
"yarn": ">=4.0.0"
},
"wireit": {
"build": {
"command": "lerna run build"
},
"clean": {
"command": "git add -v . && git clean -d -x -f --exclude=node_modules --exclude='*.env' --exclude=_data --exclude='.pnp*' --exclude=.yarn"
},
"format": {
"dependencies": [
"format:eslint"
]
},
"format:eslint": {
"command": "yarn run lint:es -- --fix",
"dependencies": [
"format:prettier"
]
},
"format:prettier": {
"command": "prettier . --ignore-path .prettierignore --write"
},
"lint": {
"dependencies": [
"lint:es",
"lint:ts"
]
},
"lint:es": {
"command": "eslint . --config .eslintrc.json --ext .ts --ext .js --ext .cjs --ext .mjs --ignore-path .prettierignore --cache-location .eslintcache --cache --color"
},
"lint:ts": {
"command": "tsc --build"
},
"publish": {
"command": "lerna publish from-package"
},
"release": {
"command": "gh workflow list --json id,name,path | jq -r '.[] | select(.path == \".github/workflows/release.yaml\") | .id' | xargs -r gh workflow run",
"dependencies": [
"push"
]
},
"pull": {
"command": "git pull -v"
},
"push": {
"command": "git push -v",
"dependencies": [
"pull"
]
},
"test": {
"command": "lerna run test"
}
}
}
61 changes: 46 additions & 15 deletions packages/snackbar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,9 @@
"!demo/**/*"
],
"scripts": {
"b": "yarn run build",
"build": "yarn run build:ts && yarn run build:es",
"build:es": "nano-build --preset=module",
"build:ts": "tsc --build",
"c": "yarn run clean",
"cb": "yarn run clean && yarn run build",
"clean": "rm -rfv dist *.tsbuildinfo",
"d": "yarn run build:es && yarn node --enable-source-maps --trace-warnings",
"t": "yarn run test",
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --enable-source-maps --experimental-vm-modules\" ava",
"w": "yarn run watch",
"watch": "yarn run watch:ts & yarn run watch:es",
"watch:es": "yarn run build:es --watch",
"watch:ts": "yarn run build:ts --watch --preserveWatchOutput"
"build": "wireit",
"test": "wireit",
"watch": "wireit"
},
"dependencies": {
"@alwatr/flux": "^4.0.2",
Expand All @@ -70,9 +59,51 @@
"@alwatr/type-helper": "^5.0.0",
"@nexim/typescript-config": "^1.0.1",
"ava": "^6.2.0",
"typescript": "^5.6.3"
"typescript": "^5.6.3",
"wireit": "^0.14.9"
},
"publishConfig": {
"access": "public"
},
"wireit": {
"test": {
"command": "NODE_OPTIONS=\"$NODE_OPTIONS --enable-source-maps --experimental-vm-modules\" ava"
},
"build": {
"dependencies": [
"build:type",
"build:es"
]
},
"build:es": {
"command": "nano-build --preset=module",
"files": [
"src",
"tsconfig.json"
],
"clean": "if-file-deleted",
"output": [
"dist/es",
"tsconfig.tsbuildinfo"
]
},
"build:type": {
"command": "tsc --build"
},
"watch": {
"dependencies": [
"watch:ts"
]
},
"watch:ts": {
"command": "tsc --build --watch --preserveWatchOutput",
"dependencies": [
"watch:es"
]
},
"watch:es": {
"command": "nano-build --preset=module -- --watch",
"service": true
}
}
}
Loading
Loading