build: make es6 build work for windows

This commit is contained in:
Johannes Millan 2021-06-11 18:10:39 +02:00
parent da67484f31
commit 2f8f469109
3 changed files with 39 additions and 2 deletions

View file

@ -47,7 +47,7 @@
"start": "yarn electron:build && cross-env NODE_ENV=DEV electron .",
"startFrontend": "ng serve",
"serveProd": "ng serve --prod",
"removeWOFF1": "find dist/ -type f -iname '*.woff' -delete && find dist/ -type f -iname '*.css' -exec sed -i \"s/, url\\('.*'\\) format\\('woff'\\)//g\" {} \\;",
"removeWOFF1": "node ./tools/remove-woff.js",
"buildFrontend:prod:es6": "cross-env BROWSERSLIST_ENV='modern' ng build --prod && yarn removeWOFF1",
"buildFrontend:prodWeb": "ng build --prod --configuration productionWeb",
"buildFrontend:stage:es6": "cross-env BROWSERSLIST_ENV='modern' ng build --prod --configuration stage && yarn removeWOFF1",
@ -180,6 +180,7 @@
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-unused-imports": "^1.1.1",
"file-saver": "^2.0.2",
"glob": "^7.1.7",
"hammerjs": "^2.0.8",
"helpful-decorators": "^2.1.0",
"husky": "^4.2.5",

24
tools/remove-woff.js Normal file
View file

@ -0,0 +1,24 @@
/* eslint-env es6 */
const glob = require('glob');
const fs = require('fs');
// "removeWOFF2": "find dist/ -type f -iname '*.woff' -delete && find dist/ -type f -iname '*.css' -exec sed -i \"s/, url\\('.*'\\) format\\('woff'\\)//g\" {} \\;",
glob('dist/*.woff', function (er, files) {
files.forEach((filePath) => {
fs.unlinkSync(filePath);
});
});
// NOTE: this would remove the dead references, but it should be no problem anyway
// glob('dist/*.css', function (er, files) {
// files.forEach((filePath) => {
// const fileContent = fs.readFileSync(filePath, { encoding: 'utf8' });
// const newFileContent = fileContent
// .replace(/,url\(.*\) format\('woff'\)/g, '')
// .replace(/,url\(.*\) format\("woff"\)/g, '')
// .replace(/url\(.*\) format\('woff'\)/g, '')
// .replace(/url\(.*\) format\("woff"\)/g, '');
// fs.writeFileSync(filePath, newFileContent);
// });
// });

View file

@ -3236,7 +3236,7 @@ cdav-library@nextcloud/cdav-library:
version "0.0.1"
resolved "https://codeload.github.com/nextcloud/cdav-library/tar.gz/7fdc09ccc4917635c5189a878be9a899ee81f799"
dependencies:
core-js "^3.13.0"
core-js "^3.10.0"
regenerator-runtime "^0.13.7"
chai-nightwatch@^0.4.0:
@ -6301,6 +6301,18 @@ glob@7.1.6, glob@^7.0.0, glob@^7.0.3, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@^7.1.7:
version "7.1.7"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90"
integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
global-agent@^2.0.2:
version "2.1.12"
resolved "https://registry.yarnpkg.com/global-agent/-/global-agent-2.1.12.tgz#e4ae3812b731a9e81cbf825f9377ef450a8e4195"