Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ndxbn committed Oct 28, 2024
0 parents commit 0779d43
Show file tree
Hide file tree
Showing 18 changed files with 174 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

[*.{styl,stylus,less,sass,css}]
indent_style = space
indent_size = 2

[*.{yml,yaml}]
# https://yaml.org/spec/1.2.2/#61-indentation-spaces
indent_style = space
indent_size = 2

[*.md]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.lockb binary diff=lockb
18 changes: 18 additions & 0 deletions .github/workflows/biome.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Code quality

on:
push:
pull_request:

jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup Biome
uses: biomejs/setup-biome@1cbe33ead22c7a2fded3b52fa2893611c815c9b5 # v2
with:
version: latest
- name: Run Biome
run: biome ci .
14 changes: 14 additions & 0 deletions .github/workflows/bun-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Bun test

on:
push:
pull_request:

jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
- run: bun install
- run: bun test
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage/
node_modules/

.env
.env.*
5 changes: 5 additions & 0 deletions .lefthook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pre-push:
commands:
biome-check:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
run: bunx @biomejs/biome check --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {push_files}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM oven/bun:alpine@sha256:3dc101cc42433f8a470da07701441afdb1aab4c6d056a291eb405e348c5a5c37

COPY tsconfig.json ./
COPY src/ ./
COPY package.json bun.lockb ./

RUN bun install --production --frozen-lockfile
ENTRYPOINT ["bun"]
CMD ["--version"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Sitri Kamishirasawa

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.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
[![Bun](https://img.shields.io/badge/Bun-000?logo=bun&logoColor=fff)](https://bun.sh/)

[![Formatted with Biome](https://img.shields.io/badge/Formatted_with-Biome-60a5fa?style=flat&logo=biome)](https://biomejs.dev/)
[![Linted with Biome](https://img.shields.io/badge/Linted_with-Biome-60a5fa?style=flat&logo=biome)](https://biomejs.dev)

This project is created by `bun create ndxbn/bun`.

- TypeScript config is based on "strictest"
- Dockerfile for production, docker-compose for development
- entrypoint files
- `bun run cli` (or `bunx THIS_PACKAGE`): [cli.ts](./cli.ts)
- `bun run start` and/or `docker-compose up`: [server.ts](./server.ts)
- `import from "THIS_REPO"`: [index.ts](./index.ts)

## Install & Run

```bash
bun install
bun run start
```
12 changes: 12 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"ignoreUnknown": true
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true,
"defaultBranch": "main"
}
}
Binary file added bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions bun.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[test]
coverage = true
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"private": true,
"name": "bun",
"type": "module",
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@tsconfig/bun": "1.0.7",
"@tsconfig/strictest": "2.0.5",
"@types/bun": "latest",
"lefthook": "1.8.1"
},
"peerDependencies": {
"typescript": "5.6.3"
},
"scripts": {
"fmt": "biome check --write --unsafe",
"docker:action-lint": "docker run --rm -v $(pwd):/repo --workdir /repo rhysd/actionlint:latest -color"
}
}
3 changes: 3 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["github>ndxbn/renovate-config", "customManagers:biomeVersions"]
}
3 changes: 3 additions & 0 deletions src/main.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { test } from "bun:test";

test.todo("main test", () => {});
12 changes: 12 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function main(): Promise<void> {
return Promise.resolve();
}

main()
.then(() => {
process.exit(0);
})
.catch((error) => {
console.error(error);
process.exit(1);
});
6 changes: 6 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": [
"@tsconfig/bun/tsconfig.json",
"@tsconfig/strictest/tsconfig.json"
]
}

0 comments on commit 0779d43

Please sign in to comment.