Skip to content

Commit 41a9fbd

Browse files
authored
Initial commit
0 parents  commit 41a9fbd

File tree

11 files changed

+195
-0
lines changed

11 files changed

+195
-0
lines changed

.github/workflows/ci.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
test:
14+
runs-on: ${{ matrix.os }}
15+
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, macos-latest]
19+
fail-fast: false
20+
21+
steps:
22+
- id: checkout
23+
name: Checkout
24+
uses: actions/checkout@v3
25+
- id: setup-bun
26+
name: Setup Bun
27+
uses: oven-sh/setup-bun@v1
28+
with:
29+
bun-version: latest
30+
- id: install-deps
31+
name: Install dependencies
32+
run: |
33+
bun install
34+
- id: test
35+
name: Run test
36+
run: |
37+
bun test

.github/workflows/release.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 16.x
19+
20+
- run: npx changelogithub
21+
env:
22+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Robert Soriano <https://github.com/wobsoriano>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# bun starter
2+
3+
## Getting Started
4+
5+
Click the [Use this template](https://github.com/wobsoriano/bun-lib-starter/generate) button to create a new repository with the contents starter.
6+
7+
OR
8+
9+
Run `bun create wobsoriano/bun-lib-starter ./my-lib`.
10+
11+
## Setup
12+
13+
```bash
14+
# install dependencies
15+
bun install
16+
17+
# test the app
18+
bun test
19+
20+
# build the app, available under dist
21+
bun run build
22+
```
23+
24+
## License
25+
26+
MIT

build.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { BuildConfig } from 'bun'
2+
import dts from 'bun-plugin-dts'
3+
4+
const defaultBuildConfig: BuildConfig = {
5+
entrypoints: ['./src/index.ts'],
6+
outdir: './dist'
7+
}
8+
9+
await Promise.all([
10+
Bun.build({
11+
...defaultBuildConfig,
12+
plugins: [dts()],
13+
format: 'esm',
14+
naming: "[dir]/[name].js",
15+
}),
16+
Bun.build({
17+
...defaultBuildConfig,
18+
format: 'cjs',
19+
naming: "[dir]/[name].cjs",
20+
})
21+
])

bun.lockb

10.3 KB
Binary file not shown.

package.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "pkg-name",
3+
"type": "module",
4+
"version": "0.0.0",
5+
"main": "./dist/index.cjs",
6+
"module": "./dist/index.js",
7+
"types": "./dist/index.d.ts",
8+
"description": "",
9+
"exports": {
10+
"types": "./dist/index.d.ts",
11+
"import": "./dist/index.js",
12+
"require": "./dist/index.cjs"
13+
},
14+
"scripts": {
15+
"build": "bun run build.ts",
16+
"prepublishOnly": "bun run build"
17+
},
18+
"files": [
19+
"dist"
20+
],
21+
"keywords": [
22+
"bun"
23+
],
24+
"license": "MIT",
25+
"homepage": "https://github.com/wobsoriano/pkg-name#readme",
26+
"repository": {
27+
"type": "git",
28+
"url": "git+https://github.com/wobsoriano/pkg-name.git"
29+
},
30+
"bugs": "https://github.com/wobsoriano/pkg-name/issues",
31+
"author": "Robert Soriano <sorianorobertc@gmail.com>",
32+
"devDependencies": {
33+
"bun-plugin-dts": "^0.3.0",
34+
"@types/bun": "^1.1.10"
35+
}
36+
}

src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const one = 1
2+
export const two = 2

test/index.test.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { describe, it, expect } from 'bun:test'
2+
import { one, two } from '../src'
3+
4+
describe('should', () => {
5+
it('export 1', () => {
6+
expect(one).toBe(1)
7+
})
8+
9+
it('export 2', () => {
10+
expect(two).toBe(2)
11+
})
12+
})

tsconfig.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2020",
4+
"module": "esnext",
5+
"strict": true,
6+
"esModuleInterop": true,
7+
"moduleResolution": "node",
8+
"skipLibCheck": true,
9+
"noUnusedLocals": true,
10+
"noImplicitAny": true,
11+
"allowJs": true,
12+
"noEmit": true,
13+
"outDir": "dist",
14+
"resolveJsonModule": true
15+
}
16+
}

0 commit comments

Comments
 (0)