electronのpackageからappxを作ってローカルに証明書でサインしてインストールしてみる
electron-packagerをインストールします。
npm install electron-packager -g
packageを作ります。
electron-packager . "Sample" --platform=win32 --arch=x64
electron-windows-storeをインストールします。
npm install -g electron-windows-store
できたpackageのパスをinput-directoryに指定してappxを作ります。
electron-windows-store --input-directory "C:\Users\shingo\Documents\workspace\electron-quick-start\Sample-win32-x64" --output-directory "C:\Users\shingo\Documents\workspace\out" --flatten true --package-version 1.0.0.0 --package-name Sample
まずDesktop App Converterを使うか聞かれるのでNoとします。
? Did you download and install the Desktop App Converter? It is *not* required to run this tool. No
次に証明書を作るか聞いてくるのでYesします。
? You need to install a development certificate in order to run your app. Would you like us to create one? Yes Welcome to the Electron-Windows-Store tool! This tool will assist you with turning your Electron app into a swanky Windows Store app. We need to know some settings. We will ask you only once and store your answers in your profile folder in a .electron-windows-store file.
ここで発行者IDとWindows Kitのbinディレクトリーを設定します。
? Please enter your publisher identity: CN=yamshing ? Please enter the location of your Windows Kit's bin folder: C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64 Creating Certficate
When asked to enter a password, please select "None".
これで開発用の証明書でサインされたappxがつくられます。
このままではappxをダブルクリックしても証明書のエラーでインストールできません。
このappxをサインした証明書をルートにインポートしないといけません。
そのためにmmcというコマンドを実行します。
C:\Windows\System32\mmc.exeを実行します。
ファイル->スナップインの追加
証明書を選択して追加
コンピューターアカウントを選択して次へ
完了します。
信用されたルート証明機関を右クリックしてインポートを実行します。
C:\Users\shingo\AppData\Roaming\electron-windows-store内に生成されたcerファイルを選択しパスワードを入れてインポートを完了します。
インストールが無事に実行されました。