Skip to content

Commit

Permalink
Dual-package ESM and CJS (#7)
Browse files Browse the repository at this point in the history
Postcss now supports importing plugins as ESM, so this will dual-publish ESM and CJS using TSUP.
  • Loading branch information
IanVS authored Mar 19, 2024
1 parent d9ac817 commit fd0b33d
Show file tree
Hide file tree
Showing 8 changed files with 796 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ yarn-error.log
coverage/

# build products
index.js
index.d.ts
dist/*
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
ignores: ["coverage/*", "index.js", "index.test.mjs", "index.d.ts"],
ignores: ["coverage/*", "dist"],
},
{
languageOptions: {
Expand Down
18 changes: 15 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"postcss-assign-layer"
],
"scripts": {
"build": "tsc -p tsconfig.json",
"build": "tsup src/index.ts --format esm,cjs --dts",
"test": "vitest run --coverage && eslint .",
"test:watch": "vitest",
"prepublishOnly": "pnpm build && pnpm test"
Expand All @@ -22,9 +22,20 @@
},
"homepage": "https://github.com/DefinedNet/postcss-assign-layer#readme",
"files": [
"index.js",
"index.d.ts"
"dist"
],
"exports": {
".": {
"types": {
"import": "./dist/index.d.mts",
"require": "./dist/index.d.ts"
},
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "dist/index.js",
"engines": {
"node": ">=12.0.0"
},
Expand All @@ -43,6 +54,7 @@
"eslint-plugin-no-only-tests": "^3.1.0",
"postcss": "^8.3.11",
"prettier": "^2.6.2",
"tsup": "^8.0.2",
"typescript": "^5.4.2",
"typescript-eslint": "^7.3.1",
"vite": "^4.0.0",
Expand Down
Loading

0 comments on commit fd0b33d

Please sign in to comment.