Browse Source

Make build scripts compatible with node 12 (#15479)

* Make build scripts compatible with node 12

"fs/promises" is not in node 12, use a more compatible way to import it.
Also, lock major down versions of the image build dependencies to
prevent future surprises.

* add node_modules dependency
pull/15496/head
silverwind 1 month ago
committed by GitHub
parent
commit
f7830041f4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions
  1. +2
    -2
      Makefile
  2. +2
    -1
      build/generate-images.js
  3. +2
    -1
      build/generate-svg.js

+ 2
- 2
Makefile View File

@ -736,8 +736,8 @@ generate-gitignore:
GO111MODULE=on $(GO) run build/generate-gitignores.go
.PHONY: generate-images
generate-images:
npm install --no-save --no-package-lock fabric imagemin-zopfli
generate-images: | node_modules
npm install --no-save --no-package-lock fabric@4 imagemin-zopfli@7
node build/generate-images.js $(TAGS)
.PHONY: generate-manpage


+ 2
- 1
build/generate-images.js View File

@ -1,10 +1,11 @@
import imageminZopfli from 'imagemin-zopfli';
import {optimize, extendDefaultPlugins} from 'svgo';
import {fabric} from 'fabric';
import {readFile, writeFile} from 'fs/promises';
import fs from 'fs';
import {resolve, dirname} from 'path';
import {fileURLToPath} from 'url';
const {readFile, writeFile} = fs.promises;
const __dirname = dirname(fileURLToPath(import.meta.url));
const logoFile = resolve(__dirname, '../assets/logo.svg');


+ 2
- 1
build/generate-svg.js View File

@ -1,9 +1,10 @@
import fastGlob from 'fast-glob';
import {optimize, extendDefaultPlugins} from 'svgo';
import {resolve, parse, dirname} from 'path';
import {readFile, writeFile, mkdir} from 'fs/promises';
import fs from 'fs';
import {fileURLToPath} from 'url';
const {readFile, writeFile, mkdir} = fs.promises;
const __dirname = dirname(fileURLToPath(import.meta.url));
const glob = (pattern) => fastGlob.sync(pattern, {cwd: resolve(__dirname), absolute: true});
const outputDir = resolve(__dirname, '../public/img/svg');


Loading…
Cancel
Save