Skip to content

Commit b564ba9

Browse files
committed
Update postcss-related packages, add yarn-deduplicate, parallel css/ts builds
1 parent 3615192 commit b564ba9

File tree

3 files changed

+331
-458
lines changed

3 files changed

+331
-458
lines changed

package.json

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"types": "build/index.d.ts",
88
"exports": {
99
".": {
10+
"global": {
11+
"types": "./build/index.d.ts",
12+
"default": "./build/index.global.js"
13+
},
1014
"import": {
1115
"types": "./build/index.d.mts",
1216
"default": "./build/index.mjs"
@@ -36,9 +40,13 @@
3640
"src/style.scss"
3741
],
3842
"scripts": {
43+
"setup": "yarn && yarn deduplicate",
44+
"deduplicate": "yarn-deduplicate yarn.lock",
3945
"start": "parcel website/index.html -d tmp",
40-
"prebuild": "rm -rf build",
41-
"build": "tsup && sass src/style.scss build/style.css --no-source-map && postcss build/style.css --use autoprefixer -o build/style.css",
46+
"prebuild": "npx update-browserslist-db@latest && rm -rf build",
47+
"build": "run-p build:ts build:css",
48+
"build:ts": "tsup",
49+
"build:css": "sass src/style.scss build/style.css --no-source-map && postcss build/style.css --use autoprefixer -o build/style.css",
4250
"build:website": "rm -rf build-website/* && parcel build website/index.html -d build-website --experimental-scope-hoisting --no-content-hash && cp website/CNAME build-website/CNAME",
4351
"deploy": "gh-pages -d build-website",
4452
"dev:package": "tsup src/index.ts --watch",
@@ -64,25 +72,30 @@
6472
"@types/jest": "^30.0.0",
6573
"@types/react": "^18",
6674
"@types/react-dom": "^18",
67-
"autoprefixer": "^9.7.3",
75+
"autoprefixer": "^10.4.21",
76+
"browserslist": "^4.25.1",
6877
"date-fns": "^2.9.0",
78+
"esbuild-plugin-browserslist": "^1.0.1",
6979
"eslint": "^9.30.0",
7080
"eslint-config-prettier": "^10.1.5",
7181
"eslint-plugin-prettier": "^5.5.1",
7282
"jest": "^30.0.3",
7383
"jest-environment-jsdom": "^30.0.2",
84+
"npm-run-all": "^4.1.5",
7485
"parcel-bundler": "^1.12.4",
7586
"parcel-plugin-prerender": "^1.4.1",
76-
"postcss-cli": "^7.1.0",
87+
"postcss": "^8.5.6",
88+
"postcss-cli": "^11.0.1",
7789
"prettier": "^3.6.2",
7890
"prism-react-renderer": "^1.0.2",
7991
"react": "^18",
8092
"react-dom": "^18",
8193
"react-test-renderer": "^18.3.1",
82-
"sass": "^1.25.0",
94+
"sass": "^1.89.2",
8395
"ts-jest": "^29.4.0",
8496
"tsup": "^8.5.0",
8597
"typescript": "^5.8.3",
86-
"typescript-eslint": "^8.35.0"
98+
"typescript-eslint": "^8.35.0",
99+
"yarn-deduplicate": "^6.0.2"
87100
}
88101
}

tsup.config.mts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
import { type Options, defineConfig } from 'tsup'
2+
import browserslist from 'browserslist'
3+
import { resolveToEsbuildTarget } from 'esbuild-plugin-browserslist'
4+
5+
const target = resolveToEsbuildTarget(browserslist(), {
6+
printUnknownTargets: false
7+
})
28

39
const commons: Options = {
4-
minify: 'terser',
10+
minify: true,
511
sourcemap: true,
612
dts: true,
7-
clean: true,
8-
target: 'es2018',
9-
format: ['esm', 'cjs'],
13+
clean: false,
14+
target,
15+
format: ['esm', 'cjs', 'iife']
1016
}
1117

1218
export default defineConfig([
1319
{
1420
...commons,
1521
entryPoints: ['src/index.ts'],
1622
outDir: 'build',
17-
tsconfig: 'tsconfig.build.json',
18-
},
23+
tsconfig: 'tsconfig.build.json'
24+
}
1925
])

0 commit comments

Comments
 (0)