@nodepit/svg-to-img 3.0.0 → 3.1.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/changelog.md CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.1.0] – 2022-07-30
9
+ ### Changes
10
+ * Return types depending on whether a `Buffer` (no `encoding` specified) or `string` (`encoding` specified) is returned
11
+
8
12
  ## [3.0.0] – 2022-04-30
9
13
  ### Changed
10
14
  * Set up GitHub CI
package/dist/index.d.ts CHANGED
@@ -16,10 +16,14 @@ export declare class Svg {
16
16
  private readonly svg;
17
17
  private browserSource;
18
18
  constructor(svg: Buffer | string, browserSource: BrowserSource);
19
- to(options: IOptions): Promise<Buffer | string>;
20
- toPng(options?: IShorthandOptions): Promise<Buffer | string>;
21
- toJpeg(options?: IShorthandOptions): Promise<Buffer | string>;
22
- toWebp(options?: IShorthandOptions): Promise<Buffer | string>;
19
+ to(options: Omit<IOptions, "encoding">): Promise<Buffer>;
20
+ to(options: IOptions): Promise<string>;
21
+ toPng(options?: Omit<IShorthandOptions, "encoding">): Promise<Buffer>;
22
+ toPng(options?: IShorthandOptions): Promise<string>;
23
+ toJpeg(options?: Omit<IShorthandOptions, "encoding">): Promise<Buffer>;
24
+ toJpeg(options?: IShorthandOptions): Promise<string>;
25
+ toWebp(options?: Omit<IShorthandOptions, "encoding">): Promise<Buffer>;
26
+ toWebp(options?: IShorthandOptions): Promise<string>;
23
27
  private convertSvg;
24
28
  }
25
29
  export declare class SvgToImg {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodepit/svg-to-img",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "A node.js library to convert SVGs to images built with Puppeteer.",
5
5
  "homepage": "https://github.com/NodePit/svg-to-img",
6
6
  "keywords": [
@@ -97,6 +97,7 @@
97
97
  "prettier": "2.6.2",
98
98
  "puppeteer": "13.7.0",
99
99
  "rimraf": "3.0.2",
100
+ "ts-expect": "^1.3.0",
100
101
  "ts-jest": "27.1.4",
101
102
  "typescript": "4.6.4"
102
103
  },
@@ -1,46 +0,0 @@
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-commit DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npm run build && npm run test
package/.husky/pre-push DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npm run build && npm run test