Ver a proveniência

Avoids making unneeded fs changes during build

Avoids unneeded build re-triggering while watching
main
Eric Amodio há 1 ano
ascendente
cometimento
97485cc86e
2 ficheiros alterados com 17 adições e 6 eliminações
  1. +2
    -2
      .fantasticonrc.js
  2. +15
    -4
      scripts/applyIconsContribution.js

+ 2
- 2
.fantasticonrc.js Ver ficheiro

@ -24,8 +24,8 @@ const config = {
},
pathOptions: {
woff2: './dist/glicons.woff2',
scss: './src/webviews//apps/shared/glicons.scss',
html: './icons-contribution.json',
scss: './dist/glicons.scss',
html: './dist/icons-contribution.json',
json: './images/icons/template/mapping.json',
},
};

+ 15
- 4
scripts/applyIconsContribution.js Ver ficheiro

@ -3,9 +3,20 @@ const fs = require('fs');
// Update the icons contribution point in package.json
const package = require('../package.json');
package.contributes.icons = require('../icons-contribution.json').icons;
const icons = require('../dist/icons-contribution.json').icons;
if (JSON.stringify(package.contributes.icons) !== JSON.stringify(icons)) {
package.contributes.icons = icons;
const packageJSON = `${JSON.stringify(package, undefined, '\t')}\n`;
fs.writeFileSync('./package.json', packageJSON);
}
const packageJSON = `${JSON.stringify(package, undefined, '\t')}\n`;
fs.rmSync('./dist/icons-contribution.json');
fs.writeFileSync('./package.json', packageJSON);
fs.rmSync('./icons-contribution.json');
// Update the scss file
const newScss = fs.readFileSync('./dist/glicons.scss', 'utf8');
const scss = fs.readFileSync('./src/webviews/apps/shared/glicons.scss', 'utf8');
if (scss !== newScss) {
fs.writeFileSync('./src/webviews/apps/shared/glicons.scss', newScss);
}
fs.rmSync('./dist/glicons.scss');

Carregando…
Cancelar
Guardar