Skip to content

Commit

Permalink
Merge pull request #606 from Spiral-Memory/feat/improve_monorepo_build
Browse files Browse the repository at this point in the history
feat: improve pkg size while bundled
  • Loading branch information
sidmohanty11 authored Jul 10, 2024
2 parents 5248ecb + a16b4c5 commit 6552501
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 33 deletions.
1 change: 0 additions & 1 deletion packages/markups/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"rimraf": "^5.0.1",
"rollup": "^2.70.1",
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.2",
Expand Down
19 changes: 11 additions & 8 deletions packages/markups/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,33 @@ import babel from '@rollup/plugin-babel';
import postcss from 'rollup-plugin-postcss';
import external from 'rollup-plugin-peer-deps-external';
import json from '@rollup/plugin-json';
import bundleSize from 'rollup-plugin-bundle-size';
import { terser } from 'rollup-plugin-terser';
import replace from '@rollup/plugin-replace';
import analyze from 'rollup-plugin-analyzer';
import dts from 'rollup-plugin-dts';

const packageJson = require('./package.json');
const PRODUCTION = process.env.NODE_ENV === 'production';

export default [
{
input: 'src/index.js',
output: [
{
file: packageJson.main,
dir: 'dist/cjs',
format: 'cjs',
sourcemap: true,
sourcemap: 'hidden',
preserveModules: true,
preserveModulesRoot: 'src',
plugins: [PRODUCTION && terser()],
exports: 'auto',
},

{
file: packageJson.module,
dir: 'dist/esm',
format: 'esm',
sourcemap: true,
sourcemap: 'hidden',
preserveModules: true,
preserveModulesRoot: 'src',
plugins: [PRODUCTION && terser()],
},
],
Expand Down Expand Up @@ -63,14 +67,13 @@ export default [
limit: 20,
summaryOnly: true,
}),
bundleSize(),
],
},

{
input: 'src/index.js',
output: {
file: packageJson.types,
file: 'dist/esm/index.d.ts',
format: 'es',
},
plugins: [dts()],
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"scripts": {
"prebuild": "rimraf dist",
"build": "rollup -c --context=window --environment NODE_ENV:production",
"build": "yarn prebuild && rollup -c --context=window --environment NODE_ENV:production",
"watch": "rollup -c --watch --context=window",
"test:lint": "eslint src/**/*.js",
"format": "prettier --write 'src/' ",
Expand Down
1 change: 1 addition & 0 deletions packages/ui-elements/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
rollup.config.js
*.test.js
dist/
3 changes: 1 addition & 2 deletions packages/ui-elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"scripts": {
"prebuild": "rimraf dist",
"build": "rollup -c --context=window --environment NODE_ENV:production",
"build": "yarn prebuild && rollup -c --context=window --environment NODE_ENV:production",
"watch": "rollup -c --watch --context=window",
"test:lint": "eslint src/**/*.js",
"format": "prettier --write 'src/' ",
Expand Down Expand Up @@ -70,7 +70,6 @@
"rimraf": "^5.0.1",
"rollup": "^2.70.1",
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.2",
Expand Down
19 changes: 11 additions & 8 deletions packages/ui-elements/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,33 @@ import babel from '@rollup/plugin-babel';
import postcss from 'rollup-plugin-postcss';
import external from 'rollup-plugin-peer-deps-external';
import json from '@rollup/plugin-json';
import bundleSize from 'rollup-plugin-bundle-size';
import { terser } from 'rollup-plugin-terser';
import replace from '@rollup/plugin-replace';
import analyze from 'rollup-plugin-analyzer';
import dts from 'rollup-plugin-dts';

const packageJson = require('./package.json');
const PRODUCTION = process.env.NODE_ENV === 'production';

export default [
{
input: 'src/index.js',
output: [
{
file: packageJson.main,
dir: 'dist/cjs',
format: 'cjs',
sourcemap: true,
sourcemap: 'hidden',
preserveModules: true,
preserveModulesRoot: 'src',
plugins: [PRODUCTION && terser()],
exports: 'auto',
},

{
file: packageJson.module,
dir: 'dist/esm',
format: 'esm',
sourcemap: true,
sourcemap: 'hidden',
preserveModules: true,
preserveModulesRoot: 'src',
plugins: [PRODUCTION && terser()],
},
],
Expand Down Expand Up @@ -58,14 +62,13 @@ export default [
limit: 20,
summaryOnly: true,
}),
bundleSize(),
],
},

{
input: 'src/index.js',
output: {
file: packageJson.types,
file: 'dist/esm/index.d.ts',
format: 'es',
},
plugins: [dts()],
Expand Down
3 changes: 1 addition & 2 deletions packages/ui-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"scripts": {
"prebuild": "rimraf dist",
"build": "rollup -c --context=window --environment NODE_ENV:production",
"build": "yarn prebuild && rollup -c --context=window --environment NODE_ENV:production",
"watch": "rollup -c --watch --context=window",
"test:lint": "eslint src/**/*.js",
"format": "prettier --write 'src/' ",
Expand Down Expand Up @@ -60,7 +60,6 @@
"rimraf": "^5.0.1",
"rollup": "^2.70.1",
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.2",
Expand Down
19 changes: 11 additions & 8 deletions packages/ui-kit/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,33 @@ import babel from '@rollup/plugin-babel';
import postcss from 'rollup-plugin-postcss';
import external from 'rollup-plugin-peer-deps-external';
import json from '@rollup/plugin-json';
import bundleSize from 'rollup-plugin-bundle-size';
import { terser } from 'rollup-plugin-terser';
import replace from '@rollup/plugin-replace';
import analyze from 'rollup-plugin-analyzer';
import dts from 'rollup-plugin-dts';

const packageJson = require('./package.json');
const PRODUCTION = process.env.NODE_ENV === 'production';

export default [
{
input: 'src/index.js',
output: [
{
file: packageJson.main,
dir: 'dist/cjs',
format: 'cjs',
sourcemap: true,
sourcemap: 'hidden',
preserveModules: true,
preserveModulesRoot: 'src',
plugins: [PRODUCTION && terser()],
exports: 'auto',
},

{
file: packageJson.module,
dir: 'dist/esm',
format: 'esm',
sourcemap: true,
sourcemap: 'hidden',
preserveModules: true,
preserveModulesRoot: 'src',
plugins: [PRODUCTION && terser()],
},
],
Expand Down Expand Up @@ -64,14 +68,13 @@ export default [
limit: 20,
summaryOnly: true,
}),
bundleSize(),
],
},

{
input: 'src/index.js',
output: {
file: packageJson.types,
file: 'dist/esm/index.d.ts',
format: 'es',
},
plugins: [dts()],
Expand Down
3 changes: 0 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2311,7 +2311,6 @@ __metadata:
rimraf: ^5.0.1
rollup: ^2.70.1
rollup-plugin-analyzer: ^4.0.0
rollup-plugin-bundle-size: ^1.0.3
rollup-plugin-dts: ^6.1.1
rollup-plugin-peer-deps-external: ^2.2.4
rollup-plugin-postcss: ^4.0.2
Expand Down Expand Up @@ -2513,7 +2512,6 @@ __metadata:
rimraf: ^5.0.1
rollup: ^2.70.1
rollup-plugin-analyzer: ^4.0.0
rollup-plugin-bundle-size: ^1.0.3
rollup-plugin-dts: ^6.1.1
rollup-plugin-peer-deps-external: ^2.2.4
rollup-plugin-postcss: ^4.0.2
Expand Down Expand Up @@ -2574,7 +2572,6 @@ __metadata:
rimraf: ^5.0.1
rollup: ^2.70.1
rollup-plugin-analyzer: ^4.0.0
rollup-plugin-bundle-size: ^1.0.3
rollup-plugin-dts: ^6.1.1
rollup-plugin-peer-deps-external: ^2.2.4
rollup-plugin-postcss: ^4.0.2
Expand Down

0 comments on commit 6552501

Please sign in to comment.