Skip to content

Commit

Permalink
chore(deps): upgrade Rollup to latest version
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Koops <jonkoops@gmail.com>
  • Loading branch information
jonkoops committed May 20, 2024
1 parent f746004 commit 52a153a
Show file tree
Hide file tree
Showing 12 changed files with 299 additions and 162 deletions.
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"@babel/preset-react": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@octokit/rest": "^20.0.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-terser": "^0.4.4",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "14.5.2",
Expand Down Expand Up @@ -58,6 +62,9 @@
"react": "^18",
"react-dom": "^18",
"rimraf": "^5.0.5",
"rollup": "^4.17.2",
"rollup-plugin-scss": "^4.0.0",
"sass": "^1.77.2",
"surge": "^0.23.1",
"ts-node": "^10.9.1",
"ts-patch": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-core/.npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dist/*.tsbuildinfo
tsconfig.*
rollup.config.js
rollup.config.mjs
11 changes: 2 additions & 9 deletions packages/react-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,12 @@
},
"devDependencies": {
"@patternfly/patternfly": "5.4.0-prerelease.3",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-replace": "^5.0.2",
"css": "^2.2.3",
"fs-extra": "^11.1.1",
"glob": "^7.1.2",
"rollup": "^3.21.5",
"rollup-plugin-scss": "^4.0.0",
"rollup-plugin-svg": "2.0.0",
"rollup-plugin-terser": "^7.0.2"
"glob": "^7.1.2"
},
"peerDependencies": {
"react": "^17 || ^18",
"react-dom": "^17 || ^18"
}
}
}
7 changes: 0 additions & 7 deletions packages/react-core/rollup.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions packages/react-core/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-check
import baseConfig from '../rollup.base.mjs';
import pkg from './package.json' with { type: 'json' };

export default baseConfig({
packageName: pkg.name.replace('@patternfly/', ''),
name: 'PatternFlyReact'
});
7 changes: 0 additions & 7 deletions packages/react-table/rollup.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions packages/react-table/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-check
import baseConfig from '../rollup.base.mjs';
import pkg from './package.json' with { type: 'json' };

export default baseConfig({
packageName: pkg.name.replace('@patternfly/', ''),
name: 'PatternFlyTable'
});
7 changes: 0 additions & 7 deletions packages/react-templates/rollup.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions packages/react-templates/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-check
import baseConfig from '../rollup.base.mjs';
import pkg from './package.json' with { type: 'json' };

export default baseConfig({
packageName: pkg.name.replace('@patternfly/', ''),
name: 'PatternFlyTemplates'
});
59 changes: 0 additions & 59 deletions packages/rollup.base.js

This file was deleted.

68 changes: 68 additions & 0 deletions packages/rollup.base.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// @ts-check
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import terser from '@rollup/plugin-terser';
import { defineConfig } from 'rollup';
import scss from 'rollup-plugin-scss';

const isProduction = process.env.IS_PRODUCTION;
let exitCode = 0;

/** @returns {import('rollup').Plugin} */
function circularFailPlugin() {
return {
name: 'circluarFailPlugin',
buildEnd() {
if (exitCode !== 0) {
process.exit(exitCode);
}
}
};
}

export default function baseConfig({ packageName, name }) {
/** @type {import('rollup').Plugin[]} */
const plugins = [
replace({
'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development')
}),
nodeResolve(),
commonjs(),
scss(),
circularFailPlugin()
];

if (isProduction) {
plugins.push(terser());
}

return defineConfig({
input: 'dist/esm/index.js',
output: {
file: `dist/umd/${packageName}${isProduction ? '.min' : ''}.js`,
format: 'umd',
inlineDynamicImports: true,
name,
globals: {
react: 'React',
'react-dom': 'ReactDOM'
}
},
external: ['react', 'react-dom'],
plugins,
onwarn(warning) {
if (warning.code === 'CIRCULAR_DEPENDENCY') {
const split = warning.message.split(':');
if (warning.message.includes('d3-interpolate')) {
// eslint-disable-next-line no-console
console.error(`\x1b[33m(!) ${split[0]}:\x1b[0m${split[1]}`);
} else {
// eslint-disable-next-line no-console
console.error(`\x1b[31m(!) ${split[0]}:\x1b[0m${split[1]}`);
exitCode = 1;
}
}
}
});
}
Loading

0 comments on commit 52a153a

Please sign in to comment.