punchcutter 1.0.39 → 2.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.
@@ -2,7 +2,7 @@ version: 2
2
2
  jobs:
3
3
  build:
4
4
  docker:
5
- - image: cimg/node:16.13.2-browsers
5
+ - image: cimg/node:16.14.2-browsers
6
6
  steps:
7
7
  - checkout
8
8
  - run:
package/lib/svg2pngMin.js CHANGED
@@ -2,10 +2,8 @@ const _ = require('lodash');
2
2
  const cheerio = require('cheerio');
3
3
  const fs = require('fs-extra');
4
4
  const path = require('path');
5
- const pngquant = require('pngquant');
6
5
  const Promise = require('bluebird');
7
- const streamifier = require('streamifier');
8
- const svg2png = require('svg2png');
6
+ const sharp = require('sharp');
9
7
 
10
8
  Promise.promisifyAll(fs);
11
9
 
@@ -27,10 +25,8 @@ module.exports = function (src, destDir, scale, suffix) {
27
25
 
28
26
  return fs
29
27
  .mkdirpAsync(destDir)
30
- .then(function () {
31
- return fs.readFileAsync(src, 'utf-8');
32
- })
33
- .then(function (data) {
28
+ .then(() => fs.readFileAsync(src, 'utf-8'))
29
+ .then((data) => {
34
30
  let resize;
35
31
 
36
32
  if (scale) {
@@ -54,24 +50,12 @@ module.exports = function (src, destDir, scale, suffix) {
54
50
  }
55
51
  }
56
52
 
57
- // Convert SVG to PNG.
58
53
  const buffer = Buffer.from(data, 'utf-8');
59
54
 
60
- return svg2png(buffer, resize);
61
- })
62
- .then(function (buffer) {
63
- return new Promise(function (resolve, reject) {
64
- const writeStream = fs.createWriteStream(dest);
65
-
66
- writeStream.on('close', function () {
67
- resolve();
68
- });
55
+ if (resize) {
56
+ return sharp(buffer).resize(resize).toFile(dest);
57
+ }
69
58
 
70
- streamifier
71
- .createReadStream(buffer)
72
- // Minify PNG.
73
- .pipe(new pngquant([256]))
74
- .pipe(writeStream);
75
- });
59
+ return sharp(buffer).toFile(dest);
76
60
  });
77
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "punchcutter",
3
- "version": "1.0.39",
3
+ "version": "2.0.0",
4
4
  "description": "Build fonts",
5
5
  "main": "lib/punchcutter.js",
6
6
  "repository": {
@@ -21,17 +21,17 @@
21
21
  "url": "https://github.com/netbek/punchcutter/issues"
22
22
  },
23
23
  "dependencies": {
24
- "@babel/core": "7.17.9",
25
- "@babel/eslint-parser": "7.17.0",
26
- "autoprefixer": "10.4.4",
27
- "babel-loader": "8.2.4",
24
+ "@babel/core": "7.18.2",
25
+ "@babel/eslint-parser": "7.18.2",
26
+ "autoprefixer": "10.4.7",
27
+ "babel-loader": "8.2.5",
28
28
  "babel-plugin-lodash": "3.3.4",
29
29
  "babel-plugin-transform-class-properties": "6.24.1",
30
30
  "bluebird": "3.7.2",
31
31
  "chalk": "4.1.2",
32
32
  "cheerio": "0.22.0",
33
33
  "directory-colorfy": "https://github.com/netbek/directory-colorfy.git#netbek-jsdom-9",
34
- "eslint": "8.13.0",
34
+ "eslint": "8.16.0",
35
35
  "eslint-config-airbnb": "19.0.4",
36
36
  "eslint-config-prettier": "8.5.0",
37
37
  "eslint-plugin-babel": "5.3.1",
@@ -42,24 +42,22 @@
42
42
  "eslint-plugin-jsx-a11y": "6.5.1",
43
43
  "eslint-plugin-markdown": "2.2.1",
44
44
  "eslint-plugin-prettier": "4.0.0",
45
- "eslint-plugin-react": "7.29.4",
46
- "eslint-plugin-react-hooks": "4.4.0",
47
- "fs-extra": "10.0.1",
48
- "glob": "7.2.0",
45
+ "eslint-plugin-react": "7.30.0",
46
+ "eslint-plugin-react-hooks": "4.5.0",
47
+ "fs-extra": "10.1.0",
48
+ "glob": "7.2.3",
49
49
  "glob-promise": "4.2.2",
50
- "grunt": "1.5.0",
50
+ "grunt": "1.5.3",
51
51
  "grunt-webfont": "git+https://github.com/netbek/grunt-webfont.git#netbek-logger-option",
52
52
  "lodash": "4.17.21",
53
53
  "lodash-webpack-plugin": "0.11.6",
54
54
  "node-sass": "7.0.1",
55
55
  "nunjucks": "3.2.3",
56
- "pngquant": "4.0.0",
57
- "postcss": "8.4.12",
56
+ "postcss": "8.4.14",
58
57
  "prettier": "2.6.2",
59
58
  "replace-ext": "2.0.0",
59
+ "sharp": "0.30.6",
60
60
  "spritesmith": "3.4.0",
61
- "streamifier": "0.1.1",
62
- "svg2png": "4.1.1",
63
61
  "svgo": "2.8.0",
64
62
  "svgstore": "3.0.1",
65
63
  "webpack": "4.46.0"