Skip to content

Commit

Permalink
add build for esm module and commonsjs
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoudmoravej committed Apr 26, 2024
1 parent 21e4719 commit 187fd15
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 6 deletions.
14 changes: 14 additions & 0 deletions packages/material-tailwind-react/.es6.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"minify": true,
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
}
},

"isModule": true,
"module": {
"type": "es6"
}
}
16 changes: 11 additions & 5 deletions packages/material-tailwind-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@
"description": "@material-tailwind/react is an easy-to-use components library for ReactJS & Tailwind CSS inspired by Material Design.",
"repository": "https://github.com/creativetimofficial/material-tailwind",
"license": "MIT",
"main": "index.js",
"module": "dist/es6/index.js",
"typings": "index.d.ts",
"publishConfig": {
"access": "public"
},
"type": "module",
"scripts": {
"build:cjs": "swc ./src -d ./dist --only ./src/**/*.ts --config-file .swcrc",
"build:dts": "tsc --declaration --declarationMap --emitDeclarationOnly",
"copy": "cp ./package.json ./dist && cp ./README.md ./dist && cp ./LICENSE ./dist",
"build": "pnpm build:cjs && pnpm build:dts && pnpm copy",
"buildbase:commonjs": "swc ./src -d ./dist/commonjs --only ./src/**/*.ts --config-file .swcrc",
"buildbase:es6": "swc ./src -d ./dist/es6 --only ./src/**/*.ts --config-file .es6.swcrc --no-swcrc",
"buildbase:dts": "tsc --declaration --declarationMap --emitDeclarationOnly",
"buildbase:dts:es6": "pnpm buildbase:dts --project tsconfig.es6.json",
"copy:commonjs": "cp ./package.json ./dist/commonjs && cp ./README.md ./dist/commonjs && cp ./LICENSE ./dist/commonjs",
"copy:es6": "cp ./package.json ./dist/es6 && cp ./README.md ./dist/es6 && cp ./LICENSE ./dist/es6",
"build:commonjs": "pnpm buildbase:commonjs && pnpm buildbase:dts && pnpm copy:commonjs",
"build:es6": "pnpm buildbase:es6 && pnpm buildbase:dts:es6 && pnpm copy:es6",
"build": "pnpm build:commonjs && pnpm build:es6",
"lint:check": "eslint . --ext js,jsx,ts,tsx --max-warnings=0 --config .eslintrc.json --no-eslintrc",
"prettier:check": "prettier -c ."
},
Expand Down
25 changes: 25 additions & 0 deletions packages/material-tailwind-react/tsconfig.es6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"include": ["src"],
"compilerOptions": {
"lib": ["ES2021", "DOM", "DOM.Iterable"],
"incremental": false,
"isolatedModules": true,
"importsNotUsedAsValues": "error",
"allowJs": true,
"esModuleInterop": true,
"jsx": "react",
"moduleResolution": "node",
"module": "ES6",
"target": "ES6",
"strict": false,
"skipLibCheck": true,
"resolveJsonModule": true,
"noUncheckedIndexedAccess": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist/es6",
"declarationMap": true,
"baseUrl": ".",
"typeRoots": ["./node_modules/@types"]
}
}
2 changes: 1 addition & 1 deletion packages/material-tailwind-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"noUncheckedIndexedAccess": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist",
"outDir": "dist/commonjs",
"declarationMap": true,
"baseUrl": ".",
"typeRoots": ["./node_modules/@types"]
Expand Down

0 comments on commit 187fd15

Please sign in to comment.