From 668bb9b5d54871d43578ebc8f1c1df554168b9d6 Mon Sep 17 00:00:00 2001 From: antelle Date: Sat, 4 Apr 2020 10:25:12 +0200 Subject: [PATCH] removed --no-sign --- Gruntfile.js | 59 +++++++++++++++-------------------- build/tasks/grunt-sign-exe.js | 10 +++--- package.json | 4 +-- 3 files changed, 32 insertions(+), 41 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8320e55a..a9c1c22f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -29,22 +29,7 @@ module.exports = function(grunt) { const zipCommentPlaceholder = zipCommentPlaceholderPart + '.'.repeat(512 - zipCommentPlaceholderPart.length); const electronVersion = pkg.dependencies.electron.replace(/^\D/, ''); - - const skipCodeSigning = grunt.option('no-sign'); - let codeSignConfig; - - if (!skipCodeSigning) { - try { - codeSignConfig = require('../keys/codesign'); - } catch (err) { - throw new Error( - 'Unable to load code signing config from ../keys/codesign.\n' + - 'This is needed for production builds targeting macOS.\n' + - 'For development builds, run with the `--no-sign` arg to skip code signing,\n' + - 'e.g. `npm start -- --no-sign`' - ); - } - } + const getCodeSingConfig = () => require('../keys/codesign'); const webpackOptions = { date, @@ -316,22 +301,24 @@ module.exports = function(grunt) { appBundleId: 'net.antelle.keeweb', appCategoryType: 'public.app-category.productivity', extendInfo: 'package/osx/extend.plist', - ...(codeSignConfig - ? { - osxSign: { - identity: codeSignConfig.identities.app, - hardenedRuntime: true, - entitlements: 'package/osx/entitlements.mac.plist', - 'entitlements-inherit': 'package/osx/entitlements.mac.plist', - 'gatekeeper-assess': false - }, - osxNotarize: { - appleId: codeSignConfig.appleId, - appleIdPassword: '@keychain:AC_PASSWORD', - ascProvider: codeSignConfig.teamId - } - } - : {}), + osxSign: { + get identity() { + return getCodeSingConfig().identities.app; + }, + hardenedRuntime: true, + entitlements: 'package/osx/entitlements.mac.plist', + 'entitlements-inherit': 'package/osx/entitlements.mac.plist', + 'gatekeeper-assess': false + }, + osxNotarize: { + get appleId() { + return getCodeSingConfig().appleId; + }, + appleIdPassword: '@keychain:AC_PASSWORD', + get ascProvider() { + return getCodeSingConfig().teamId; + } + }, afterCopy: [ (buildPath, electronVersion, platform, arch, callback) => { if (path.basename(buildPath) !== 'app') { @@ -590,9 +577,13 @@ module.exports = function(grunt) { }, 'sign-exe': { options: { - // algo: 'SHA256', url: pkg.homepage, - ...(codeSignConfig ? codeSignConfig.windows : {}) + get vm() { + return getCodeSingConfig().windowsVM; + }, + get certHash() { + return getCodeSingConfig().microsoftCertHash; + } }, 'win32-build-x64': { options: { diff --git a/build/tasks/grunt-sign-exe.js b/build/tasks/grunt-sign-exe.js index 6df4330b..7f994c07 100644 --- a/build/tasks/grunt-sign-exe.js +++ b/build/tasks/grunt-sign-exe.js @@ -43,14 +43,14 @@ module.exports = function(grunt) { const cmd = 'VBoxManage'; const args = [ 'guestcontrol', - opt.vmName, + opt.vm.name, '--username', - opt.vmUser, + opt.vm.user, '--password', - opt.vmPass, + opt.vm.pass, 'run', - opt.vmExec, - `sign /t ${timeServer} /d "${name}" /du ${opt.url} ${opt.vmShare}${fileNameWithoutFolder}` + opt.vm.exec, + `sign /t ${timeServer} /d "${name}" /du ${opt.url} ${opt.vm.share}${fileNameWithoutFolder}` ]; // the algo is not working: "/fd ${opt.algo}" let res = spawnSync(cmd, args); diff --git a/package.json b/package.json index 4eb0441c..b9590ca9 100644 --- a/package.json +++ b/package.json @@ -95,11 +95,11 @@ }, "scripts": { "start": "grunt", - "test": "grunt test --no-sign", + "test": "grunt test", "postinstall": "cd desktop && npm install", "build-beta": "grunt --beta && cp dist/index.html ../keeweb-beta/index.html && cd ../keeweb-beta && git add index.html && git commit -a -m 'beta' && git push origin master", "electron": "cross-env ELECTRON_DISABLE_SECURITY_WARNINGS=1 electron desktop --htmlpath=http://localhost:8085", - "dev": "grunt dev --no-sign", + "dev": "grunt dev", "babel-helpers": "babel-external-helpers -l 'slicedToArray,toConsumableArray,defineProperty,typeof' -t global > app/lib/babel-helpers.js" }, "author": {