Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(): disallow circular deps #8759

Merged
merged 4 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [next]

- ci(): disallow circular deps [#8759](https://github.com/fabricjs/fabric.js/pull/8759)
- fix(): env WebGL import cycle [#8758](https://github.com/fabricjs/fabric.js/pull/8758)
- chore(TS): remove controls from prototype. BREAKING: controls aren't shared anymore [#8753](https://github.com/fabricjs/fabric.js/pull/8753)
- chore(TS): remove object `type` from prototype [#8714](https://github.com/fabricjs/fabric.js/pull/8714)
Expand Down
17 changes: 17 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import terser from '@rollup/plugin-terser';
import ts from '@rollup/plugin-typescript';
import { babel } from '@rollup/plugin-babel';
import path from 'path';
import chalk from 'chalk';
// import dts from "rollup-plugin-dts";

const splitter = /\n|\s|,/g;
Expand All @@ -24,6 +25,20 @@ const plugins = [
}),
];

/**
* disallow circular deps
* @see https://rollupjs.org/configuration-options/#onwarn
* @param {*} warning
* @param {*} warn
*/
function onwarn(warning, warn) {
if (warning.code === 'CIRCULAR_DEPENDENCY') {
console.error(chalk.redBright(warning.message));
throw Object.assign(new Error(), warning);
}
warn(warning);
}

// https://rollupjs.org/guide/en/#configuration-files
export default [
{
Expand Down Expand Up @@ -51,6 +66,7 @@ export default [
: null,
],
plugins,
onwarn,
},
{
input: ['./index.node.ts'],
Expand All @@ -69,6 +85,7 @@ export default [
},
],
plugins,
onwarn,
external: ['jsdom', 'jsdom/lib/jsdom/living/generated/utils.js', 'canvas'],
},
];