Skip to content
This repository was archived by the owner on Mar 17, 2024. It is now read-only.

fix build script to use rollup #320

Merged
merged 1 commit into from
May 15, 2021
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: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
node_modules
lib
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"types": "lib/index.d.ts",
"scripts": {
"example": "ts-node example/example",
"build": "ts-node rollup.build",
"build": "rollup -c && prettier --write './lib/index.d.ts'",
"test": "jest",
"lint": "eslint -c .eslintrc.json --ext ts,tsx src"
},
Expand All @@ -42,12 +42,9 @@
"ts-graphviz": "^0.14.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0",
"@testing-library/jest-dom": "^5.11.8",
"@testing-library/react": "^11.2.3",
"@testing-library/react-hooks": "^4.0.0",
"@types/fs-extra": "^9.0.1",
"@types/glob": "^7.1.3",
"@types/prop-types": "^15.7.3",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
Expand All @@ -63,14 +60,13 @@
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^ 7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"fs-extra": "^9.0.1",
"glob": "^7.1.6",
"jest": "^26.6.3",
"jest-graphviz": "^0.4.0",
"prettier": "^2.2.1",
"react": "^17.0.1",
"react-test-renderer": "^17.0.1",
"rollup": "^2.36.1",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-dts": "^2.0.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
Expand Down
86 changes: 0 additions & 86 deletions rollup.build.ts

This file was deleted.

55 changes: 55 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import typescript from 'rollup-plugin-typescript2';
import del from 'rollup-plugin-delete';
import dts from 'rollup-plugin-dts';
import { terser } from 'rollup-plugin-terser';

/** @type {import('rollup').RollupOptions[]} */
const options = [
{
input: './src/index.ts',
plugins: [
typescript({
tsconfigOverride: {
compilerOptions: {
module: 'ESNext',
declaration: true,
},
},
}),
terser({
format: {
comments: false,
},
}),
],
external: ['react', 'react-dom/server', 'ts-graphviz', 'prop-types', 'react-reconciler'],
output: [
{
format: 'cjs',
file: './lib/index.js',
},
{
format: 'esm',
file: './lib/index.mjs',
},
],
},
{
input: './lib/index.d.ts',
plugins: [
del({
targets: ['lib/**/*.d.ts', '!lib/index.d.ts'],
hook: 'buildEnd',
}),
dts(),
],
output: [
{
format: 'esm',
file: './lib/index.d.ts',
},
],
},
];

export default options;
Loading