Skip to content

Commit

Permalink
Bump scaffold (#61)
Browse files Browse the repository at this point in the history
* Bump scaffold

* Add eslint-import-resolver-*

* Fix extension

* Rectify

---------

Co-authored-by: @compulim <@compulim>
Co-authored-by: William Wong <compulim@hotmail.com>
  • Loading branch information
compulim-workflow-bot[bot] and compulim authored Oct 13, 2024
1 parent feb03ee commit c242bb7
Show file tree
Hide file tree
Showing 27 changed files with 207 additions and 43 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 }}
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Breaking changes
### Removed

- Removed named exports, please import the defaults instead
- 💢 Removed named exports, please import the defaults instead
- Use `import { useRefFrom } from 'use-ref-from'` instead
- Moved build tools from Babel to tsup/esbuild

### Changed

- 💢 Moved build tools from Babel to tsup/esbuild
- Bumped dependencies, in PR [#55](https://github.com/compulim/use-ref-from/pull/55), and [#59](https://github.com/compulim/use-ref-from/pull/59)
- Development dependencies
- [`@babel/core@7.24.6`](https://npmjs.com/package/@babel/core/v/7.24.6)
Expand Down
118 changes: 108 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 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 All @@ -37,6 +36,8 @@
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"eslint": "^8.57.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.3",
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
2 changes: 1 addition & 1 deletion packages/pages/src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { render } from 'react-dom';
// import { createRoot } from 'react-dom/client';

import App from './App';
import App from './App.tsx';

const rootElement = document.getElementById('root');

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
Loading

0 comments on commit c242bb7

Please sign in to comment.