Skip to content

Commit

Permalink
setup automation
Browse files Browse the repository at this point in the history
  • Loading branch information
yeasir01 committed Jan 18, 2024
1 parent 9077695 commit a47f954
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"env": {
"browser": true,
"es2021": true,
"es2022": true,
"node": true
},
"extends": [
Expand Down
Binary file added .github/template/example.lbx
Binary file not shown.
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
push:
branches:
- "**"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "npm"

- run: npm install --frozen-lockfile
- run: npm run type-check && npm run lint && npm run build
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish

on:
workflow_run:
workflows: [CI]
branches: [main]
types: [completed]

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "npm"

- run: npm install --frozen-lockfile
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"scripts": {
"build": "tsup",
"lint": "eslint src/ --fix",
"type-check": "tsc"
"type-check": "tsc",
"release": "npm run build && changeset publish"
},
"repository": {
"type": "git",
Expand Down
11 changes: 6 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"compilerOptions": {
"target": "ES2017",
"module": "CommonJS",
"target": "ES2022",
"module": "ESNext",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"noUncheckedIndexedAccess": true,
"noEmit": false,
"outDir": "dist",
"moduleResolution": "Bundler",
"noEmit": true, //use tsup to emit & bundle
"allowJs": true,
"checkJs": false
"checkJs": false,
"lib": ["es2022", "dom", "dom.iterable"] //If code runs in the dom
},
"include": ["src/**/*.ts"],
}

0 comments on commit a47f954

Please sign in to comment.