ts-graphviz 1.4.1-dev.c60d6bfba → 1.4.1-dev.d42db466f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -528,13 +528,16 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
528
528
  <table>
529
529
  <tbody>
530
530
  <tr>
531
- <td align="center"><a href="http://blog.kamiazya.tech/"><img src="https://avatars0.githubusercontent.com/u/35218186?v=4?s=100" width="100px;" alt="Yuki Yamazaki"/><br /><sub><b>Yuki Yamazaki</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Code">💻</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Tests">⚠️</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Documentation">📖</a> <a href="#ideas-kamiazya" title="Ideas, Planning, & Feedback">🤔</a></td>
532
- <td align="center"><a href="https://laysent.com"><img src="https://avatars2.githubusercontent.com/u/1191606?v=4?s=100" width="100px;" alt="LaySent"/><br /><sub><b>LaySent</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Alaysent" title="Bug reports">🐛</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=laysent" title="Tests">⚠️</a></td>
533
- <td align="center"><a href="https://github.com/elasticdotventures"><img src="https://avatars0.githubusercontent.com/u/35611074?v=4?s=100" width="100px;" alt="elasticdotventures"/><br /><sub><b>elasticdotventures</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=elasticdotventures" title="Documentation">📖</a></td>
534
- <td align="center"><a href="https://github.com/ChristianMurphy"><img src="https://avatars.githubusercontent.com/u/3107513?v=4?s=100" width="100px;" alt="Christian Murphy"/><br /><sub><b>Christian Murphy</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Code">💻</a> <a href="#ideas-ChristianMurphy" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Documentation">📖</a></td>
535
- <td align="center"><a href="https://github.com/ArtemAdamenko"><img src="https://avatars.githubusercontent.com/u/2178516?v=4?s=100" width="100px;" alt="Artem"/><br /><sub><b>Artem</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3AArtemAdamenko" title="Bug reports">🐛</a></td>
536
- <td align="center"><a href="https://github.com/fredericohpandolfo"><img src="https://avatars.githubusercontent.com/u/24229136?v=4?s=100" width="100px;" alt="fredericohpandolfo"/><br /><sub><b>fredericohpandolfo</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Afredericohpandolfo" title="Bug reports">🐛</a></td>
537
- <td align="center"><a href="https://github.com/diegoquinteiro"><img src="https://avatars.githubusercontent.com/u/1878108?v=4?s=100" width="100px;" alt="diegoquinteiro"/><br /><sub><b>diegoquinteiro</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Adiegoquinteiro" title="Bug reports">🐛</a></td>
531
+ <td align="center" valign="top" width="14.28%"><a href="http://blog.kamiazya.tech/"><img src="https://avatars0.githubusercontent.com/u/35218186?v=4?s=100" width="100px;" alt="Yuki Yamazaki"/><br /><sub><b>Yuki Yamazaki</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Code">💻</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Tests">⚠️</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Documentation">📖</a> <a href="#ideas-kamiazya" title="Ideas, Planning, & Feedback">🤔</a></td>
532
+ <td align="center" valign="top" width="14.28%"><a href="https://laysent.com"><img src="https://avatars2.githubusercontent.com/u/1191606?v=4?s=100" width="100px;" alt="LaySent"/><br /><sub><b>LaySent</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Alaysent" title="Bug reports">🐛</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=laysent" title="Tests">⚠️</a></td>
533
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/elasticdotventures"><img src="https://avatars0.githubusercontent.com/u/35611074?v=4?s=100" width="100px;" alt="elasticdotventures"/><br /><sub><b>elasticdotventures</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=elasticdotventures" title="Documentation">📖</a></td>
534
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/ChristianMurphy"><img src="https://avatars.githubusercontent.com/u/3107513?v=4?s=100" width="100px;" alt="Christian Murphy"/><br /><sub><b>Christian Murphy</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Code">💻</a> <a href="#ideas-ChristianMurphy" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Documentation">📖</a></td>
535
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/ArtemAdamenko"><img src="https://avatars.githubusercontent.com/u/2178516?v=4?s=100" width="100px;" alt="Artem"/><br /><sub><b>Artem</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3AArtemAdamenko" title="Bug reports">🐛</a></td>
536
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/fredericohpandolfo"><img src="https://avatars.githubusercontent.com/u/24229136?v=4?s=100" width="100px;" alt="fredericohpandolfo"/><br /><sub><b>fredericohpandolfo</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Afredericohpandolfo" title="Bug reports">🐛</a></td>
537
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/diegoquinteiro"><img src="https://avatars.githubusercontent.com/u/1878108?v=4?s=100" width="100px;" alt="diegoquinteiro"/><br /><sub><b>diegoquinteiro</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Adiegoquinteiro" title="Bug reports">🐛</a></td>
538
+ </tr>
539
+ <tr>
540
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/robross0606"><img src="https://avatars.githubusercontent.com/u/2965467?v=4?s=100" width="100px;" alt="robross0606"/><br /><sub><b>robross0606</b></sub></a><br /><a href="#ideas-robross0606" title="Ideas, Planning, & Feedback">🤔</a></td>
538
541
  </tr>
539
542
  </tbody>
540
543
  </table>
@@ -1,17 +1,13 @@
1
- export type Format = 'png' | 'svg' | 'json' | 'jpg' | 'pdf' | 'xdot' | 'plain' | 'dot_json';
2
-
3
- export interface Options {
4
- format?: Format;
5
- suppressWarnings?: boolean;
6
- dotCommand?: string;
7
- }
1
+ import { Options, Format, Layout } from '../types/index.d.ts';
8
2
 
9
3
  /**
10
4
  * Execute the Graphviz dot command and make a Stream of the results.
11
5
  */
12
- export function toStream(dot: string, options?: Options): Promise<ReadableStream<Uint8Array>>;
6
+ export function toStream<T extends Layout>(dot: string, options?: Options<T>): Promise<ReadableStream<Uint8Array>>;
13
7
 
14
8
  /**
15
9
  * Execute the Graphviz dot command and output the results to a file.
16
10
  */
17
- export function toFile(dot: string, path: string, options?: Options): Promise<void>;
11
+ export function toFile<T extends Layout>(dot: string, path: string, options?: Options<T>): Promise<void>;
12
+
13
+ export { Options, Format, Layout };
@@ -1,13 +1,4 @@
1
- function commandBuilder({ dotCommand = 'dot', suppressWarnings = true, format = 'svg' } = {}) {
2
- const args = [
3
- ...(function* () {
4
- if (suppressWarnings) yield '-q';
5
- yield `-T${format}`;
6
- })(),
7
- ];
8
- return [dotCommand, args];
9
- }
10
-
1
+ import { commandBuilder } from '../utils/index.js';
11
2
  /**
12
3
  * Execute the Graphviz dot command and make a Stream of the results.
13
4
  */
@@ -2,39 +2,49 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var node_fs = require('node:fs');
6
5
  var node_stream = require('node:stream');
7
- var node_util = require('node:util');
8
6
  var node_child_process = require('node:child_process');
7
+ var index_js = require('../utils/index.cjs');
8
+ var node_util = require('node:util');
9
+ var node_fs = require('node:fs');
9
10
 
10
- /**
11
- * @module ts-graphviz/adapter
12
- * @beta
13
- */
14
- function commandBuilder({ dotCommand = 'dot', suppressWarnings = true, format = 'svg' } = {}) {
15
- const args = [
16
- ...(function* () {
17
- if (suppressWarnings) yield '-q';
18
- yield `-T${format}`;
19
- })(),
20
- ];
21
- return [dotCommand, args];
22
- }
23
11
  /**
24
12
  * NOTE:
25
13
  * The node:stream/promises standard module is not provided in Node 14.
26
14
  * Fix Node 14 to use node:stream/promises after LTS ends.
27
15
  */
28
16
  const pipeline = node_util.promisify(node_stream.pipeline);
17
+
29
18
  /**
30
19
  * Execute the Graphviz dot command and make a Stream of the results.
31
20
  */
32
21
  async function toStream(dot, options) {
33
- const [command, args] = commandBuilder(options);
34
- const p = node_child_process.spawn(command, args, { stdio: 'pipe' });
35
- await pipeline(node_stream.Readable.from([dot]), p.stdin);
36
- return p.stdout;
22
+ const [command, args] = index_js.commandBuilder(options ?? {});
23
+ return new Promise(async function toStreamInternal(resolve, reject) {
24
+ const p = node_child_process.spawn(command, args, { stdio: 'pipe' });
25
+ // error handling
26
+ p.on('error', (e) => {
27
+ reject(
28
+ new Error(`Command "${command}" failed.\nMESSAGE:${e.message}`, {
29
+ cause: e,
30
+ }),
31
+ );
32
+ });
33
+ const stderrChunks = [];
34
+ p.stderr.on('data', (chunk) => stderrChunks.push(chunk));
35
+ const dist = p.stdout.pipe(new node_stream.PassThrough());
36
+ p.on('close', async (code, signal) => {
37
+ if (code === 0) {
38
+ resolve(dist);
39
+ } else {
40
+ const message = Buffer.concat(stderrChunks).toString();
41
+ reject(new Error(`Command "${command}" failed.\nCODE: ${code}\nSIGNAL: ${signal}\nMESSAGE: ${message}`));
42
+ }
43
+ });
44
+ await pipeline(node_stream.Readable.from([dot]), p.stdin);
45
+ });
37
46
  }
47
+
38
48
  /**
39
49
  * Execute the Graphviz dot command and output the results to a file.
40
50
  */
@@ -1,17 +1,15 @@
1
1
  /// <reference types="node" />
2
- type Format = 'png' | 'svg' | 'json' | 'jpg' | 'pdf' | 'xdot' | 'plain' | 'dot_json';
3
- interface Options {
4
- format?: Format;
5
- suppressWarnings?: boolean;
6
- dotCommand?: string;
7
- }
2
+ import { Layout, Options } from '../types/index.js';
3
+ export { Format, Options } from '../types/index.js';
4
+
8
5
  /**
9
6
  * Execute the Graphviz dot command and make a Stream of the results.
10
7
  */
11
- declare function toStream(dot: string, options?: Options): Promise<NodeJS.ReadableStream>;
8
+ declare function toStream<T extends Layout>(dot: string, options?: Options<T>): Promise<NodeJS.ReadableStream>;
9
+
12
10
  /**
13
11
  * Execute the Graphviz dot command and output the results to a file.
14
12
  */
15
- declare function toFile(dot: string, path: string, options?: Options): Promise<void>;
13
+ declare function toFile<T extends Layout>(dot: string, path: string, options?: Options<T>): Promise<void>;
16
14
 
17
- export { Format, Options, toFile, toStream };
15
+ export { toFile, toStream };
@@ -1,36 +1,46 @@
1
- import { createWriteStream } from 'node:fs';
2
- import { pipeline as pipeline$1, Readable } from 'node:stream';
3
- import { promisify } from 'node:util';
1
+ import { pipeline as pipeline$1, PassThrough, Readable } from 'node:stream';
4
2
  import { spawn } from 'node:child_process';
3
+ import { commandBuilder } from '../utils/index.js';
4
+ import { promisify } from 'node:util';
5
+ import { createWriteStream } from 'node:fs';
5
6
 
6
- /**
7
- * @module ts-graphviz/adapter
8
- * @beta
9
- */
10
- function commandBuilder({ dotCommand = 'dot', suppressWarnings = true, format = 'svg' } = {}) {
11
- const args = [
12
- ...(function* () {
13
- if (suppressWarnings) yield '-q';
14
- yield `-T${format}`;
15
- })(),
16
- ];
17
- return [dotCommand, args];
18
- }
19
7
  /**
20
8
  * NOTE:
21
9
  * The node:stream/promises standard module is not provided in Node 14.
22
10
  * Fix Node 14 to use node:stream/promises after LTS ends.
23
11
  */
24
12
  const pipeline = promisify(pipeline$1);
13
+
25
14
  /**
26
15
  * Execute the Graphviz dot command and make a Stream of the results.
27
16
  */
28
17
  async function toStream(dot, options) {
29
- const [command, args] = commandBuilder(options);
30
- const p = spawn(command, args, { stdio: 'pipe' });
31
- await pipeline(Readable.from([dot]), p.stdin);
32
- return p.stdout;
18
+ const [command, args] = commandBuilder(options ?? {});
19
+ return new Promise(async function toStreamInternal(resolve, reject) {
20
+ const p = spawn(command, args, { stdio: 'pipe' });
21
+ // error handling
22
+ p.on('error', (e) => {
23
+ reject(
24
+ new Error(`Command "${command}" failed.\nMESSAGE:${e.message}`, {
25
+ cause: e,
26
+ }),
27
+ );
28
+ });
29
+ const stderrChunks = [];
30
+ p.stderr.on('data', (chunk) => stderrChunks.push(chunk));
31
+ const dist = p.stdout.pipe(new PassThrough());
32
+ p.on('close', async (code, signal) => {
33
+ if (code === 0) {
34
+ resolve(dist);
35
+ } else {
36
+ const message = Buffer.concat(stderrChunks).toString();
37
+ reject(new Error(`Command "${command}" failed.\nCODE: ${code}\nSIGNAL: ${signal}\nMESSAGE: ${message}`));
38
+ }
39
+ });
40
+ await pipeline(Readable.from([dot]), p.stdin);
41
+ });
33
42
  }
43
+
34
44
  /**
35
45
  * Execute the Graphviz dot command and output the results to a file.
36
46
  */
@@ -0,0 +1 @@
1
+ 'use strict';
@@ -0,0 +1,107 @@
1
+ import {
2
+ EdgeAttributesObject,
3
+ NodeAttributesObject,
4
+ GraphAttributesObject,
5
+ SubgraphAttributesObject,
6
+ } from '../../common/index.js';
7
+
8
+ type Format = 'png' | 'svg' | 'json' | 'jpg' | 'pdf' | 'xdot' | 'dot' | 'plain' | 'dot_json';
9
+ type Layout = 'dot' | 'neato' | 'fdp' | 'sfdp' | 'circo' | 'twopi' | 'nop' | 'nop2' | 'osage' | 'patchwork';
10
+ interface NeatoOptions {
11
+ layout: 'neato';
12
+ /**
13
+ * Sets no-op flag in neato.
14
+ */
15
+ noop?: number;
16
+ /**
17
+ * Reduce graph.
18
+ */
19
+ reduce?: boolean;
20
+ }
21
+ interface FdpOptions {
22
+ layout: 'fdp';
23
+ /**
24
+ * Use grid.
25
+ *
26
+ * @default true
27
+ */
28
+ grid?: boolean;
29
+ /**
30
+ * Use old attractive force
31
+ *
32
+ * @default true
33
+ */
34
+ oldAttractive?: boolean;
35
+ /**
36
+ * Set number of iterations.
37
+ */
38
+ iterations?: number;
39
+ /**
40
+ * Set unscaled factor
41
+ */
42
+ unscaledFactor?: number;
43
+ /**
44
+ * Set overlap expansion factor.
45
+ */
46
+ overlapExpansionFactor?: number;
47
+ /**
48
+ * Set temperature.
49
+ */
50
+ temperature?: number;
51
+ }
52
+ interface OtherOptions {
53
+ /**
54
+ * Set layout engine.
55
+ *
56
+ * @default 'dot'
57
+ */
58
+ layout?: Exclude<Layout, 'neato' | 'fdp'>;
59
+ }
60
+ interface CommonOptions {
61
+ /**
62
+ * Set output format.
63
+ *
64
+ * @default 'svg'
65
+ */
66
+ format?: Format;
67
+ /**
68
+ * If true, set level of message suppression (=1).
69
+ *
70
+ * @default true
71
+ */
72
+ suppressWarnings?: boolean;
73
+ /**
74
+ * Path of graphviz dot command.
75
+ */
76
+ dotCommand?: string;
77
+ attributes?: {
78
+ /**
79
+ * Set edge attribute.
80
+ */
81
+ edge?: EdgeAttributesObject;
82
+ /**
83
+ * Set node attribute.
84
+ */
85
+ node?: NodeAttributesObject;
86
+ /**
87
+ * Set graph attribute.
88
+ */
89
+ graph?: GraphAttributesObject & SubgraphAttributesObject;
90
+ };
91
+ /**
92
+ * Scale input
93
+ */
94
+ scale?: number;
95
+ /**
96
+ * Use external library.
97
+ */
98
+ library?: string[];
99
+ /**
100
+ * Invert y coordinate in output.
101
+ */
102
+ y?: boolean;
103
+ }
104
+ type Options<T extends Layout = Layout> = CommonOptions &
105
+ (T extends 'neato' ? NeatoOptions : T extends 'fdp' ? FdpOptions : OtherOptions);
106
+
107
+ export { CommonOptions, FdpOptions, Format, Layout, NeatoOptions, Options, OtherOptions };
File without changes
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function* args(options) {
6
+ const { suppressWarnings = true, format = 'svg', attributes = {}, library = [], y = false, scale } = options;
7
+ if (suppressWarnings) yield '-q';
8
+ yield `-T${format}`;
9
+ if (attributes.graph) {
10
+ for (const [key, value] of Object.entries(attributes.graph)) {
11
+ if (value === true) yield `-G${key}`;
12
+ else yield `-G${key}="${value}"`;
13
+ }
14
+ }
15
+ if (attributes.node) {
16
+ for (const [key, value] of Object.entries(attributes.node)) {
17
+ if (value === true) yield `-N${key}`;
18
+ else yield `-N${key}="${value}"`;
19
+ }
20
+ }
21
+ if (attributes.edge) {
22
+ for (const [key, value] of Object.entries(attributes.edge)) {
23
+ if (value === true) yield `-E${key}`;
24
+ else yield `-E${key}="${value}"`;
25
+ }
26
+ }
27
+ if (typeof scale === 'number' && !Number.isNaN(scale)) yield `-s${scale}`;
28
+ if (Array.isArray(library)) for (const lib of library) yield `-l${lib}`;
29
+ if (y === true) yield `-y`;
30
+ if (typeof options.layout === 'string') {
31
+ yield `-K${options.layout}`;
32
+ switch (options.layout) {
33
+ case 'neato':
34
+ const { reduce, noop } = options;
35
+ if (reduce === true) yield '-x';
36
+ if (typeof noop === 'number') yield `-n${noop}`;
37
+ break;
38
+ case 'fdp':
39
+ const { grid, oldAttractive, iterations, unscaledFactor, overlapExpansionFactor, temperature } = options;
40
+ yield ['-L', grid ? '' : 'g', oldAttractive ? 'O' : ''].join('');
41
+ if (typeof iterations === 'number') yield `-Ln${iterations}`;
42
+ if (typeof unscaledFactor === 'number') yield `-LU${unscaledFactor}`;
43
+ if (typeof overlapExpansionFactor === 'number') yield `-LC${overlapExpansionFactor}`;
44
+ if (typeof temperature === 'number') yield `-LT${temperature}`;
45
+ }
46
+ }
47
+ }
48
+ function commandBuilder(options) {
49
+ return [options.dotCommand ?? 'dot', Array.from(args(options))];
50
+ }
51
+
52
+ exports.commandBuilder = commandBuilder;
@@ -0,0 +1,5 @@
1
+ import { Layout, Options } from '../types/index.js';
2
+
3
+ declare function commandBuilder<T extends Layout>(options: Options<T>): [command: string, args: string[]];
4
+
5
+ export { commandBuilder };
@@ -0,0 +1,48 @@
1
+ function* args(options) {
2
+ const { suppressWarnings = true, format = 'svg', attributes = {}, library = [], y = false, scale } = options;
3
+ if (suppressWarnings) yield '-q';
4
+ yield `-T${format}`;
5
+ if (attributes.graph) {
6
+ for (const [key, value] of Object.entries(attributes.graph)) {
7
+ if (value === true) yield `-G${key}`;
8
+ else yield `-G${key}="${value}"`;
9
+ }
10
+ }
11
+ if (attributes.node) {
12
+ for (const [key, value] of Object.entries(attributes.node)) {
13
+ if (value === true) yield `-N${key}`;
14
+ else yield `-N${key}="${value}"`;
15
+ }
16
+ }
17
+ if (attributes.edge) {
18
+ for (const [key, value] of Object.entries(attributes.edge)) {
19
+ if (value === true) yield `-E${key}`;
20
+ else yield `-E${key}="${value}"`;
21
+ }
22
+ }
23
+ if (typeof scale === 'number' && !Number.isNaN(scale)) yield `-s${scale}`;
24
+ if (Array.isArray(library)) for (const lib of library) yield `-l${lib}`;
25
+ if (y === true) yield `-y`;
26
+ if (typeof options.layout === 'string') {
27
+ yield `-K${options.layout}`;
28
+ switch (options.layout) {
29
+ case 'neato':
30
+ const { reduce, noop } = options;
31
+ if (reduce === true) yield '-x';
32
+ if (typeof noop === 'number') yield `-n${noop}`;
33
+ break;
34
+ case 'fdp':
35
+ const { grid, oldAttractive, iterations, unscaledFactor, overlapExpansionFactor, temperature } = options;
36
+ yield ['-L', grid ? '' : 'g', oldAttractive ? 'O' : ''].join('');
37
+ if (typeof iterations === 'number') yield `-Ln${iterations}`;
38
+ if (typeof unscaledFactor === 'number') yield `-LU${unscaledFactor}`;
39
+ if (typeof overlapExpansionFactor === 'number') yield `-LC${overlapExpansionFactor}`;
40
+ if (typeof temperature === 'number') yield `-LT${temperature}`;
41
+ }
42
+ }
43
+ }
44
+ function commandBuilder(options) {
45
+ return [options.dotCommand ?? 'dot', Array.from(args(options))];
46
+ }
47
+
48
+ export { commandBuilder };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-graphviz",
3
- "version": "1.4.1-dev.c60d6bfba",
3
+ "version": "1.4.1-dev.d42db466f",
4
4
  "author": "kamiazya <yuki@kamiazya.tech>",
5
5
  "description": "Graphviz library for TypeScript.",
6
6
  "homepage": "https://ts-graphviz.github.io/ts-graphviz/",
@@ -84,10 +84,10 @@
84
84
  "scripts": {
85
85
  "build:peggy": "peggy --plugin ts-pegjs --extra-options-file src/ast/dot-shim/parser/peggy.options.json -o src/ast/dot-shim/parser/_parse.ts src/ast/dot-shim/parser/dot.peggy",
86
86
  "prebuild": "yarn build:peggy",
87
- "build:deno": "cp -r src/adapter/deno lib/adapter/deno",
87
+ "build:deno": "mkdir -p lib/adapter/deno && cp -r src/adapter/deno/* lib/adapter/deno && sed -i \"s/index.ts/index.js/g\" lib/adapter/deno/mod.js && sed -i \"s/index.ts/index.d.ts/g\" lib/adapter/deno/mod.d.ts",
88
88
  "build:node": "tsc -p tsconfig.build.json && rollup -c",
89
89
  "build": "yarn build:node && yarn build:deno",
90
- "postbuild": "prettier --write ./lib/**/index.{js,cjs,d.ts}",
90
+ "postbuild": "prettier --write ./lib/**/*.{js,cjs,d.ts}",
91
91
  "pretest": "yarn build:peggy",
92
92
  "test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
93
93
  "format": "eslint --ext ts src --fix && prettier --write './**/*.{ts,js,json,yaml}' '!lib'",