Skip to content

Commit

Permalink
Convert to pnpm, add changesets, vitest, devbox, github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
burritobill committed Nov 3, 2024
1 parent ab9d3ad commit 5fb8388
Show file tree
Hide file tree
Showing 17 changed files with 1,979 additions and 2,603 deletions.
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@cultureamp/changelog-github",
{ "repo": "cultureamp/changelog-github" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/yellow-trees-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cultureamp/changelog-github": patch
---

Dependency updates
7 changes: 7 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Automatically sets up your devbox environment whenever you cd into this
# directory via our direnv integration:

eval "$(devbox generate direnv --print-envrc)"

# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
# for more details
22 changes: 22 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This is a composite action (a step we can reuse in workflows)
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action

name: Setup repository
description: Install and build packages

runs:
using: composite
steps:
- run: corepack enable
shell: bash
# setup node, install and cache packages
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version-file: .nvmrc
registry-url: https://npm.pkg.github.com
- run: pnpm install --frozen-lockfile
shell: bash
env:
NODE_AUTH_TOKEN: ${{ github.token }}
NODE_OPTIONS: "--max-old-space-size=4096"
41 changes: 41 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: ci

on:
push:
branches-ignore:
- master

# When Changesets opens a PR it does not trigger GitHub actions,
# because its token does not have permission to. This is a hack
# to allow one of us to trigger GitHub actions for a changesets PR
# by enabling automerge on the PR.
pull_request_target:
types:
- auto_merge_enabled
branches:
- master # the target branch of the PR
paths:
- "**/CHANGELOG.md" # only changesets releases touch changelogs

jobs:
typescript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: pnpm compile

prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: pnpm prettier

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: Run unit tests
run: pnpm test
25 changes: 25 additions & 0 deletions .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "canary release"

on:
workflow_dispatch:
inputs:
label:
description: "Pick a label for the release, to be included in the version number — e.g. '1.0.0-\\${label}.x' (note: can't contain slashes!)"
required: true
type: string

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: "release (canary) with label: ${{ github.event.inputs.label }}"
run: |
pnpm compile
pnpm changeset version --snapshot "$LABEL"
pnpm changeset publish --tag "$LABEL"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ github.token }}
LABEL: ${{ github.event.inputs.label }}
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: release

on:
push:
branches:
- "master"

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: changesets/action@v1
with:
version: pnpm version:ci
publish: pnpm publish:ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ github.token }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dist/
node_modules/
yarn-*.log
.env
.env
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.16.0
19 changes: 19 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Ignore everything by default:
*

# Whitelist by file extension...
!**/
!*.ts
!*.tsx
!*.js
!*.json
!*.css
!*.scss
!*.html

# Override and explicitly ignore...
**/node_modules/
**/build/
**/dist/
devbox.json
.devbox
17 changes: 17 additions & 0 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/main/.schema/devbox.schema.json",
"packages": ["[email protected]"],
"env": {
"DEVBOX_COREPACK_ENABLED": "1",
"npm_config_python": "/usr/bin/python3"
},
"shell": {
"init_hook": [
// keep nvmrc in sync with devbox's node version
"node --version | sed 's/v//' > .nvmrc"
],
"scripts": {
"setup": "pnpm install"
}
}
}
70 changes: 70 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"lockfile_version": "1",
"packages": {
"[email protected]": {
"last_modified": "2024-08-31T10:12:23Z",
"plugin_version": "0.0.2",
"resolved": "github:NixOS/nixpkgs/5629520edecb69630a3f4d17d3d33fc96c13f6fe#nodejs_20",
"source": "devbox-search",
"version": "20.16.0",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/iikbj8fwd3msxvh747v22b0gpf1rckww-nodejs-20.16.0",
"default": true
},
{
"name": "libv8",
"path": "/nix/store/clzfgrh8fmzgr8jmv2266b30qh4mqlxa-nodejs-20.16.0-libv8"
}
],
"store_path": "/nix/store/iikbj8fwd3msxvh747v22b0gpf1rckww-nodejs-20.16.0"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/rbv8jmnhifp2znxc4issvl7zgmy7f24j-nodejs-20.16.0",
"default": true
},
{
"name": "libv8",
"path": "/nix/store/2hqnq9snccm7n7346k5bqj657mp85lb3-nodejs-20.16.0-libv8"
}
],
"store_path": "/nix/store/rbv8jmnhifp2znxc4issvl7zgmy7f24j-nodejs-20.16.0"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/azpkc2aw75nabkv9pq07j4rxw92fm7i6-nodejs-20.16.0",
"default": true
},
{
"name": "libv8",
"path": "/nix/store/8qjcn62342vpl6r1l9f22l901fj8cqbc-nodejs-20.16.0-libv8"
}
],
"store_path": "/nix/store/azpkc2aw75nabkv9pq07j4rxw92fm7i6-nodejs-20.16.0"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/alik5i1lm5kfm61fh3pg221czk7pmv4g-nodejs-20.16.0",
"default": true
},
{
"name": "libv8",
"path": "/nix/store/sl8zwksqc08asblhr5r36dlhzy6brmpk-nodejs-20.16.0-libv8"
}
],
"store_path": "/nix/store/alik5i1lm5kfm61fh3pg221czk7pmv4g-nodejs-20.16.0"
}
}
}
}
}
6 changes: 0 additions & 6 deletions jest.config.js

This file was deleted.

35 changes: 23 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@cultureamp/changelog-github",
"version": "0.1.0",
"packageManager": "[email protected]",
"description": "Changelog generator based on atlassian/changelog-github",
"main": "dist",
"license": "MIT",
Expand All @@ -16,21 +17,31 @@
"dist/"
],
"scripts": {
"test": "jest",
"prepublish": "tsc"
"test": "vitest run",
"compile": "tsc --build",
"prepublish": "tsc",
"prettier": "prettier --check '**/*'",
"prettier:fix": "prettier --write '**/*'",
"version:ci": "pnpm compile && pnpm changeset version",
"publish:ci": "pnpm compile && pnpm changeset publish"
},
"dependencies": {
"@changesets/get-github-info": "^0.5.0",
"@changesets/types": "^4.0.1",
"dotenv": "^8.1.0"
"@changesets/get-github-info": "^0.6.0",
"@changesets/types": "^6.0.0",
"dotenv": "^16.4.5"
},
"devDependencies": {
"@changesets/parse": "^0.3.9",
"@tsconfig/node14": "^1.0.1",
"@types/jest": "^27.0.1",
"@types/node": "^16.9.2",
"jest": "^27.2.0",
"ts-jest": "^27.0.5",
"typescript": "^4.4.3"
"@changesets/cli": "^2.27.9",
"@changesets/parse": "^0.4.0",
"@tsconfig/node14": "^14.1.2",
"@types/node": "^22.8.6",
"vitest": "^2.1.3",
"typescript": "^5.6.3",
"prettier": "^3.3.3"
},
"prettier": {
"semi": false,
"arrowParens": "avoid",
"trailingComma": "es5"
}
}
Loading

0 comments on commit 5fb8388

Please sign in to comment.