Kaynağa Gözat

Avoids making unneeded fs changes during build

Avoids unneeded build re-triggering while watching
main
Eric Amodio 1 yıl önce
ebeveyn
işleme
97485cc86e
2 değiştirilmiş dosya ile 17 ekleme ve 6 silme
  1. +2
    -2
      .fantasticonrc.js
  2. +15
    -4
      scripts/applyIconsContribution.js

+ 2
- 2
.fantasticonrc.js Dosyayı Görüntüle

@ -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 Dosyayı Görüntüle

@ -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');

Yükleniyor…
İptal
Kaydet