25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1 KiB

  1. import fs from 'fs';
  2. const packageJSONPromises = Promise.all([
  3. import('../package.json', { assert: { type: 'json' } }),
  4. import('../dist/icons-contribution.json', { assert: { type: 'json' } }),
  5. ]);
  6. const scssPromises = Promise.all([
  7. fs.promises.readFile('./dist/glicons.scss', 'utf8'),
  8. fs.promises.readFile('./src/webviews/apps/shared/glicons.scss', 'utf8'),
  9. ]);
  10. let pending = [];
  11. // Update the icons contribution point in package.json
  12. const [{ default: packageJSON }, { default: icons }] = await packageJSONPromises;
  13. if (JSON.stringify(packageJSON.contributes.icons) !== JSON.stringify(icons.icons)) {
  14. packageJSON.contributes.icons = icons;
  15. const json = `${JSON.stringify(packageJSON, undefined, '\t')}\n`;
  16. pending.push(fs.promises.writeFile('./package.json', json));
  17. }
  18. // Update the scss file
  19. const [newScss, scss] = await scssPromises;
  20. if (scss !== newScss) {
  21. pending.push(fs.promises.writeFile('./src/webviews/apps/shared/glicons.scss', newScss));
  22. }
  23. pending.push(fs.promises.rm('./dist/icons-contribution.json'), fs.promises.rm('./dist/glicons.scss'));
  24. await Promise.allSettled(pending);