Skip to content
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
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build

on:
pull_request:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.2.2
- uses: actions/setup-node@v4
with:
node-version: '20.10.0'
- run: bun install --frozen-lockfile --ignore-scripts
- run: bun run build
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint

on:
pull_request:
push:
branches:
- main

jobs:
format-and-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.2.2
- uses: actions/setup-node@v4
with:
node-version: '20.10.0'
- run: bun install --frozen-lockfile --ignore-scripts
- run: bun run format:check
- run: bun run lint
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test

on:
pull_request:
push:
branches:
- main

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.13
- uses: actions/setup-node@v4
with:
node-version: '20.10.0'
- run: bun install --frozen-lockfile --ignore-scripts
- run: bun run test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ lerna-debug.log*

node_modules
dist
app-dist
dist-ssr
*.local

Expand Down
17 changes: 17 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MIT License
Copyright (c) 2025 <YOURNAMEHERE>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ This script will:
6. Ask you to select if this is a patch, minor, or major version change. This will adjust your package.json accordingly and create a tag commit. ✅
7. Run another build so the package version update is included in the published code ✅
8. Attempt to run `npm publish` to publish your package! 🚀

## License

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5 changes: 5 additions & 0 deletions lib/mock.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('A mock test so your project has at least one test', () => {
it('is a mock test', () => {
expect('Hello, world!').toBe('Hello, world!');
});
});
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@m4ttheweric/react-package-template",
"private": false,
"version": "0.0.1",
"license": "MIT",
"type": "module",
"main": "./dist/main.cjs",
"module": "./dist/main.mjs",
Expand Down Expand Up @@ -29,13 +30,15 @@
"scripts": {
"dev": "vite",
"build": "tsc -b ./tsconfig.lib.json && vite build",
"build:app": "tsc -b ./tsconfig.app.json && vite build --config vite.app.config.ts",
"test": "vitest run",
"lint": "eslint . --quiet",
"format:write": "prettier --write \"**/*.{ts,tsx}\" --cache",
"format:check": "prettier --check \"**/*.{ts,tsx}\" --cache",
"preview": "vite preview",
"type-check": "tsc --noEmit",
"release": "node --no-warnings publish.mjs"
"release": "node --no-warnings publish.mjs",
"pre-release": "bun run build && bun run type-check && bun run lint && bun run format:write"
},
"peerDependencies": {
"react": "^18.0.0",
Expand Down
4 changes: 2 additions & 2 deletions publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const run = async () => {
execute(`bun run format:write`);

// if you have tests eventually, uncomment this to run them as part of the publish process
// log('Testing code...');
// execute(`bun run test`);
log('Testing code...');
execute(`bun run test`);

log('Building code...');
execute(`bun run build`);
Expand Down
1 change: 1 addition & 0 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"target": "ESNext",
"module": "ESNext",
"useDefineForClassFields": true,
"types": ["vitest/globals"],
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
Expand Down
11 changes: 11 additions & 0 deletions vite.app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';

// this is the config for the app in ./src NOT your library
// you may want to build the app so you can deploy a demo/docs app to go along with your library
export default defineConfig({
plugins: [react()],
build: {
outDir: 'app-dist',
},
});
Loading