electron-incremental-update 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vite.cjs +16 -19
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +17 -20
- package/package.json +1 -1
package/dist/vite.cjs
CHANGED
|
@@ -99,6 +99,7 @@ async function buildAsar({
|
|
|
99
99
|
|
|
100
100
|
// src/build-plugins/entry.ts
|
|
101
101
|
var import_node_fs2 = require("fs");
|
|
102
|
+
var import_node_path = require("path");
|
|
102
103
|
var import_promises2 = require("fs/promises");
|
|
103
104
|
var import_node_crypto2 = require("crypto");
|
|
104
105
|
var import_node_os = require("os");
|
|
@@ -146,6 +147,8 @@ async function buildEntry({
|
|
|
146
147
|
keyLength
|
|
147
148
|
}) {
|
|
148
149
|
if (!import_ci_info2.isCI) {
|
|
150
|
+
const keysDir = (0, import_node_path.dirname)(privateKeyPath);
|
|
151
|
+
!(0, import_node_fs2.existsSync)(keysDir) && await (0, import_promises2.mkdir)(keysDir);
|
|
149
152
|
!(0, import_node_fs2.existsSync)(privateKeyPath) && await generateKey(privateKeyPath, publicKeyPath, keyLength);
|
|
150
153
|
await writePublicKeyToMain(entryPath, publicKeyPath);
|
|
151
154
|
}
|
|
@@ -201,25 +204,19 @@ function vite_default(options) {
|
|
|
201
204
|
const { asarOutputPath } = buildAsarOption;
|
|
202
205
|
const id = "electron-incremental-updater";
|
|
203
206
|
const log = (0, import_vite.createLogger)("info", { prefix: `[${id}]` });
|
|
204
|
-
return
|
|
205
|
-
{
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
{
|
|
214
|
-
name: `vite-plugin-${id}-asar`,
|
|
215
|
-
async closeBundle() {
|
|
216
|
-
if (!isBuild) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
log.info("build asar start");
|
|
220
|
-
await buildAsar(buildAsarOption);
|
|
221
|
-
log.info(`build asar end, output to ${asarOutputPath}`);
|
|
207
|
+
return {
|
|
208
|
+
name: `vite-plugin-${id}`,
|
|
209
|
+
enforce: "post",
|
|
210
|
+
async closeBundle() {
|
|
211
|
+
log.info("build entry start");
|
|
212
|
+
await buildEntry(buildEntryOption);
|
|
213
|
+
log.info(`build entry end, ${entryPath} -> ${entryOutputPath}`);
|
|
214
|
+
if (!isBuild) {
|
|
215
|
+
return;
|
|
222
216
|
}
|
|
217
|
+
log.info("build asar start");
|
|
218
|
+
await buildAsar(buildAsarOption);
|
|
219
|
+
log.info(`build asar end, output to ${asarOutputPath}`);
|
|
223
220
|
}
|
|
224
|
-
|
|
221
|
+
};
|
|
225
222
|
}
|
package/dist/vite.d.ts
CHANGED
package/dist/vite.mjs
CHANGED
|
@@ -67,7 +67,8 @@ async function buildAsar({
|
|
|
67
67
|
|
|
68
68
|
// src/build-plugins/entry.ts
|
|
69
69
|
import { existsSync } from "node:fs";
|
|
70
|
-
import {
|
|
70
|
+
import { dirname } from "node:path";
|
|
71
|
+
import { mkdir, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
|
|
71
72
|
import { generateKeyPairSync } from "node:crypto";
|
|
72
73
|
import { EOL } from "node:os";
|
|
73
74
|
import { isCI as isCI2 } from "ci-info";
|
|
@@ -114,6 +115,8 @@ async function buildEntry({
|
|
|
114
115
|
keyLength
|
|
115
116
|
}) {
|
|
116
117
|
if (!isCI2) {
|
|
118
|
+
const keysDir = dirname(privateKeyPath);
|
|
119
|
+
!existsSync(keysDir) && await mkdir(keysDir);
|
|
117
120
|
!existsSync(privateKeyPath) && await generateKey(privateKeyPath, publicKeyPath, keyLength);
|
|
118
121
|
await writePublicKeyToMain(entryPath, publicKeyPath);
|
|
119
122
|
}
|
|
@@ -169,27 +172,21 @@ function vite_default(options) {
|
|
|
169
172
|
const { asarOutputPath } = buildAsarOption;
|
|
170
173
|
const id = "electron-incremental-updater";
|
|
171
174
|
const log = createLogger("info", { prefix: `[${id}]` });
|
|
172
|
-
return
|
|
173
|
-
{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
name: `vite-plugin-${id}-asar`,
|
|
183
|
-
async closeBundle() {
|
|
184
|
-
if (!isBuild) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
log.info("build asar start");
|
|
188
|
-
await buildAsar(buildAsarOption);
|
|
189
|
-
log.info(`build asar end, output to ${asarOutputPath}`);
|
|
175
|
+
return {
|
|
176
|
+
name: `vite-plugin-${id}`,
|
|
177
|
+
enforce: "post",
|
|
178
|
+
async closeBundle() {
|
|
179
|
+
log.info("build entry start");
|
|
180
|
+
await buildEntry(buildEntryOption);
|
|
181
|
+
log.info(`build entry end, ${entryPath} -> ${entryOutputPath}`);
|
|
182
|
+
if (!isBuild) {
|
|
183
|
+
return;
|
|
190
184
|
}
|
|
185
|
+
log.info("build asar start");
|
|
186
|
+
await buildAsar(buildAsarOption);
|
|
187
|
+
log.info(`build asar end, output to ${asarOutputPath}`);
|
|
191
188
|
}
|
|
192
|
-
|
|
189
|
+
};
|
|
193
190
|
}
|
|
194
191
|
export {
|
|
195
192
|
vite_default as default
|