Skip to content

Commit

Permalink
Merge pull request #1 from s0/boilerplate
Browse files Browse the repository at this point in the history
Initial package boilerplate
  • Loading branch information
s0 authored Jul 14, 2024
2 parents 6488c87 + cc6077d commit 7f8519b
Show file tree
Hide file tree
Showing 13 changed files with 5,044 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": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
38 changes: 38 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/** @type {import("eslint").Linter.Config} */
const { resolve } = require("node:path");

const project = resolve(process.cwd(), "tsconfig.json");

/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["eslint:recommended", "prettier"],
plugins: ["only-warn", "jest"],
parser: "@typescript-eslint/parser",
globals: {
React: true,
JSX: true,
},
env: {
node: true,
"jest/globals": true,
},
settings: {
"import/resolver": {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
"dist/",
"coverage/",
],
overrides: [
{
files: ["*.js?(x)", "*.ts?(x)"],
},
],
};
24 changes: 24 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI Checks
on: pull_request

jobs:
ci-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Use Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20.x
- name: Extract pnpm version and install
run: |
VERSION=$(cat package.json | grep '"packageManager": "pnpm@' | sed 's/.*"pnpm@\([^"]*\)".*/\1/')
npm install -g pnpm@$VERSION
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v 4.0.2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm lint
- run: pnpm format:check
47 changes: 47 additions & 0 deletions .github/workflows/release-and-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release & Publish

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
release-and-publish:
runs-on: ubuntu-latest
environment: main
steps:

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Use Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20.x
- name: Extract pnpm version and install
run: |
VERSION=$(cat package.json | grep '"packageManager": "pnpm@' | sed 's/.*"pnpm@\([^"]*\)".*/\1/')
npm install -g pnpm@$VERSION
- name: Cache pnpm modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v 4.0.2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
- run: pnpm install --frozen-lockfile
- run: pnpm build
- name: Configure PNPM to use token
run:
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
- name: Run Changeset Workflow
uses: changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9 # v1.4.7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
publish: pnpm changeset publish
createGithubReleases: true
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# Dependencies
node_modules
.pnp
.pnp.js

# Local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Testing
coverage

# Build Outputs
dist


# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Misc
.DS_Store
*.pem
60 changes: 60 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "ghcommit",
"version": "0.1.0",
"private": false,
"description": "Directly change files on github using the github API, to support GPG signing",
"keywords": [
"actions",
"github",
"git",
"gpg"
],
"license": "MIT",
"author": {
"name": "Sam Lanning",
"url": "https://samlanning.com"
},
"repository": {
"type": "git",
"url": "https://github.com/s0/ghcommit.git"
},
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"scripts": {
"build": "tsup",
"format:check": "prettier --check \"**/*.{ts,tsx,md}\"",
"format:fix": "prettier --write \"**/*.{ts,tsx,md}\"",
"lint": "eslint . --max-warnings 0",
"test": "jest",
"test:watch": "jest --watch"
},
"devDependencies": {
"@changesets/cli": "^2.27.7",
"@types/eslint": "^8.56.5",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.24",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-only-warn": "^1.1.0",
"jest": "^29.7.0",
"prettier": "^3.3.3",
"ts-jest": "^29.2.0",
"tsup": "^8.1.0",
"typescript": "^5.3.3"
},
"files": [
"dist"
],
"packageManager": "[email protected]",
"publishConfig": {
"access": "public"
}
}
Loading

0 comments on commit 7f8519b

Please sign in to comment.