sign-windows.js 1.1 KB

1234567891011121314151617181920212223242526
  1. "use strict";
  2. const fs = require("fs");
  3. const path = require('path');
  4. const win64 = 'win32-x64';
  5. const win32 = 'win32-ia32';
  6. const winArg = process.argv[2];
  7. const winExt = winArg === 'win32' ? win32: win64;
  8. const rootPath = path.join(__dirname, '..');
  9. const outPath = path.join(rootPath, 'out');
  10. const packedPath = path.join(outPath, 'flasher.js-' + winExt);
  11. const exec = require('child_process').execSync;
  12. fs.readdir(packedPath, (err, files) => {
  13. const dllsAndExes = files.filter(file => {
  14. return file.endsWith(".dll") || file.endsWith(".exe");
  15. });
  16. dllsAndExes.forEach(run);
  17. });
  18. function run(file) {
  19. exec(`signtool.exe sign /a /d "Flasher.js" /du https://github.com/ThingsSDK/flasher.js /s MY /n "Andrew Chalkley" /fd sha1 /t http://timestamp.verisign.com/scripts/timstamp.dll /v "${path.join(packedPath, file)}"`);
  20. exec(`signtool.exe sign /a /d "Flasher.js" /du https://github.com/ThingsSDK/flasher.js /s MY /n "Andrew Chalkley" /fd sha256 /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td sha256 /as /v "${path.join(packedPath, file)}"`);
  21. }