feat: add build and CI configuration files

This commit is contained in:
Lucàs
2025-05-29 09:51:34 +02:00
parent 165213dd10
commit e1353c268c
7 changed files with 130 additions and 104 deletions
+38
View File
@@ -0,0 +1,38 @@
name: CI
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v3
- id: setup-bun
name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- id: install-deps
name: Install dependencies
run: |
bun install
- id: test
name: Run test
run: |
bun test
-37
View File
@@ -1,37 +0,0 @@
name: Publish to npm
on:
workflow_dispatch:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Build with Bun
run: |
bun run build
- name: Set up npm auth
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Debug .npmrc content
run: cat ~/.npmrc
- name: Publish to npm
run: bun publish --access public
env:
npm_config_userconfig: ~/.npmrc
+22
View File
@@ -0,0 +1,22 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16.x
- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
+26
View File
@@ -0,0 +1,26 @@
import type { BuildConfig } from 'bun'
import dts from 'bun-plugin-dts'
const defaultBuildConfig: BuildConfig = {
entrypoints: ['./src/index.ts'],
outdir: './dist',
external: [
'hono',
'pug',
'path',
]
}
await Promise.all([
Bun.build({
...defaultBuildConfig,
plugins: [dts()],
format: 'esm',
naming: "[dir]/[name].js",
}),
Bun.build({
...defaultBuildConfig,
format: 'cjs',
naming: "[dir]/[name].cjs",
})
])
+33 -28
View File
@@ -1,43 +1,48 @@
{
"name": "hono-pug-renderer",
"module": "src/index.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"version": "0.0.2",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"description": "Pug renderer middleware for Hono",
"exports": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"scripts": {
"build": "bun build --target=node ./src/index.ts --outfile=./dist/index.js && bun run build:declaration",
"build:declaration": "tsc --emitDeclarationOnly --project tsconfig.types.json",
"postbuild": "rimraf tsconfig.types.tsbuildinfo"
},
"devDependencies": {
"@types/bun": "latest",
"@types/pug": "^2.0.10",
"prettier": "^3.5.3",
"rimraf": "^6.0.1"
},
"peerDependencies": {
"typescript": "^5.8.3"
},
"dependencies": {
"hono": "^4.7.8",
"pug": "^3.0.3"
},
"repository": {
"type": "git",
"url": "https://github.com/LucasVbr/hono-pug-renderer.git"
"build": "bun run build.ts",
"prepublishOnly": "bun run build"
},
"files": [
"dist"
],
"keywords": [
"hono",
"pug",
"renderer",
"middleware"
],
"author": "LucasVbr",
"license": "MIT",
"files": [
"dist/*.js",
"dist/*.d.ts"
]
"homepage": "https://github.com/LucasVbr/hono-pug-renderer#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/LucasVbr/hono-pug-renderer.git"
},
"bugs": "https://github.com/LucasVbr/hono-pug-renderer/issues",
"author": "Lucàs Vabre <contact@lucasvbr.dev>",
"dependencies": {
"hono": "^4.7.8",
"pug": "^3.0.3"
},
"devDependencies": {
"@types/bun": "latest",
"@types/pug": "^2.0.10",
"prettier": "^3.5.3",
"bun-plugin-dts": "latest"
},
"peerDependencies": {
"typescript": "^5.8.3"
}
}
+9 -24
View File
@@ -1,31 +1,16 @@
{
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
},
"lib": ["ESNext"],
"target": "es2020",
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"noEmit": true,
"composite": true,
"strict": true,
"downlevelIteration": true,
"esModuleInterop": true,
"moduleResolution": "node",
"skipLibCheck": true,
"jsx": "react-jsx",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true,
"noImplicitAny": true,
"allowJs": true,
"types": [
"bun-types"
]
},
"include": [
"src/**/*.ts"
]
"noEmit": true,
"outDir": "dist",
"resolveJsonModule": true
}
}
-13
View File
@@ -1,13 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": false,
"emitDeclarationOnly": true,
"declaration": true,
"outDir": "./dist",
"rootDir": "./src",
},
"include": [
"src/**/*.ts"
]
}