Skip to content

Commit

Permalink
build commonjs and esm
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtsquiggs committed Oct 25, 2023
1 parent 66da953 commit 113acaf
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules/
lib/
dist/
/react-mosaic-component.css*
.*.swp
react-mosaic.tar.bz2
Expand Down
19 changes: 13 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
"version": "6.1.0",
"description": "A React Tiling Window Manager",
"license": "Apache-2.0",
"main": "lib/index.js",
"style": "lib/react-mosaic.css",
"type": "commonjs",
"typings": "lib/index.d.ts",
"main": "dist/cjs/index.js",
"module": "dist/mjs/index.js",
"typings": "dist/mjs/index.d.ts",
"style": "dist/mjs/react-mosaic.css",
"exports": {
".": {
"import": "./dist/mjs/index.js",
"require": "./dist/cjs/index.js"
}
},
"repository": {
"type": "git",
"url": "https://github.com/nomcopter/react-mosaic.git"
Expand All @@ -25,10 +31,11 @@
],
"scripts": {
"build": "npm-run-all clean -lp build:**",
"build:ts": "tsc -p tsconfig-build.json",
"build:ts-cjs": "tsc -p tsconfig-cjs.json && echo '{\n \"type\": \"commonjs\"\n}' > dist/cjs/package.json",
"build:ts-esm": "tsc -p tsconfig-mjs.json && echo '{\n \"type\": \"module\"\n}' > dist/mjs/package.json",
"build:less": "lessc --autoprefix=defaults styles/index.less react-mosaic-component.css",
"bundle": "rm -rf docs/ && webpack --config webpack/bundle.ts",
"clean": "rm -rf lib/",
"clean": "rm -rf dist/",
"start": "webpack-dev-server --config webpack/hot.ts",
"prettier:run": "prettier 'styles/*.less' '*.md' '{,.}*.yml' '.circleci/*.yml'",
"test": "npm-run-all build -lp test:**",
Expand Down
3 changes: 1 addition & 2 deletions tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"compilerOptions": {
"noEmit": false,
"outDir": "lib",
"rootDir": "src"
},
"exclude": [
"demo",
"dist",
"docs",
"lib",
"node_modules",
"test",
"webpack"
Expand Down
7 changes: 7 additions & 0 deletions tsconfig-cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig-build.json",
"compilerOptions": {
"declaration": false,
"outDir": "dist/cjs"
}
}
8 changes: 8 additions & 0 deletions tsconfig-mjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig-build.json",
"compilerOptions": {
"module": "esnext",
"outDir": "dist/mjs",
"target": "es2021"
}
}
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"compileOnSave": false,
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"declaration": true,
"esModuleInterop": true,
"experimentalDecorators": true,
Expand All @@ -19,5 +21,5 @@
"sourceMap": true,
"strict": true
},
"exclude": ["docs", "lib", "node_modules"],
"exclude": ["dist", "docs", "node_modules"],
}

0 comments on commit 113acaf

Please sign in to comment.