Skip to content

Commit

Permalink
feat: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
theogravity committed Sep 22, 2024
1 parent fdedded commit 19fc004
Show file tree
Hide file tree
Showing 10 changed files with 501 additions and 522 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- name: Use pnpm
uses: pnpm/action-setup@v3
with:
run_install: |
- recursive: true
args: [--frozen-lockfile]
version: 9.11.0

- name: Build workspace packages
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install Dependencies
run: pnpm install --frozen-lockfile --prefer-offline

- name: Build packages
run: pnpm run build

- name: Run type checking
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/release-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- name: Use pnpm
uses: pnpm/action-setup@v3
with:
run_install: |
- recursive: true
args: [--frozen-lockfile]
version: 9.11.0

- name: Build workspace packages
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Build package
run: pnpm run build

- name: Run type checking
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- name: Use pnpm
uses: pnpm/action-setup@v3
with:
run_install: |
- recursive: true
args: [--frozen-lockfile]
version: 9.11.0

- name: Build workspace packages
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Build package
run: pnpm run build

- name: Run type checking
Expand All @@ -30,13 +34,13 @@ jobs:
- name: Run linting
run: pnpm run lint

- name: Create Release Pull Request / Publish Packages
- name: Create Release Pull Request / Publish Package
uses: changesets/action@v1
with:
publish: pnpm run release
version: pnpm run version-packages
commit: 'chore: release package(s)'
title: 'chore: release package(s)'
commit: 'chore: release package'
title: 'chore: release package'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
18 changes: 10 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use pnpm
uses: pnpm/action-setup@v3
with:
fetch-depth: 2
version: 9.11.0

- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
run_install: |
- recursive: true
args: [--frozen-lockfile]
node-version: 20
cache: 'pnpm'

- name: Build workspace packages
- name: Build package
run: pnpm run build

- name: Branch Information
Expand All @@ -30,6 +32,6 @@ jobs:
echo "HEAD^1 SHA: $(git rev-parse HEAD^1)"
echo "Git Diff: $(git diff HEAD^1)"
- name: Run Package(s) Tests
- name: Run Package Tests
run: |
pnpm test
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,28 @@
![NPM Downloads](https://img.shields.io/npm/dm/loglayer)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

To update:
Boilerplate for creating a new NPM package with ESM and CJS support.

## Setup

Configure the following files:

- `package.json`
- `.changeset/config.json`
- Edit `.changeset/config.json` to your repository

In Github settings:

- `Workflow permissions`
- `Code and Automation > Actions > Workflow permissions`
* `Read and write permissions`
* `Allow Github Actoins to create and approve pull requests`
* `Allow Github Actions to create and approve pull requests`
- `Secrets and variables > Actions`
* `Repository Secrets > create NPM_TOKEN`
* `Repository Secrets > Actions > create NPM_TOKEN`

## Development workflow / Add a new CHANGELOG.md entry + package versioning

- Create a branch and make changes.
- Create a new changeset entry: `pnpm changeset`
- Commit your changes and create a pull request.
- Merge the pull request
- A new PR will be created with the changeset entry/ies.
- When the PR is merged, the package versions will be bumped and published and the changelog updated.
23 changes: 6 additions & 17 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"lineWidth": 120,
"ignore": [
"vendor/*",
"node_modules/*",
"*.config.*",
"*.json",
"tsconfig.json",
".turbo",
"build/*",
"coverage/*",
".pnpm-store/*",
"dist/*"
]
"ignore": ["node_modules/*", "*.config.*", "*.json", "tsconfig.json", ".turbo", "dist/*", ".pnpm-store/*"]
},
"linter": {
"enabled": true,
"ignore": ["build/*", "coverage/*"],
"ignore": ["dist/*", ".pnpm-store/*", "packages/backend-client/*"],
"rules": {
"style": {
"noNonNullAssertion": "off"
},
"performance": {
"noDelete": "off"
},
"complexity": {
"useLiteralKeys": "off"
},
"correctness": {
"noUnusedImports": "error"
},
"suspicious": {
"noImplicitAnyLet": "off",
"noExplicitAny": "off"
Expand Down
32 changes: 15 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,27 @@
"description": "",
"version": "0.2.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"types": "dist/index.d.ts",
"author": "Theo Gravity <[email protected]>",
"keywords": [],
"scripts": {
"build": "tsup src/index.ts",
"changeset": "changeset",
"add-changeset": "changeset add",
"clean": "rm -rf node_modules dist",
"debug": "ts-node-dev --inspect -- src/index.ts",
"debug:break": "ts-node-dev --inspect-brk -- src/index.ts",
"lint": "biome check --write --unsafe src && biome format src --write && biome lint src --fix",
"lint-staged": "lint-staged",
"prepare": "husky",
"release": "changeset publish",
"syncpack:update": "syncpack update",
"syncpack:fix": "syncpack fix-mismatches",
"syncpack:update": "syncpack update && syncpack fix-mismatches && pnpm i",
"syncpack:format": "syncpack format",
"syncpack:lint": "syncpack lint",
"test": "vitest run",
Expand All @@ -34,19 +32,19 @@
"version-packages": "changeset version"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@biomejs/biome": "1.9.2",
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.7",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@types/node": "22.1.0",
"husky": "9.1.4",
"lint-staged": "15.2.7",
"tsup": "8.2.4",
"syncpack": "12.4.0",
"turbo": "2.0.9",
"typescript": "5.5.4",
"vitest": "2.0.5"
"@changesets/cli": "2.27.8",
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@types/node": "22.5.5",
"husky": "9.1.6",
"lint-staged": "15.2.10",
"tsup": "8.3.0",
"syncpack": "13.0.0",
"turbo": "2.1.2",
"typescript": "5.6.2",
"vitest": "2.1.1"
},
"bugs": "https://github.com/theogravity/example-typescript-package/issues",
"engines": {
Expand All @@ -66,7 +64,7 @@
"pnpm run syncpack:lint"
]
},
"packageManager": "pnpm@9.6.0",
"packageManager": "pnpm@9.11.0",
"publishConfig": {
"access": "public"
},
Expand Down
Loading

0 comments on commit 19fc004

Please sign in to comment.