Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
s8wa2 committed Jan 13, 2024
0 parents commit 5fd7a95
Show file tree
Hide file tree
Showing 10 changed files with 2,897 additions and 0 deletions.
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": []
}
21 changes: 21 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI
on:
push:
branches:
- '**'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
- run: pnpm run lint && pnpm run build
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish
on:
workflow_run:
workflows: [CI]
branches: [main]
types: [completed]

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# NPM package template
- Typed, uses [tsup](https://npmjs.com/package/tsup)
- Automatic deployment to npm
- Easy versioning w/ [changeset](https://www.npmjs.com/package/@changesets/cli)
- Performance gains with [pnpm](https://pnpm.io)
- Inspired by @mattpocock and his [example repo](https://github.com/mattpocock/pkg-demo)

## Usage
1. Add a repository secret named NPM_TOKEN and set it to your npm access token
2. Check the "Allow GitHub Actions to create and approve pull requests " box in repository settings, actions/general category
3. Make some changes
4. Run `pnpm changeset` and describe your changes
5. Commit and push your changes
6. Approve the pull request github actions made
7. If actions succeed, check npm for published package
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "tsup-package-template",
"version": "0.0.0",
"private": false,
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --minify --dts --sourcemap",
"lint": "tsc",
"release": "pnpm run build && changeset publish"
},
"license": "MIT",
"devDependencies": {
"@changesets/cli": "^2.27.1",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
}
}
Loading

0 comments on commit 5fd7a95

Please sign in to comment.