Skip to content

Commit 9ceacf2

Browse files
committed
feature: add typescript and release workflow
1 parent 80b1cee commit 9ceacf2

File tree

5 files changed

+102
-0
lines changed

5 files changed

+102
-0
lines changed

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release and Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
id-token: write
14+
steps:
15+
- name: Checkout 🛎️
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- uses: pnpm/action-setup@v4
21+
22+
- name: Use Node LTS ✨
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: lts/*
26+
registry-url: https://registry.npmjs.org
27+
cache: pnpm
28+
29+
- name: Install dependencies 📦️
30+
run: pnpm install --frozen-lockfile
31+
32+
- name: Build package
33+
run: cd core && pnpm build
34+
35+
- name: Check if version changed
36+
id: version-check
37+
run: |
38+
CURRENT_VERSION=$(cd core && node -p "require('./package.json').version")
39+
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
40+
41+
# Check if tag already exists
42+
if git tag -l | grep -q "^v$CURRENT_VERSION$"; then
43+
echo "version_changed=false" >> $GITHUB_OUTPUT
44+
else
45+
echo "version_changed=true" >> $GITHUB_OUTPUT
46+
fi
47+
48+
- name: Create GitHub Release
49+
if: steps.version-check.outputs.version_changed == 'true'
50+
uses: actions/create-release@v1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
tag_name: v${{ steps.version-check.outputs.current_version }}
55+
release_name: Release v${{ steps.version-check.outputs.current_version }}
56+
draft: false
57+
prerelease: false
58+
59+
- name: Publish to npm
60+
if: steps.version-check.outputs.version_changed == 'true'
61+
run: cd core && pnpm publish --no-git-checks --access public
62+
env:
63+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ yarn-error.log*
3434
# typescript
3535
*.tsbuildinfo
3636
next-env.d.ts
37+
38+
dist

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"name": "Creatorem"
99
},
1010
"scripts": {
11+
"build": "tsc --noEmit false --outDir dist --declaration",
1112
"clean": "git clean -xdf .turbo node_modules",
1213
"format": "prettier --check \"**/*.{ts,tsx}\"",
1314
"lint": "eslint .",
@@ -22,6 +23,9 @@
2223
"./client": "./src/create-rpc-client.ts",
2324
"./query-client": "./src/create-rpc-query-client.ts"
2425
},
26+
"devDependencies": {
27+
"typescript": "~5.9.2"
28+
},
2529
"peerDependencies": {
2630
"@tanstack/react-query": "5.90.12",
2731
"next": "16.0.7",

pnpm-lock.yaml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"compilerOptions": {
4+
"target": "ES2017",
5+
"lib": ["dom", "dom.iterable", "esnext"],
6+
"allowJs": true,
7+
"checkJs": true,
8+
"skipLibCheck": true,
9+
"strict": true,
10+
"forceConsistentCasingInFileNames": true,
11+
"noEmit": true,
12+
"esModuleInterop": true,
13+
"module": "esnext",
14+
"moduleResolution": "bundler",
15+
"resolveJsonModule": true,
16+
"isolatedModules": true,
17+
"jsx": "preserve",
18+
"incremental": true,
19+
"noUncheckedIndexedAccess": true
20+
},
21+
"exclude": ["node_modules", "build", "dist", ".next"]
22+
}

0 commit comments

Comments
 (0)