Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalics committed Oct 2, 2023
1 parent 4bd10d4 commit fb360b8
Show file tree
Hide file tree
Showing 12 changed files with 223 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: vitalics

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- JS runtime (Node.js / Bun / Deno)[e.g. Bun 1.0.0]
- Version [e.g. 0.1.1]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: vitalics

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
19 changes: 19 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Pull Request - Build
on:
# Triggers the workflow on push or pull request events but only for the develop branch
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- run: bun install
- name: Generate build
run: bun run build
- name: Run Tests
run: bun run test
36 changes: 36 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write
packages: write

# Automatically cancel in-progress actions on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build Packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run build
- uses: changesets/action@v1
if: ${{ github.event_name != 'pull_request' }}
with:
version: bun run ci:version
publish: bun run ci:publish
commit: "[ci] release"
title: "[ci] release"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# npm-bun-tsup-library
# npm library template

npm repo template using bun, tsup

## Build

```bash
bun build
```

## Tech stack

- bun
- tsup
Binary file added bun.lockb
Binary file not shown.
41 changes: 41 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "npm-bun-tsup-library",
"description": "My Library template",
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsup",
"test": "echo 'Not defined' || exit 1",
"ci:version": "changeset version && bun install --no-frozen-lockfile",
"ci:publish": "changeset publish"
},
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
},
"keywords": [
"cool",
"package"
],
"devDependencies": {
"@changesets/cli": "^2.26.2",
"bun-types": "latest",
"tsup": "^7.2.0",
"typescript": "^5.2.2"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"license": "MIT"
}
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function hello() {
return 'world'
}
22 changes: 22 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"noEmit": true,
"composite": true,
"strict": true,
"downlevelIteration": true,
"skipLibCheck": true,
"jsx": "react-jsx",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"allowJs": true,
"types": [
"bun-types" // add Bun global
]
}
}
19 changes: 19 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from 'tsup'

export default defineConfig(() => ({
entry: ['src/index.ts'],
format: ['cjs', 'esm'],
external: [],
splitting: false,
clean: true,
cjsInterop: true,
dts: true,
target: ['node18'],
shims: true,
tsconfig: './tsconfig.json',
outExtension({ format }) {
return {
js: format === 'cjs' ? '.cjs' : format === 'esm' ? `.mjs` : '.js',
}
},
}));

0 comments on commit fb360b8

Please sign in to comment.