Skip to content

Commit

Permalink
Bump scaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
@compulim committed Oct 13, 2024
1 parent feb03ee commit 4f34e72
Show file tree
Hide file tree
Showing 24 changed files with 93 additions and 29 deletions.
1 change: 1 addition & 0 deletions .eslintrc.jest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ rules:
react/display-name: off
# Disable for convenience
react/prop-types: off
'@typescript-eslint/no-require-imports': off
11 changes: 9 additions & 2 deletions .eslintrc.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ rules:
import/exports-last: error
import/extensions:
- error
- always
- ignorePackages # eslint-plugin-import does not understand named import
import/first: error
import/newline-after-import: error
import/no-anonymous-default-export: error
import/no-duplicates: error
import/no-namespace: error
import/no-unassigned-import: error
import/no-unassigned-import:
- error
- allow:
- '**/*.css'
- dotenv/config
settings:
import/extensions:
- .cjs
Expand All @@ -41,3 +45,6 @@ settings:
- .mts
- .ts
- .tsx
import/resolver:
node: true
typescript: true
3 changes: 3 additions & 0 deletions .eslintrc.typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ parser: '@typescript-eslint/parser'
plugins:
- '@typescript-eslint'
rules:
# Shortening if-statement into &&, ||, or ternary operators.
'@typescript-eslint/no-unused-expressions': off

'@typescript-eslint/no-unused-vars':
- error
- argsIgnorePattern: ^_
Expand Down
2 changes: 0 additions & 2 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
env:
browser: true
extends:
- eslint:recommended
overrides:
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
name: Prepare release

on:
workflow_dispatch: {}
workflow_dispatch:
inputs:
version-to-bump:
default: patch
description: Version to bump
options:
- major
- minor
- patch
required: true
type: choice

jobs:
call-workflow:
Expand All @@ -10,3 +20,5 @@ jobs:
id-token: write
secrets: inherit
uses: compulim/workflows/.github/workflows/prepare-release.yml@main
with:
version-to-bump: ${{ inputs.version-to-bump }}
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
],
"scripts": {
"build": "npm run build --if-present --workspaces",
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix && npm run bump:packages && npm run bump:eslintrc",
"bump:auditfix": "npm audit fix || exit 0",
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:packages && npm run bump:eslintrc",
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"bump:eslintrc": "if [ -f node_modules/react/package.json ]; then docker run -e VERSION=$(cat node_modules/react/package.json | jq -r '.version') -i --rm mikefarah/yq '.settings.react.version = strenv(VERSION)' < ./.eslintrc.react.yml | tee /tmp/output.tmp && mv /tmp/output.tmp ./.eslintrc.react.yml; fi",
"bump:packages": "npm run bump --if-present --workspaces",
Expand Down
2 changes: 2 additions & 0 deletions packages/integration-test/.eslintrc.custom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
env:
browser: true
3 changes: 1 addition & 2 deletions packages/integration-test/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
extends:
- ../../.eslintrc.react.yml
- ../../.eslintrc.jest.yml
- ./.eslintrc.custom.yml
5 changes: 2 additions & 3 deletions packages/integration-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
"description": "",
"private": true,
"scripts": {
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix",
"bump:auditfix": "npm audit fix || exit 0",
"bump": "npm run bump:prod && npm run bump:dev",
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"precommit": "eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts ./",
"precommit": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts ./",
"switch": "cat package.json | jq --arg SWITCH_NAME $SWITCH_NAME -r '(.[\"switch:\" + $SWITCH_NAME] // {}) as $TEMPLATE | .devDependencies += ($TEMPLATE.devDependencies // {}) | .dependencies += ($TEMPLATE.dependencies // {})' | tee ./package.json.tmp && mv ./package.json.tmp ./package.json",
"test": "jest"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/integration-test/tsconfig.custom.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@tsconfig/strictest/tsconfig.json"
}
3 changes: 2 additions & 1 deletion packages/integration-test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
{
"compilerOptions": {
"jsx": "react"
}
},
"extends": "./tsconfig.custom.json"
}
Empty file.
4 changes: 4 additions & 0 deletions packages/pages/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
env:
browser: true
extends:
- ./.eslintrc.custom.yml
6 changes: 3 additions & 3 deletions packages/pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"private": true,
"scripts": {
"build": "esbuild --bundle --entry-names=[name]/[ext]/main --jsx=automatic --minify --outdir=./public/static/ --sourcemap app=./src/app/index.tsx",
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix",
"bump:auditfix": "npm audit fix || exit 0",
"bump": "npm run bump:prod && npm run bump:dev",
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"precommit": "npm run precommit:typescript",
"precommit": "npm run precommit:eslint && npm run precommit:typescript",
"precommit:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts ./src/",
"precommit:typescript": "tsc --project ./src/tsconfig.json",
"reinstall": "rm -r node_modules package-lock.json && npm install",
"start": "npm run build -- --servedir=./public",
Expand Down
3 changes: 3 additions & 0 deletions packages/pages/src/tsconfig.custom.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@tsconfig/strictest/tsconfig.json"
}
12 changes: 9 additions & 3 deletions packages/pages/src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
{
"compilerOptions": {
"allowImportingTsExtensions": true,
"esModuleInterop": true,
"jsx": "react",
"lib": ["DOM", "ESNext", "WebWorker"],
"lib": [
"DOM",
"ESNext",
"WebWorker"
],
"moduleResolution": "Bundler",
"noEmit": true,
"strict": true,
"target": "ESNext"
"target": "ESNext",
"types": []
},
"extends": "@tsconfig/strictest/tsconfig.json"
"extends": "./tsconfig.custom.json"
}
Empty file.
2 changes: 2 additions & 0 deletions packages/use-ref-from/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- ./.eslintrc.custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const run = ({ filename }) => {

const TS_EXPECT_ERROR = /(\/\/\s+)(@ts-expect-error)[\s+(.*)]/gu;
const TSCONFIG = {
allowImportingTsExtensions: true,
allowSyntheticDefaultImports: true,
jsx: typeScript.JsxEmit.React,
noEmit: true,
Expand Down
5 changes: 2 additions & 3 deletions packages/use-ref-from/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
"typings": "./dist/use-ref-from.d.ts",
"scripts": {
"build": "tsup",
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix",
"bump:auditfix": "npm audit fix || exit 0",
"bump": "npm run bump:prod && npm run bump:dev",
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"precommit": "npm run precommit:eslint && npm run precommit:publint && npm run precommit:typescript:production && npm run precommit:typescript:test",
"precommit:eslint": "eslint ./src/",
"precommit:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint ./src/",
"precommit:publint": "publint",
"precommit:typescript:production": "tsc --noEmit --project ./src/tsconfig.precommit.production.json",
"precommit:typescript:test": "tsc --noEmit --project ./src/tsconfig.precommit.test.json",
Expand Down
3 changes: 3 additions & 0 deletions packages/use-ref-from/src/tsconfig.custom.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@tsconfig/strictest/tsconfig.json"
}
8 changes: 6 additions & 2 deletions packages/use-ref-from/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
"moduleResolution": "Bundler",
"noEmit": true,
"strict": true,
"target": "ESNext"
"target": "ESNext",
"types": [
"jest",
"node"
]
},
"extends": "@tsconfig/strictest/tsconfig.json"
"extends": "./tsconfig.custom.json"
}
13 changes: 10 additions & 3 deletions packages/use-ref-from/src/tsconfig.precommit.production.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@
"moduleResolution": "Bundler",
"noEmit": true,
"strict": true,
"target": "ESNext"
"target": "ESNext",
"types": []
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "__tests__/**/*"],
"extends": "@tsconfig/strictest/tsconfig.json"
"exclude": [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.test.ts",
"**/*.test.tsx",
"__tests__/**/*"
],
"extends": "./tsconfig.custom.json"
}
15 changes: 13 additions & 2 deletions packages/use-ref-from/src/tsconfig.precommit.test.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
{
"compilerOptions": {
"allowImportingTsExtensions": true,
"esModuleInterop": true,
"jsx": "react",
"module": "ESNext",
"moduleResolution": "Bundler",
"noEmit": true,
"strict": true,
"target": "ESNext"
"target": "ESNext",
"types": [
"jest",
"node"
]
},
"extends": "@tsconfig/recommended/tsconfig.json",
"include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "__tests__/**/*"]
"include": [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.test.ts",
"**/*.test.tsx",
"__tests__/**/*"
]
}

0 comments on commit 4f34e72

Please sign in to comment.