@nodepit/svg-to-img 2.1.0 → 3.0.0
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/.github/workflows/main.yml +46 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +4 -0
- package/README.md +10 -10
- package/changelog.md +28 -0
- package/dist/constants.js +1 -0
- package/dist/helpers.d.ts +10 -10
- package/dist/helpers.js +10 -4
- package/dist/index.d.ts +3 -2
- package/dist/index.js +37 -30
- package/package.json +25 -29
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
10
|
+
- uses: actions/checkout@v2
|
|
11
|
+
|
|
12
|
+
- name: Setup Node.js environment
|
|
13
|
+
uses: actions/setup-node@v2
|
|
14
|
+
with:
|
|
15
|
+
# Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0
|
|
16
|
+
node-version: ">=8.9.4"
|
|
17
|
+
|
|
18
|
+
# copy/paste from https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action
|
|
19
|
+
- name: Cache node_modules
|
|
20
|
+
uses: actions/cache@v2
|
|
21
|
+
env:
|
|
22
|
+
cache-name: cache-node-modules
|
|
23
|
+
with:
|
|
24
|
+
path: ~/.npm
|
|
25
|
+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
26
|
+
restore-keys: |
|
|
27
|
+
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
28
|
+
${{ runner.os }}-build-
|
|
29
|
+
${{ runner.os }}-
|
|
30
|
+
|
|
31
|
+
- name: Install node dependencies
|
|
32
|
+
run: npm prune && npm install
|
|
33
|
+
|
|
34
|
+
- name: Install puppeteer dependencies
|
|
35
|
+
run: sudo apt-get update && sudo apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
|
|
36
|
+
|
|
37
|
+
- name: Build project
|
|
38
|
+
run: npm run build
|
|
39
|
+
|
|
40
|
+
- name: Run tests
|
|
41
|
+
run: npm run test -- --forceExit
|
|
42
|
+
|
|
43
|
+
- uses: codecov/codecov-action@v1
|
|
44
|
+
with:
|
|
45
|
+
file: ./coverage/coverage-final.json
|
|
46
|
+
fail_ci_if_error: true
|
package/.husky/pre-push
ADDED
package/README.md
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
#### A node.js library to convert SVGs to images built with [Puppeteer](https://github.com/GoogleChrome/puppeteer).
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[](https://coveralls.io/github/etienne-martin/svg-to-img) -->
|
|
9
|
+
<!-- [](https://circleci.com/gh/etienne-martin/svg-to-img) -->
|
|
10
|
+
[](https://www.npmjs.com/package/%40nodepit%2Fsvg-to-img)
|
|
11
|
+
[](https://www.npmjs.com/package/%40nodepit%2Fsvg-to-img)
|
|
12
|
+
[](https://www.npmjs.com/package/%40nodepit%2Fsvg-to-img)
|
|
11
13
|
|
|
12
14
|
## Getting Started
|
|
13
15
|
|
|
@@ -16,10 +18,10 @@
|
|
|
16
18
|
To use svg-to-img in your project, run:
|
|
17
19
|
|
|
18
20
|
```bash
|
|
19
|
-
npm install svg-to-img -S
|
|
21
|
+
npm install @nodepit/svg-to-img -S
|
|
20
22
|
```
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
Starting from v3.0.0, Chromium will **no longer** automatically be downloaded when installing this dependency (instead of depending on `puppetteer`, the library now depends on `puppeteer-core`; see [here](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#puppeteer-vs-puppeteer-core)). We assume that you either have an existing local or remote Chromium, or that you explicitly install `puppeteer` within your project to to have Chromium downloaded.
|
|
23
25
|
|
|
24
26
|
#### Debian
|
|
25
27
|
|
|
@@ -38,8 +40,6 @@ apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups
|
|
|
38
40
|
|
|
39
41
|
### Usage
|
|
40
42
|
|
|
41
|
-
Caution: svg-to-img uses async/await which is only supported in Node v7.6.0 or greater.
|
|
42
|
-
|
|
43
43
|
**Example** - converting a `svg` to `png`:
|
|
44
44
|
|
|
45
45
|
```javascript
|
|
@@ -116,7 +116,7 @@ const convert = svgToImg.connect({
|
|
|
116
116
|
The method returns a svg instance based on the given argument.
|
|
117
117
|
|
|
118
118
|
### svgToImg.connect(options)
|
|
119
|
-
- `options` <[Object]>
|
|
119
|
+
- `options` <[Object]> Puppeteer [connect options](https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteerconnectoptions) object which will typically contain a `browserWSEndpoint` property.
|
|
120
120
|
- returns: <[SvgToImg]> an instance which is connected with the specified Puppeteer endpoint.
|
|
121
121
|
|
|
122
122
|
Use this method if you want to connect to a running Puppeteer endpoint (see [here](https://github.com/etienne-martin/svg-to-img/issues/9)). Note that the actual connection is established lazily; this means this method will always return, even when the given `browserWSEndpoint` cannot be reached -- in this case, errors will be thrown later when calling one of the `to` functions.
|
package/changelog.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [3.0.0] – 2022-04-30
|
|
9
|
+
### Changed
|
|
10
|
+
* Set up GitHub CI
|
|
11
|
+
* Upgrade development dependencies (Typescript, ESLint, etc.) and related fixes
|
|
12
|
+
* (breaking) Depend on [`puppeteer-core`](https://github.com/puppeteer/puppeteer#puppeteer-core) to avoid Chromium download. If you rely on the included Chromium, simply add a dependency to `puppeteer@2.0.0` to your project
|
|
13
|
+
* Upgrade to latest Puppeteer library (v13.7.0)
|
|
14
|
+
|
|
15
|
+
### Breaking
|
|
16
|
+
* Require at least Node version 10.18.1
|
|
17
|
+
|
|
18
|
+
## [2.2.0] – 2020-12-14
|
|
19
|
+
### Added
|
|
20
|
+
* Export TS interfaces `IOptions`, `IShorthandOptions`, and `IConnectOptions`
|
|
21
|
+
|
|
22
|
+
## [2.1.1] – 2020-04-15
|
|
23
|
+
### Fixed
|
|
24
|
+
* Update README.md to reflect fork
|
|
25
|
+
|
|
26
|
+
## [2.1.0] – 2020-04-15
|
|
27
|
+
### Added
|
|
28
|
+
* Forked from Etienne Martin’s <a href="https://github.com/etienne-martin/svg-to-img">svg-to-img</a> and added possibility to connect to a Puppeteer endpoint (see <a href="https://github.com/etienne-martin/svg-to-img/pull/19">here</a>)
|
package/dist/constants.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultWebpShorthandOptions = exports.defaultJpegShorthandOptions = exports.defaultPngShorthandOptions = exports.defaultOptions = exports.config = void 0;
|
|
3
4
|
exports.config = {
|
|
4
5
|
supportedImageTypes: ["jpeg", "png", "webp"],
|
|
5
6
|
jpegBackground: "#fff",
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { IBoundingBox } from "./typings";
|
|
2
|
+
import { IBoundingBox, IOptions } from "./typings";
|
|
3
3
|
export declare const getFileTypeFromPath: (path: string) => string;
|
|
4
|
-
export declare const stringifyFunction: (func:
|
|
5
|
-
export declare const writeFileAsync: (path: string, data: Buffer) => Promise<
|
|
4
|
+
export declare const stringifyFunction: (func: Function, ...argsArray: (string | object | number)[]) => string;
|
|
5
|
+
export declare const writeFileAsync: (path: string, data: Buffer) => Promise<void>;
|
|
6
6
|
export declare const renderSvg: (svg: string, options: {
|
|
7
|
-
width?:
|
|
8
|
-
height?:
|
|
9
|
-
type: "
|
|
10
|
-
quality:
|
|
11
|
-
background?:
|
|
12
|
-
clip?: IBoundingBox
|
|
7
|
+
width?: IOptions["width"];
|
|
8
|
+
height?: IOptions["height"];
|
|
9
|
+
type: IOptions["type"];
|
|
10
|
+
quality: IOptions["quality"];
|
|
11
|
+
background?: IOptions["background"];
|
|
12
|
+
clip?: IBoundingBox;
|
|
13
13
|
jpegBackground: string;
|
|
14
|
-
}) => Promise<
|
|
14
|
+
}) => Promise<unknown>;
|
package/dist/helpers.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderSvg = exports.writeFileAsync = exports.stringifyFunction = exports.getFileTypeFromPath = void 0;
|
|
3
4
|
const fs = require("fs");
|
|
4
|
-
|
|
5
|
+
const getFileTypeFromPath = (path) => {
|
|
5
6
|
return path.toLowerCase().replace(new RegExp("jpg", "g"), "jpeg").split(".").reverse()[0];
|
|
6
7
|
};
|
|
7
|
-
exports.
|
|
8
|
+
exports.getFileTypeFromPath = getFileTypeFromPath;
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
10
|
+
const stringifyFunction = (func, ...argsArray) => {
|
|
8
11
|
// Remove istanbul coverage instruments
|
|
9
12
|
const functionString = func.toString().replace(/cov_(.+?)\+\+[,;]?/g, "");
|
|
10
13
|
const args = [];
|
|
@@ -22,7 +25,8 @@ exports.stringifyFunction = (func, ...argsArray) => {
|
|
|
22
25
|
}
|
|
23
26
|
return `(${functionString})(${args.join(",")})`;
|
|
24
27
|
};
|
|
25
|
-
exports.
|
|
28
|
+
exports.stringifyFunction = stringifyFunction;
|
|
29
|
+
const writeFileAsync = async (path, data) => {
|
|
26
30
|
return new Promise((resolve, reject) => {
|
|
27
31
|
fs.writeFile(path, data, (err) => {
|
|
28
32
|
if (err) {
|
|
@@ -32,7 +36,8 @@ exports.writeFileAsync = async (path, data) => {
|
|
|
32
36
|
});
|
|
33
37
|
});
|
|
34
38
|
};
|
|
35
|
-
exports.
|
|
39
|
+
exports.writeFileAsync = writeFileAsync;
|
|
40
|
+
const renderSvg = async (svg, options) => {
|
|
36
41
|
return new Promise((resolve, reject) => {
|
|
37
42
|
const canvas = document.createElement("canvas");
|
|
38
43
|
const ctx = canvas.getContext("2d");
|
|
@@ -104,3 +109,4 @@ exports.renderSvg = async (svg, options) => {
|
|
|
104
109
|
img.src = "data:image/svg+xml;base64," + base64Svg;
|
|
105
110
|
});
|
|
106
111
|
};
|
|
112
|
+
exports.renderSvg = renderSvg;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import * as puppeteer from "puppeteer";
|
|
2
|
+
import * as puppeteer from "puppeteer-core";
|
|
3
3
|
import { IOptions, IShorthandOptions, IConnectOptions } from "./typings";
|
|
4
4
|
export declare class BrowserSource {
|
|
5
5
|
private readonly factory;
|
|
@@ -27,5 +27,6 @@ export declare class SvgToImg {
|
|
|
27
27
|
constructor(browserSource: BrowserSource);
|
|
28
28
|
from(svg: Buffer | string): Svg;
|
|
29
29
|
}
|
|
30
|
-
export declare const from: (svg:
|
|
30
|
+
export declare const from: (svg: Buffer | string) => Svg;
|
|
31
31
|
export declare const connect: (options: IConnectOptions) => SvgToImg;
|
|
32
|
+
export { IOptions, IShorthandOptions, IConnectOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.connect = exports.from = exports.SvgToImg = exports.Svg = exports.BrowserSource = void 0;
|
|
4
|
+
const puppeteer = require("puppeteer-core");
|
|
4
5
|
const helpers_1 = require("./helpers");
|
|
5
6
|
const constants_1 = require("./constants");
|
|
6
7
|
class BrowserSource {
|
|
@@ -10,7 +11,7 @@ class BrowserSource {
|
|
|
10
11
|
this.browserState = "closed";
|
|
11
12
|
}
|
|
12
13
|
async getBrowser() {
|
|
13
|
-
return new Promise(
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
14
15
|
/* istanbul ignore if */
|
|
15
16
|
if (this.browserDestructionTimeout) {
|
|
16
17
|
clearTimeout(this.browserDestructionTimeout);
|
|
@@ -20,15 +21,17 @@ class BrowserSource {
|
|
|
20
21
|
// Browser is closed
|
|
21
22
|
this.queue.push(resolve);
|
|
22
23
|
this.browserState = "opening";
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
this.factory()
|
|
25
|
+
.then((browserInstance) => {
|
|
26
|
+
this.browserInstance = browserInstance;
|
|
25
27
|
this.browserState = "open";
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
28
|
+
this.executeQueuedRequests(this.browserInstance);
|
|
29
|
+
})
|
|
30
|
+
.catch((error) => {
|
|
29
31
|
this.browserState = "closed";
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
+
reject(error);
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
32
35
|
}
|
|
33
36
|
/* istanbul ignore next */
|
|
34
37
|
if (this.browserState === "opening") {
|
|
@@ -44,13 +47,12 @@ class BrowserSource {
|
|
|
44
47
|
}
|
|
45
48
|
});
|
|
46
49
|
}
|
|
47
|
-
;
|
|
48
50
|
scheduleBrowserForDestruction() {
|
|
49
51
|
/* istanbul ignore if */
|
|
50
52
|
if (this.browserDestructionTimeout) {
|
|
51
53
|
clearTimeout(this.browserDestructionTimeout);
|
|
52
54
|
}
|
|
53
|
-
this.browserDestructionTimeout = setTimeout(async () => {
|
|
55
|
+
this.browserDestructionTimeout = global.setTimeout(async () => {
|
|
54
56
|
/* istanbul ignore next */
|
|
55
57
|
if (this.browserInstance) {
|
|
56
58
|
this.browserState = "closed";
|
|
@@ -58,7 +60,6 @@ class BrowserSource {
|
|
|
58
60
|
}
|
|
59
61
|
}, 500);
|
|
60
62
|
}
|
|
61
|
-
;
|
|
62
63
|
executeQueuedRequests(browser) {
|
|
63
64
|
for (const resolve of this.queue) {
|
|
64
65
|
resolve(browser);
|
|
@@ -66,10 +67,8 @@ class BrowserSource {
|
|
|
66
67
|
// Clear items from the queue
|
|
67
68
|
this.queue.length = 0;
|
|
68
69
|
}
|
|
69
|
-
;
|
|
70
70
|
}
|
|
71
71
|
exports.BrowserSource = BrowserSource;
|
|
72
|
-
;
|
|
73
72
|
class Svg {
|
|
74
73
|
constructor(svg, browserSource) {
|
|
75
74
|
this.svg = svg;
|
|
@@ -78,34 +77,30 @@ class Svg {
|
|
|
78
77
|
async to(options) {
|
|
79
78
|
return this.convertSvg(this.svg, options, this.browserSource);
|
|
80
79
|
}
|
|
81
|
-
;
|
|
82
80
|
async toPng(options) {
|
|
83
|
-
return this.convertSvg(this.svg,
|
|
81
|
+
return this.convertSvg(this.svg, { ...constants_1.defaultPngShorthandOptions, ...options }, this.browserSource);
|
|
84
82
|
}
|
|
85
|
-
;
|
|
86
83
|
async toJpeg(options) {
|
|
87
|
-
return this.convertSvg(this.svg,
|
|
84
|
+
return this.convertSvg(this.svg, { ...constants_1.defaultJpegShorthandOptions, ...options }, this.browserSource);
|
|
88
85
|
}
|
|
89
|
-
;
|
|
90
86
|
async toWebp(options) {
|
|
91
|
-
return this.convertSvg(this.svg,
|
|
87
|
+
return this.convertSvg(this.svg, { ...constants_1.defaultWebpShorthandOptions, ...options }, this.browserSource);
|
|
92
88
|
}
|
|
93
|
-
;
|
|
94
89
|
async convertSvg(inputSvg, passedOptions, browserSource) {
|
|
95
90
|
const svg = Buffer.isBuffer(inputSvg) ? inputSvg.toString("utf8") : inputSvg;
|
|
96
|
-
const options =
|
|
91
|
+
const options = { ...constants_1.defaultOptions, ...passedOptions };
|
|
97
92
|
const browser = await browserSource.getBrowser();
|
|
98
93
|
const page = (await browser.pages())[0];
|
|
99
94
|
// ⚠️ Offline mode is enabled to prevent any HTTP requests over the network
|
|
100
95
|
await page.setOfflineMode(true);
|
|
101
96
|
// Infer the file type from the file path if no type is provided
|
|
102
97
|
if (!passedOptions.type && options.path) {
|
|
103
|
-
const fileType = helpers_1.getFileTypeFromPath(options.path);
|
|
98
|
+
const fileType = (0, helpers_1.getFileTypeFromPath)(options.path);
|
|
104
99
|
if (constants_1.config.supportedImageTypes.includes(fileType)) {
|
|
105
100
|
options.type = fileType;
|
|
106
101
|
}
|
|
107
102
|
}
|
|
108
|
-
const base64 = await page.evaluate(helpers_1.stringifyFunction(helpers_1.renderSvg, svg, {
|
|
103
|
+
const base64 = await page.evaluate((0, helpers_1.stringifyFunction)(helpers_1.renderSvg, svg, {
|
|
109
104
|
width: options.width,
|
|
110
105
|
height: options.height,
|
|
111
106
|
type: options.type,
|
|
@@ -117,7 +112,7 @@ class Svg {
|
|
|
117
112
|
browserSource.scheduleBrowserForDestruction();
|
|
118
113
|
const buffer = Buffer.from(base64, "base64");
|
|
119
114
|
if (options.path) {
|
|
120
|
-
await helpers_1.writeFileAsync(options.path, buffer);
|
|
115
|
+
await (0, helpers_1.writeFileAsync)(options.path, buffer);
|
|
121
116
|
}
|
|
122
117
|
if (options.encoding === "base64") {
|
|
123
118
|
return base64;
|
|
@@ -127,7 +122,6 @@ class Svg {
|
|
|
127
122
|
}
|
|
128
123
|
return buffer.toString(options.encoding);
|
|
129
124
|
}
|
|
130
|
-
;
|
|
131
125
|
}
|
|
132
126
|
exports.Svg = Svg;
|
|
133
127
|
class SvgToImg {
|
|
@@ -137,14 +131,27 @@ class SvgToImg {
|
|
|
137
131
|
from(svg) {
|
|
138
132
|
return new Svg(svg, this.browserSource);
|
|
139
133
|
}
|
|
140
|
-
;
|
|
141
134
|
}
|
|
142
135
|
exports.SvgToImg = SvgToImg;
|
|
143
|
-
const defaultBrowserSource = new BrowserSource(async () =>
|
|
144
|
-
|
|
136
|
+
const defaultBrowserSource = new BrowserSource(async () => {
|
|
137
|
+
try {
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
139
|
+
const puppeteerFull = require("puppeteer");
|
|
140
|
+
return puppeteerFull.launch(constants_1.config.puppeteer);
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
/* istanbul ignore next */
|
|
144
|
+
throw new Error("NPM module `puppeteer` is not available. Either add it as " +
|
|
145
|
+
" dependency to your project, or use the `connect` function and supply " +
|
|
146
|
+
"`browserWSEndpoint` if you want to use a running Puppeteer endpoint.");
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
const from = (svg) => {
|
|
145
150
|
return new SvgToImg(defaultBrowserSource).from(svg);
|
|
146
151
|
};
|
|
152
|
+
exports.from = from;
|
|
147
153
|
/* istanbul ignore next */
|
|
148
|
-
|
|
154
|
+
const connect = (options) => {
|
|
149
155
|
return new SvgToImg(new BrowserSource(async () => puppeteer.connect(options)));
|
|
150
156
|
};
|
|
157
|
+
exports.connect = connect;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodepit/svg-to-img",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A node.js library to convert SVGs to images built with Puppeteer.",
|
|
5
|
-
"homepage": "https://github.com/
|
|
5
|
+
"homepage": "https://github.com/NodePit/svg-to-img",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"svg",
|
|
8
8
|
"png",
|
|
@@ -23,20 +23,14 @@
|
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
25
|
"dev": "tsc --pretty --watch",
|
|
26
|
-
"lint": "
|
|
26
|
+
"lint": "eslint --fix ./src",
|
|
27
27
|
"pretest": "npm run lint",
|
|
28
28
|
"test": "jest src --coverage --verbose",
|
|
29
29
|
"test:watch": "jest src --coverage --verbose --watch",
|
|
30
30
|
"coverage": "coveralls < ./coverage/lcov.info",
|
|
31
31
|
"prebuild": "rm -rf dist/ && npm run lint",
|
|
32
32
|
"build": "tsc --pretty",
|
|
33
|
-
"prepare": "npm run build"
|
|
34
|
-
},
|
|
35
|
-
"husky": {
|
|
36
|
-
"hooks": {
|
|
37
|
-
"pre-commit": "npm run build && npm run test",
|
|
38
|
-
"pre-push": "npm run build && npm run test"
|
|
39
|
-
}
|
|
33
|
+
"prepare": "npm run build && husky install"
|
|
40
34
|
},
|
|
41
35
|
"jest": {
|
|
42
36
|
"setupFiles": [
|
|
@@ -78,33 +72,35 @@
|
|
|
78
72
|
},
|
|
79
73
|
"repository": {
|
|
80
74
|
"type": "git",
|
|
81
|
-
"url": "https://github.com/
|
|
75
|
+
"url": "https://github.com/NodePit/svg-to-img"
|
|
82
76
|
},
|
|
83
77
|
"bugs": {
|
|
84
|
-
"url": "https://github.com/
|
|
78
|
+
"url": "https://github.com/NodePit/svg-to-img/issues"
|
|
85
79
|
},
|
|
86
80
|
"engines": {
|
|
87
|
-
"node": ">=
|
|
81
|
+
"node": ">= 10.18.1"
|
|
88
82
|
},
|
|
89
83
|
"license": "MIT",
|
|
90
84
|
"devDependencies": {
|
|
91
|
-
"@types/
|
|
92
|
-
"@types/
|
|
93
|
-
"@types/
|
|
94
|
-
"@
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
85
|
+
"@types/jest": "27.4.1",
|
|
86
|
+
"@types/node": "10.17.60",
|
|
87
|
+
"@types/rimraf": "3.0.2",
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
|
89
|
+
"@typescript-eslint/parser": "^5.21.0",
|
|
90
|
+
"coveralls": "3.1.1",
|
|
91
|
+
"eslint": "^8.14.0",
|
|
92
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
93
|
+
"husky": "7.0.4",
|
|
94
|
+
"image-size": "1.0.1",
|
|
95
|
+
"jest": "27.5.1",
|
|
96
|
+
"jest-canvas-mock": "2.4.0",
|
|
97
|
+
"prettier": "2.6.2",
|
|
98
|
+
"puppeteer": "13.7.0",
|
|
99
|
+
"rimraf": "3.0.2",
|
|
100
|
+
"ts-jest": "27.1.4",
|
|
101
|
+
"typescript": "4.6.4"
|
|
106
102
|
},
|
|
107
103
|
"dependencies": {
|
|
108
|
-
"puppeteer": "
|
|
104
|
+
"puppeteer-core": "13.7.0"
|
|
109
105
|
}
|
|
110
106
|
}
|