Skip to content

Commit

Permalink
refactor: use pnpm, modernize things (#1033)
Browse files Browse the repository at this point in the history
closes #695
closes #748
closes #1018
closes #970
  • Loading branch information
simenandre committed Nov 11, 2023
1 parent 964876f commit cc0fec1
Show file tree
Hide file tree
Showing 30 changed files with 5,611 additions and 5,244 deletions.
31 changes: 31 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @type {import('eslint').Linter.Config}
**/

module.exports = {
extends: [
'@bjerk/eslint-config/base',
'@bjerk/eslint-config/typescript',
// '@bjerk/eslint-config/import',
// '@bjerk/eslint-config/prettier',
],
overrides: [
{
files: ['*.test.ts', '*.test.tsx'],
rules: {
// TODO: Improve tests and remove these rules
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
'no-restricted-globals': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
},
},
],
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
};
32 changes: 0 additions & 32 deletions .eslintrc.json

This file was deleted.

27 changes: 1 addition & 26 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>bjerkio/workflows"],
"postUpdateOptions": ["yarnDedupeHighest"],

"packageRules": [
{
"matchDatasources": ["npm"],
"matchUpdateTypes": ["pin"],
"groupName": "pin dependencies",
"groupSlug": "yarn-unpinned"
},
{
"matchDatasources": ["npm"],
"matchUpdateTypes": ["minor", "patch"],
"excludePackageNames": ["oidc-client-ts"],
"groupName": "minor dependency updates",
"groupSlug": "minor-deps"
},
{
"matchDatasources": ["npm"],
"matchPackageNames": [
"react",
"react-dom",
"@types/react",
"@types/react-dom"
],
"matchUpdateTypes": ["minor", "patch"],
"groupName": "React minor dependency updates",
"groupSlug": "react-minor-deps"
},
{
"matchDatasources": ["npm"],
"matchPackageNames": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: On PR
on: [pull_request]

jobs:
Expand All @@ -11,25 +11,28 @@ jobs:
node-version: [lts/-2, lts/-1, lts/*, current]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup pnpm 📦️
uses: pnpm/action-setup@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache: pnpm

- run: yarn install
- run: node --version

- run: yarn run lint
- run: pnpm install --frozen-lockfile

- run: yarn run build
- run: pnpm run lint

- run: yarn run format:check
- run: pnpm run test

- run: yarn test
env:
CI: true
- run: pnpm run build

- run: pnpm run format:check

- uses: codecov/codecov-action@v3

Expand Down
55 changes: 24 additions & 31 deletions .github/workflows/workflow.yml → .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: On Push
on:
push:
branches:
Expand All @@ -15,60 +15,51 @@ jobs:
node-version: [lts/-2, lts/-1, lts/*, current]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup pnpm 📦️
uses: pnpm/action-setup@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache: pnpm

- run: node --version

- run: yarn install
- run: pnpm install --frozen-lockfile

- run: pnpm run test

- run: yarn test
- run: pnpm run build

- run: yarn run build
- uses: codecov/codecov-action@v3

- name: Bundlewatch
run: yarn run bundlewatch
run: pnpm run bundlewatch
env:
BUNDLEWATCH_GITHUB_TOKEN: '${{ secrets.BJERKBOT_GITHUB_TOKEN }}'
CI_BRANCH_BASE: main

release-please:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v3

- uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.BJERKBOT_GITHUB_TOKEN }}
release-type: node
package-name: create-bjerk-typescript

generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup pnpm 📦️
uses: pnpm/action-setup@v2

- name: Setup Node
- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn
node-version: lts
cache: pnpm

- run: yarn install
- run: pnpm install --frozen-lockfile

- name: Run typegen
run: yarn run generate-docs
run: pnpm run generate-docs

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
Expand All @@ -77,4 +68,6 @@ jobs:
delete-branch: true
commit-message: 'chore(docs): run typegen'
title: 'chore(docs): run typegen'
body: 'This is automatically created since the documentation is out of date.'
body:
'This is automatically created since the documentation is out of
date.'
31 changes: 31 additions & 0 deletions .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release to NPM

on:
release:
types: [published]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2

- name: Use Node LTS ✨
uses: actions/setup-node@v3
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
cache: pnpm

- name: Install dependencies 📦️
run: pnpm install --frozen-lockfile

- name: Build 🔨
run: pnpm build

- uses: simenandre/publish-with-pnpm@v1
with:
npm-auth-token: ${{ secrets.NPM_TOKEN }}
49 changes: 0 additions & 49 deletions .github/workflows/release.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/run-yarn-publish.yml

This file was deleted.

11 changes: 2 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
Expand Down Expand Up @@ -55,9 +53,6 @@ typings/
# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

Expand All @@ -84,7 +79,5 @@ typings/
.env.production.local

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

package-lock.json
package-lock.json
pnpm-debug.log*
Loading

0 comments on commit cc0fec1

Please sign in to comment.