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
tokarchuk/v1.17
silverwind 4 years ago committed by GitHub
parent 9d07facdeb
commit f7830041f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      Makefile
  2. 3
      build/generate-images.js
  3. 3
      build/generate-svg.js

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

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

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

Loading…
Cancel
Save