質問編集履歴

1

electron-packageからelectron-buildへ変更。それに伴うファイル構成などの変更

2020/02/09 12:20

投稿

yuuyu
yuuyu

スコア1139

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  にて、electron-storeをダウンロードし、
8
8
 
9
- npx electron-packager src FirstApp --platform=darwin --arch=x64 --overwrite
9
+ node build-mac
10
10
 
11
11
  でパッケージ化させたのですが、
12
12
 
@@ -20,25 +20,51 @@
20
20
 
21
21
  ```main
22
22
 
23
+ ├build-mac.js
24
+
23
25
  ├node_modules
24
26
 
25
27
  ├package-lock.json
26
28
 
27
29
  ├package.json
28
30
 
29
- └src
30
-
31
- ├index.html
31
+ ├index.html
32
-
32
+
33
- main.js
33
+ main.js
34
-
35
- └package.json
36
34
 
37
35
  ```
38
36
 
39
37
  ###コード
40
38
 
39
+ main/build-mac.js
40
+
41
+ ```js
42
+
43
+ const builder = require('electron-builder');
44
+
45
+ const store = require('electron-store');
46
+
47
+
48
+
49
+ builder.build({
50
+
51
+ config: {
52
+
53
+ 'appId': 'com.exam.title', //例示用に書き換えています
54
+
55
+ 'mac':{
56
+
57
+ 'target': 'zip',
58
+
59
+ }
60
+
61
+ }
62
+
63
+ });
64
+
65
+ ```
66
+
41
- main/src/index.html
67
+ main/index.html
42
68
 
43
69
  ```html
44
70
 
@@ -96,7 +122,7 @@
96
122
 
97
123
  ```
98
124
 
99
- main/src/main.js
125
+ main/main.js
100
126
 
101
127
  ```js
102
128
 
@@ -192,16 +218,48 @@
192
218
 
193
219
  ```
194
220
 
195
- main/src/package.json
221
+ main/package.json
196
222
 
197
223
  ```json
198
224
 
199
225
  {
200
226
 
227
+ "name": "title",
228
+
229
+ "version": "1.0.0",
230
+
231
+ "description": "",
232
+
201
- "main": "main.js"
233
+ "main": "main.js",
234
+
235
+ "scripts": {
236
+
237
+ "test": "echo \"Error: no test specified\" && exit 1"
238
+
239
+ },
240
+
241
+ "keywords": [],
242
+
243
+ "author": "",
244
+
245
+ "license": "ISC",
246
+
247
+ "devDependencies": {
248
+
249
+ "electron": "^8.0.0",
250
+
251
+ "electron-builder": "^22.3.2",
252
+
253
+ "electron-store": "^5.1.0"
254
+
255
+ },
256
+
257
+ "dependencies": {}
202
258
 
203
259
  }
204
260
 
261
+
262
+
205
263
  ```
206
264
 
207
265
  基本的にチュートリアルほぼそのままです。