Skip to content

Commit ef8ec9a

Browse files
authored
Merge pull request #30 from ts-graphviz/fix_build_settings
Fix build settings
2 parents 5851cc8 + c47f2d1 commit ef8ec9a

File tree

5 files changed

+1553
-423
lines changed

5 files changed

+1553
-423
lines changed

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,29 @@
1010
],
1111
"scripts": {
1212
"test": "jest",
13-
"build": "tsc",
13+
"build": "rollup -c",
1414
"lint": "tslint --project ./tsconfig.json"
1515
},
1616
"license": "MIT",
1717
"main": "dist/index.js",
18+
"module": "dist/index.mjs",
1819
"types": "dist/index.d.ts",
20+
"peerDependencies": {
21+
"jest-snapshot": ">=24"
22+
},
1923
"dependencies": {
2024
"@types/jest": "^24.0.22",
21-
"jest": "^24.9.0",
22-
"jest-snapshot": "^24.9.0"
25+
"jest": "^24.9.0"
2326
},
2427
"devDependencies": {
28+
"@rollup/plugin-node-resolve": "^7.0.0",
2529
"@kamiazya/jest-dynamic": "^0.0.1",
2630
"@types/node": "^13.1.6",
31+
"jest-snapshot": "^25.4.0",
2732
"prettier": "^1.19.1",
33+
"rollup": "^1.29.0",
34+
"rollup-plugin-node-builtins": "^2.1.2",
35+
"rollup-plugin-typescript2": "^0.25.3",
2836
"ts-jest": "^24.1.0",
2937
"tslint": "^5.20.1",
3038
"tslint-config-prettier": "^1.18.0",

rollup.config.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import builtins from 'rollup-plugin-node-builtins';
2+
import resolve from '@rollup/plugin-node-resolve';
3+
import typescript from 'rollup-plugin-typescript2';
4+
import pkg from './package.json';
5+
6+
export default {
7+
input: './src/index.ts',
8+
output: [
9+
{
10+
format: 'cjs',
11+
file: pkg.main,
12+
},
13+
{
14+
format: 'esm',
15+
file: pkg.module,
16+
},
17+
],
18+
plugins: [
19+
builtins(),
20+
resolve({
21+
preferBuiltins: true,
22+
}),
23+
typescript(),
24+
],
25+
external: [
26+
'jest-snapshot',
27+
],
28+
}

src/lib/dot-adapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { execSync } from 'child_process';
1+
import cp from 'child_process';
22

33
function execCommand(command: string, input: string): Buffer {
4-
return execSync(command, {
4+
return cp.execSync(command, {
55
stdio: 'pipe',
66
input,
77
});

tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"compilerOptions": {
33
"target": "es3",
4-
"module": "commonjs",
54
"strict": true,
65
"lib": [
76
"esnext"
@@ -17,5 +16,8 @@
1716
},
1817
"include": [
1918
"src/**/*.ts"
19+
],
20+
"exclude": [
21+
"**/__test__/**/*"
2022
]
2123
}

0 commit comments

Comments
 (0)