diff options
Diffstat (limited to 'build')
-rwxr-xr-x | build/generate-images.js | 15 | ||||
-rwxr-xr-x | build/generate-svg.js | 13 |
2 files changed, 13 insertions, 15 deletions
diff --git a/build/generate-images.js b/build/generate-images.js index bea36321e3..d82f21564f 100755 --- a/build/generate-images.js +++ b/build/generate-images.js @@ -1,12 +1,11 @@ -#!/usr/bin/env node -'use strict'; - -const imageminZopfli = require('imagemin-zopfli'); -const {optimize, extendDefaultPlugins} = require('svgo'); -const {fabric} = require('fabric'); -const {readFile, writeFile} = require('fs').promises; -const {resolve} = require('path'); +import imageminZopfli from 'imagemin-zopfli'; +import {optimize, extendDefaultPlugins} from 'svgo'; +import {fabric} from 'fabric'; +import {readFile, writeFile} from 'fs/promises'; +import {resolve, dirname} from 'path'; +import {fileURLToPath} from 'url'; +const __dirname = dirname(fileURLToPath(import.meta.url)); const logoFile = resolve(__dirname, '../assets/logo.svg'); function exit(err) { diff --git a/build/generate-svg.js b/build/generate-svg.js index 97053a2958..3e14f906e3 100755 --- a/build/generate-svg.js +++ b/build/generate-svg.js @@ -1,11 +1,10 @@ -#!/usr/bin/env node -'use strict'; - -const fastGlob = require('fast-glob'); -const {optimize, extendDefaultPlugins} = require('svgo'); -const {resolve, parse} = require('path'); -const {readFile, writeFile, mkdir} = require('fs').promises; +import fastGlob from 'fast-glob'; +import {optimize, extendDefaultPlugins} from 'svgo'; +import {resolve, parse, dirname} from 'path'; +import {readFile, writeFile, mkdir} from 'fs/promises'; +import {fileURLToPath} from 'url'; +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'); |