Skip to content

Commit

Permalink
feat: add umd output
Browse files Browse the repository at this point in the history
  • Loading branch information
NewByVector committed May 28, 2024
1 parent 1f4f181 commit 1037fc4
Show file tree
Hide file tree
Showing 3 changed files with 1,715 additions and 89 deletions.
18 changes: 15 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
],
"scripts": {
"setup": "tsup src/index.ts",
"build": "tsup src/index.ts",
"build": "tsup src/index.ts && pnpm run build:umd",
"build:umd": "rollup -c",
"dev": "tsup src/index.ts --watch",
"lint:js": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
"lint:css": "stylelint --allow-empty-input 'src/**/*.{css,less}'",
Expand All @@ -42,14 +43,25 @@
"immer": "^10.0.3",
"lucide-react": "^0.292.0",
"tippy.js": "^6.3.7",
"zustand": "^4.4.3"
"zustand": "^4.4.3",
"classnames": "^2.3.2"
},
"devDependencies": {
"@antv/config-tsconfig": "workspace:^",
"@antv/config-tsup": "workspace:^",
"@antv/testing": "workspace:^",
"@types/react": "^18.2.37",
"classnames": "^2.3.2"
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-replace": "^3.0.0",
"@rollup/plugin-typescript": "^8.2.5",
"rollup": "^2.56.3",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-filesize": "^9.1.1",
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-progress": "^1.1.2",
"rollup-plugin-terser": "^7.0.2",
"less": "^4.1.1"
},
"peerDependencies": {
"react": ">=16.8.6 || >=17.0.0 || >=18.0.0",
Expand Down
33 changes: 33 additions & 0 deletions packages/core/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import typescript from '@rollup/plugin-typescript';
import filesize from 'rollup-plugin-filesize';
import postcss from 'rollup-plugin-postcss';
import { terser } from 'rollup-plugin-terser';

export default () => {
return {
input: './src/index.ts',
plugins: [
typescript({ declaration: false }),
resolve(),
commonjs(),
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify('production'),
}),
terser(),
filesize(),
postcss(),
],
output: [
{
name: 'XFlow',
format: 'umd',
file: 'dist/index.umd.js',
sourcemap: true,
},
],
};
};
Loading

0 comments on commit 1037fc4

Please sign in to comment.