Skip to content

Commit ca32e3f

Browse files
committed
Migrated from electron-packager to electron-builder
1 parent d255fb2 commit ca32e3f

File tree

8 files changed

+1377
-519
lines changed

8 files changed

+1377
-519
lines changed

package-lock.json

Lines changed: 1298 additions & 494 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,64 @@
11
{
22
"name": "hiera-editor",
3-
"version": "0.1.1",
4-
"description": "Hiera editor",
3+
"version": "0.1.2",
4+
"description": "A GUI tool to manage your Puppet/Hiera for you",
55
"main": "dist/main.js",
66
"scripts": {
77
"start": "electron .",
8-
"postinstall": "npx npmpd && npx run-script-os",
8+
"postinstall": "npx run-script-os && npx electron-builder install-app-deps",
99
"install:darwin": "./node_modules/rubyjs-darwin/bin/gem install bundler && BUNDLE_GEMFILE=./ruby/Gemfile ./node_modules/rubyjs-darwin/bin/bundle install",
1010
"install:linux": "./node_modules/rubyjs-linux/bin/gem install -f bundler && BUNDLE_GEMFILE=./ruby/Gemfile ./node_modules/rubyjs-linux/bin/bundle install",
1111
"install:win32": "cmd /C \"set BUNDLE_GEMFILE=ruby\\Gemfile && node_modules\\rubyjs-win32\\bin\\gem install bundler && node_modules\\rubyjs-win32\\bin\\bundle install\"",
1212
"test": "mocha --timeout 15000 dist/tests/**/*.js",
13-
"package-mac": "npx electron-packager . --no-prune --overwrite --platform=darwin --arch=x64 --icon=assets/icons/icon.icns --out=release-builds",
14-
"package-win": "npx electron-packager . hiera-editor --no-prune --overwrite --platform=win32 --arch=ia32 --icon=assets/icons/icon.ico --out=release-builds --version-string.ProductName=\"Hiera Editor\"",
15-
"package-linux": "npx electron-packager . hiera-editor --no-prune --overwrite --platform=linux --arch=x64 --icon=assets/icons/icon.png --out=release-builds"
13+
"compile": "tsc",
14+
"dist": "npm run compile && npx electron-builder",
15+
"publish": "npm run compile && npx electron-builder -p onTagOrDraft"
1616
},
1717
"repository": "https://github.com/desertkun/hiera-editor",
18+
"build": {
19+
"appId": "com.desertkun.hiera-editor",
20+
"productName": "Hiera Editor",
21+
"files": [
22+
"./build/**/*",
23+
"./dist/**/*",
24+
"./html/**/*",
25+
"./css/**/*",
26+
"./js/**/*",
27+
"./images/**/*",
28+
"./fonts/**/*"
29+
],
30+
"directories": {
31+
"output": "release-builds"
32+
},
33+
"nsis": {
34+
"createDesktopShortcut": true
35+
},
36+
"mac": {
37+
"asar": true,
38+
"asarUnpack": [
39+
"**/app/node_modules/rubyjs-darwin/*"
40+
],
41+
"icon": "build/icons/icon.icns",
42+
"target": [
43+
"zip",
44+
"dmg"
45+
]
46+
},
47+
"win": {
48+
"asar": true,
49+
"asarUnpack": [
50+
"**/app/node_modules/rubyjs-win32/*"
51+
],
52+
"icon": "build/icons/icon.ico"
53+
},
54+
"linux": {
55+
"asar": true,
56+
"asarUnpack": [
57+
"**/app/node_modules/rubyjs-linux/*"
58+
],
59+
"icon": "build/icons/icon.png"
60+
}
61+
},
1862
"keywords": [
1963
"Electron",
2064
"Puppet",
@@ -26,12 +70,14 @@
2670
"@types/chai-as-promised": "^7.1.0",
2771
"@types/mocha": "^5.2.5",
2872
"@types/tmp": "0.0.33",
73+
"@types/chai": "^4.1.6",
74+
"@types/fs-extra": "^5.0.4",
75+
"@types/yaml": "^1.0.0",
2976
"chai": "^4.2.0",
3077
"chai-as-promised": "^7.1.1",
3178
"electron": "^3.0.0",
32-
"electron-packager": "^12.2.0",
79+
"electron-builder": "^20.38.4",
3380
"mocha": "^5.2.0",
34-
"npm-platform-dependencies": "git+https://github.com/desertkun/npm-platform-dependencies.git",
3581
"rimraf": "^2.6.2",
3682
"run-script-os": "^1.0.3",
3783
"tmp": "0.0.33",
@@ -40,13 +86,11 @@
4086
},
4187
"dependencies": {
4288
"@fortawesome/fontawesome-free": "^5.3.1",
43-
"@types/chai": "^4.1.6",
44-
"@types/fs-extra": "^5.0.4",
45-
"@types/yaml": "^1.0.0",
4689
"app-root-path": "^2.0.1",
4790
"dialogs": "^1.1.20",
4891
"electron-ipc-tunnel": "^3.1.0",
4992
"electron-json-storage": "^4.1.3",
93+
"electron-updater": "^4.0.6",
5094
"electron-window-state": "^4.1.1",
5195
"es6-promise-pool": "^2.5.0",
5296
"extract-zip": "^1.6.7",
@@ -59,13 +103,9 @@
59103
"text-ellipsis": "^1.0.3",
60104
"yaml": "^1.0.1"
61105
},
62-
"darwinDependencies": {
63-
"rubyjs-darwin": "latest"
64-
},
65-
"win32Dependencies": {
66-
"rubyjs-win32": "latest"
67-
},
68-
"linuxDependencies": {
106+
"optionalDependencies": {
107+
"rubyjs-darwin": "latest",
108+
"rubyjs-win32": "latest",
69109
"rubyjs-linux": "latest"
70110
}
71111
}

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import * as path from "path";
44
import * as url from "url";
55
import { puppet } from "./puppet";
66
import "./ipc/server";
7-
87
import { ProjectsModel } from "./projects"
98
import { init, projects_window } from "./global"
9+
const { autoUpdater } = require("electron-updater")
1010

1111
function initialize()
1212
{
13+
autoUpdater.checkForUpdatesAndNotify();
1314
init();
14-
1515
projects_window.show();
1616
}
1717

src/puppet.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export module puppet
2222

2323
export class Ruby
2424
{
25-
public static Path(): RubyPath
25+
private static Path_(): RubyPath
2626
{
2727
if (process.platform == "win32")
2828
{
@@ -39,12 +39,25 @@ export module puppet
3939

4040
return null;
4141
}
42+
43+
public static Path(): RubyPath
44+
{
45+
const path_ = Ruby.Path_();
46+
47+
return {
48+
path: path_.path.replace('app.asar', 'app.asar.unpacked'),
49+
rubyPath: path_.rubyPath.replace('app.asar', 'app.asar.unpacked'),
50+
gemPath: path_.gemPath.replace('app.asar', 'app.asar.unpacked'),
51+
};
52+
}
4253

4354
public static async CallBin(script: string, args: string[], cwd: string, env_: any, cb?: async.ExecFileLineCallback): Promise<void>
4455
{
56+
const ruby = Ruby.Path();
57+
4558
const argsTotal = [
46-
Ruby.Path().rubyPath,
47-
path.join(Ruby.Path().path, script)
59+
ruby.rubyPath,
60+
path.join(ruby.path, script)
4861
];
4962

5063
for (let arg of args)
@@ -56,13 +69,14 @@ export module puppet
5669
Object.assign(env, env_);
5770

5871
env["SSL_CERT_FILE"] = require('app-root-path').resolve("ruby/cacert.pem");
59-
env["PATH"] = Ruby.Path().path + path.delimiter + process.env["PATH"];
72+
env["PATH"] = ruby.path + path.delimiter + process.env["PATH"];
6073

6174
await async.execFileReadIn("\"" + argsTotal.join("\" \"") + "\"", cwd, env, cb);
6275
}
6376

6477
public static async Call(script: string, args: Array<string>, cwd: string): Promise<boolean>
6578
{
79+
const ruby = Ruby.Path();
6680
const rubyScript = require('app-root-path').resolve(path.join("ruby", script));
6781

6882
const argsTotal = [];
@@ -76,7 +90,7 @@ export module puppet
7690

7791
try
7892
{
79-
await async.execFile(Ruby.Path().rubyPath, argsTotal, cwd);
93+
await async.execFile(ruby.rubyPath, argsTotal, cwd);
8094
return true;
8195
}
8296
catch (e)

0 commit comments

Comments
 (0)