-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fb93b70
Showing
19 changed files
with
385 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "Node.js", | ||
// Image definition | ||
"image": "mcr.microsoft.com/devcontainers/typescript-node:20", | ||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": {}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"github.vscode-github-actions", | ||
"oven.bun-vscode" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "curl -fsSL https://bun.sh/install | bash" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.{js,json,yml}] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: Build | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: ./.github/actions/cache | ||
with: | ||
scope: build | ||
- run: bun --bun run build | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Cache | ||
|
||
inputs: | ||
scope: | ||
required: true | ||
description: Scope of files to cache | ||
Example => 'dependencies,build' | ||
Possible values for the scope => [dependencies, build] | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Store dependencies cache | ||
id: dependencies | ||
if: ${{ contains(inputs.scope, 'dependencies') }} | ||
uses: actions/cache@v3 | ||
with: | ||
key: dependencies-${{ hashFiles('./bun.lockb') }} | ||
path: | | ||
./node_modules/** | ||
- name: Store build cache | ||
id: build | ||
if: ${{ contains(inputs.scope, 'build') }} | ||
uses: actions/cache@v3 | ||
with: | ||
key: build-${{ hashFiles('./src/**') }} | ||
path: | | ||
./dist/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Prevent uncommit changes | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- shell: bash | ||
run: | | ||
if [ "$(git status --porcelain | wc -l)" -gt "0" ]; then | ||
echo "Detected uncommitted changes after build. See status below:" | ||
git status --porcelain | ||
exit 1 | ||
fi | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Setup Bun | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: ./.github/actions/cache | ||
with: | ||
scope: dependencies | ||
- uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
- run: bun install | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
groups: | ||
eslint: | ||
patterns: | ||
- "@typescript-eslint/*" | ||
- "eslint" | ||
schedule: | ||
interval: "daily" | ||
labels: ["dependencies"] | ||
commit-message: | ||
prefix: "chore" | ||
include: "scope" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
types: [ opened, synchronize, reopened, labeled ] | ||
|
||
name: CI | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read # to fetch code (actions/checkout) | ||
packages: write # to publish packages (npm publish) | ||
|
||
jobs: | ||
ci-setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-bun | ||
- uses: ./.github/actions/build | ||
- uses: ./.github/actions/prevent-uncommit-changes | ||
- run: bun test | ||
- run: bun run lint | ||
|
||
ci-canary-release: | ||
runs-on: ubuntu-latest | ||
needs: [ci-setup] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-bun | ||
- uses: actions/setup-node@v3 | ||
with: | ||
registry-url: "https://npm.pkg.github.com" | ||
- uses: ./.github/actions/cache | ||
with: | ||
scope: build | ||
- run: npm version prerelease --preid=canary.$(git rev-parse --short HEAD) --no-git-tag-version | ||
- run: npm publish --tag canary | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
on: pull_request_target | ||
|
||
name: Dependabot | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
dependabot-update-lockfile: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
- uses: ./.github/actions/setup-bun | ||
- name: Set @github-actions[bot] as committer | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
- run: git status | ||
- run: git add -A | ||
- run: | | ||
git commit -m "chore(deps-dev): bump bun lockfile" | ||
- run: git push | ||
dependabot-build: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
needs: [dependabot-update-lockfile] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
- uses: ./.github/actions/setup-bun | ||
- uses: ./.github/actions/build | ||
- uses: ./.github/actions/prevent-uncommit-changes | ||
- run: bun test | ||
- run: bun run lint | ||
dependabot-automerge: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
needs: [dependabot-build] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/fetch-metadata@v1 | ||
- name: Approve a PR | ||
if: ${{contains(fromJSON('["version-update:semver-patch", "version-update:semver-minor"]'), steps.metadata.outputs.update-type)}} | ||
run: gh pr review --approve "$PR_URL" -b "**Automatically approving** pull request because **it includes a minor/patch update**" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.DEPENDABOT_AUTOMERGE_TOKEN}} | ||
- name: Enable auto-merge for Dependabot PRs | ||
if: ${{contains(fromJSON('["version-update:semver-patch", "version-update:semver-minor"]'), steps.metadata.outputs.update-type)}} | ||
run: gh pr merge --auto --squash "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.DEPENDABOT_AUTOMERGE_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
name: Semantic Release | ||
|
||
permissions: | ||
contents: read # For Checkout | ||
|
||
jobs: | ||
release: | ||
permissions: | ||
contents: write # to create release commit (google-github-actions/release-please-action) | ||
pull-requests: write # to create release PR (google-github-actions/release-please-action) | ||
packages: write # to publish to GitHub Packages (actions/setup-node) | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
release-type: node | ||
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]' | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
- run: bun install | ||
- run: bun --bun run build | ||
- run: bun test | ||
- uses: actions/setup-node@v3 | ||
with: | ||
registry-url: 'https://npm.pkg.github.com' | ||
if: ${{ steps.release.outputs.release_created }} | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
if: ${{ steps.release.outputs.release_created }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Dependency directories | ||
|
||
node_modules/ | ||
|
||
# Generate output | ||
|
||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"typescript.inlayHints.variableTypes.enabled": true, | ||
"typescript.inlayHints.variableTypes.suppressWhenTypeMatchesName": true, | ||
"typescript.inlayHints.parameterTypes.enabled": true, | ||
"typescript.inlayHints.parameterNames.suppressWhenArgumentMatchesName": true, | ||
"typescript.inlayHints.parameterNames.enabled": "all", | ||
"typescript.preferences.preferTypeOnlyAutoImports": true, | ||
"typescript.tsdk": "./node_modules/typescript/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# bun-typescript-template | ||
|
||
Provide a modern and ready to use template to setup a typescript project | ||
|
||
> This Project rely on [bun](https://bun.sh) toolchain | ||
## Install project | ||
|
||
```sh | ||
bun install | ||
``` | ||
|
||
## Run test | ||
|
||
```sh | ||
bun test | ||
``` | ||
|
||
## Build the project | ||
|
||
```sh | ||
bun --bun run build | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"name": "@ghoullier/bun-typescript-template", | ||
"description": "Provide a modern and ready to use template to setup a typescript project", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"build:lib": "bun build --minify --outdir=dist src/index.ts", | ||
"build:types": "tsc -p tsconfig.build.json", | ||
"build": "bun build:lib && bun build:types", | ||
"lint": "npm run lint:lib && npm run lint:exports && npm run lint:package", | ||
"lint:lib": "eslint --ext .ts src", | ||
"lint:exports": "attw --pack . --ignore-rules no-resolution cjs-resolves-to-esm", | ||
"lint:package": "publint ." | ||
}, | ||
"files": [ | ||
"dist", | ||
"package.json" | ||
], | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
"default": "./dist/index.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"devDependencies": { | ||
"@arethetypeswrong/cli": "0.13.2", | ||
"@tsconfig/strictest": "2.0.2", | ||
"@typescript-eslint/eslint-plugin": "6.13.1", | ||
"@typescript-eslint/parser": "6.13.1", | ||
"bun-types": "1.0.14", | ||
"eslint": "8.54.0", | ||
"publint": "0.2.6", | ||
"typescript": "5.3.2" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://npm.pkg.github.com" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended-type-checked", | ||
"plugin:@typescript-eslint/stylistic-type-checked" | ||
], | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": true, | ||
"tsconfigRootDir": "." | ||
}, | ||
"root": true, | ||
"rules": { | ||
"@typescript-eslint/no-empty-interface": "off" | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"exclude": ["node_modules", "dist", "src/*.test.ts"] | ||
} | ||
|
Oops, something went wrong.