From 8a82ae65baa567543a984af9d269e28f136cf871 Mon Sep 17 00:00:00 2001 From: Mike Maietta Date: Wed, 6 Dec 2023 16:47:27 -0800 Subject: [PATCH 1/7] chore: consolidating usages of `7zip-bin` to builder-util-runtime so as to execute `chmod` logic *always* --- packages/app-builder-lib/package.json | 1 - .../app-builder-lib/src/targets/FpmTarget.ts | 7 +++--- .../app-builder-lib/src/targets/archive.ts | 13 ++++------ .../src/targets/nsis/NsisTarget.ts | 7 +++--- packages/builder-util-runtime/package.json | 3 +++ packages/builder-util-runtime/src/7za.ts | 12 ++++++++++ packages/builder-util-runtime/src/index.ts | 1 + packages/builder-util/package.json | 1 - packages/builder-util/src/util.ts | 7 ++---- .../package.json | 3 --- .../src/squirrelPack.ts | 9 ++++--- pnpm-lock.yaml | 24 ++++++++----------- test/package.json | 1 - test/src/helpers/packTester.ts | 10 ++++---- 14 files changed, 47 insertions(+), 52 deletions(-) create mode 100644 packages/builder-util-runtime/src/7za.ts diff --git a/packages/app-builder-lib/package.json b/packages/app-builder-lib/package.json index 17070968526..d9a4f4460a6 100644 --- a/packages/app-builder-lib/package.json +++ b/packages/app-builder-lib/package.json @@ -46,7 +46,6 @@ "bugs": "https://github.com/electron-userland/electron-builder/issues", "homepage": "https://github.com/electron-userland/electron-builder", "dependencies": { - "7zip-bin": "~5.2.0", "@develar/schema-utils": "~2.6.5", "@electron/notarize": "2.1.0", "@electron/osx-sign": "1.0.5", diff --git a/packages/app-builder-lib/src/targets/FpmTarget.ts b/packages/app-builder-lib/src/targets/FpmTarget.ts index 9d848dbf40c..075862bad45 100644 --- a/packages/app-builder-lib/src/targets/FpmTarget.ts +++ b/packages/app-builder-lib/src/targets/FpmTarget.ts @@ -1,7 +1,6 @@ -import { path7za } from "7zip-bin" import { Arch, executeAppBuilder, getArchSuffix, log, TmpDir, toLinuxArchString, use, serializeToYaml, asArray } from "builder-util" import { unlinkIfExists } from "builder-util/out/fs" -import { chmod, outputFile, stat } from "fs-extra" +import { outputFile, stat } from "fs-extra" import { mkdir, readFile } from "fs/promises" import * as path from "path" import { smarten } from "../appInfo" @@ -18,6 +17,7 @@ import { getLinuxToolsPath } from "./tools" import { hashFile } from "../util/hash" import { ArtifactCreated } from "../packagerApi" import { getAppUpdatePublishConfiguration } from "../publish/PublishManager" +import { getPath7za } from "builder-util-runtime" interface FpmOptions { name: string @@ -234,10 +234,9 @@ export default class FpmTarget extends Target { return } - await chmod(path7za, 0o755) const env = { ...process.env, - SZA_PATH: path7za, + SZA_PATH: await getPath7za(), SZA_COMPRESSION_LEVEL: packager.compression === "store" ? "0" : "9", } diff --git a/packages/app-builder-lib/src/targets/archive.ts b/packages/app-builder-lib/src/targets/archive.ts index 086868a9de6..c74aa62507b 100644 --- a/packages/app-builder-lib/src/targets/archive.ts +++ b/packages/app-builder-lib/src/targets/archive.ts @@ -1,12 +1,12 @@ -import { path7za } from "7zip-bin" import { debug7z, exec, log } from "builder-util" import { exists, unlinkIfExists } from "builder-util/out/fs" -import { chmod, move } from "fs-extra" +import { move } from "fs-extra" import * as path from "path" import { create, CreateOptions, FileOptions } from "tar" import { TmpDir } from "temp-file" import { CompressionLevel } from "../core" import { getLinuxToolsPath } from "./tools" +import { getPath7za } from "builder-util-runtime" /** @internal */ export async function tar( @@ -55,9 +55,8 @@ export async function tar( compression, }) args.push(outFile, tarFile) - await chmod(path7za, 0o755) await exec( - path7za, + await getPath7za(), args, { cwd: path.dirname(dirToArchive), @@ -221,11 +220,9 @@ export async function archive(format: string, outFile: string, dirToArchive: str } try { - if (use7z) { - await chmod(path7za, 0o755) - } + const binary = use7z ? await getPath7za() : "zip" await exec( - use7z ? path7za : "zip", + binary, args, { cwd: options.withoutDir ? dirToArchive : path.dirname(dirToArchive), diff --git a/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts b/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts index 7bda409453e..f1edd468d92 100644 --- a/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts +++ b/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts @@ -1,11 +1,10 @@ -import { path7za } from "7zip-bin" import BluebirdPromise from "bluebird-lst" import { Arch, asArray, AsyncTaskManager, exec, executeAppBuilder, getPlatformIconFileName, InvalidConfigurationError, log, spawnAndWrite, use } from "builder-util" -import { CURRENT_APP_INSTALLER_FILE_NAME, CURRENT_APP_PACKAGE_FILE_NAME, PackageFileInfo, UUID } from "builder-util-runtime" +import { CURRENT_APP_INSTALLER_FILE_NAME, CURRENT_APP_PACKAGE_FILE_NAME, getPath7za, PackageFileInfo, UUID } from "builder-util-runtime" import { exists, statOrNull, walk } from "builder-util/out/fs" import _debug from "debug" import * as fs from "fs" -import { chmod, readFile, stat, unlink } from "fs-extra" +import { readFile, stat, unlink } from "fs-extra" import * as path from "path" import { getBinFromUrl } from "../../binDownload" import { Target } from "../../core" @@ -250,7 +249,7 @@ export class NsisTarget extends Target { await packager.dispatchArtifactCreated(file, this, arch) packageFiles[Arch[arch]] = fileInfo } - await chmod(path7za, 0o755) + const path7za = await getPath7za() const archiveInfo = (await exec(path7za, ["l", file])).trim() // after adding blockmap data will be "Warnings: 1" in the end of output const match = /(\d+)\s+\d+\s+\d+\s+files/.exec(archiveInfo) diff --git a/packages/builder-util-runtime/package.json b/packages/builder-util-runtime/package.json index e44ebe50f47..6ae89438777 100644 --- a/packages/builder-util-runtime/package.json +++ b/packages/builder-util-runtime/package.json @@ -18,10 +18,13 @@ "node": ">=12.0.0" }, "dependencies": { + "7zip-bin": "~5.2.0", "debug": "^4.3.4", + "fs-extra": "^10.1.0", "sax": "^1.2.4" }, "devDependencies": { + "@types/fs-extra": "9.0.13", "@types/debug": "4.1.7", "@types/sax": "1.2.3" }, diff --git a/packages/builder-util-runtime/src/7za.ts b/packages/builder-util-runtime/src/7za.ts new file mode 100644 index 00000000000..b8fa1c59342 --- /dev/null +++ b/packages/builder-util-runtime/src/7za.ts @@ -0,0 +1,12 @@ +import { path7x, path7za } from "7zip-bin" +import { chmod } from "fs-extra" + +export async function getPath7za(): Promise { + await chmod(path7za, 0o755) + return path7za +} + +export async function getPath7x(): Promise { + await chmod(path7x, 0o755) + return path7x +} diff --git a/packages/builder-util-runtime/src/index.ts b/packages/builder-util-runtime/src/index.ts index b3d845ac8de..6e08e328fa8 100644 --- a/packages/builder-util-runtime/src/index.ts +++ b/packages/builder-util-runtime/src/index.ts @@ -35,6 +35,7 @@ export { UUID } from "./uuid" export { ProgressCallbackTransform, ProgressInfo } from "./ProgressCallbackTransform" export { parseXml, XElement } from "./xml" export { BlockMap } from "./blockMapApi" +export { getPath7za, getPath7x } from "./7za" // nsis export const CURRENT_APP_INSTALLER_FILE_NAME = "installer.exe" diff --git a/packages/builder-util/package.json b/packages/builder-util/package.json index 6eb6763dc1d..62e70a365ad 100644 --- a/packages/builder-util/package.json +++ b/packages/builder-util/package.json @@ -16,7 +16,6 @@ ], "dependencies": { "@types/debug": "^4.1.6", - "7zip-bin": "~5.2.0", "app-builder-bin": "4.0.0", "bluebird-lst": "^1.0.9", "builder-util-runtime": "workspace:*", diff --git a/packages/builder-util/src/util.ts b/packages/builder-util/src/util.ts index a54cab954b1..7f0493dd747 100644 --- a/packages/builder-util/src/util.ts +++ b/packages/builder-util/src/util.ts @@ -1,13 +1,11 @@ -import { path7za } from "7zip-bin" import { appBuilderPath } from "app-builder-bin" -import { safeStringifyJson } from "builder-util-runtime" +import { getPath7za, safeStringifyJson } from "builder-util-runtime" import * as chalk from "chalk" import { ChildProcess, execFile, ExecFileOptions, SpawnOptions } from "child_process" import { spawn as _spawn } from "cross-spawn" import { createHash } from "crypto" import _debug from "debug" import { dump } from "js-yaml" -import { chmod } from "fs-extra" import * as path from "path" import { debug, log } from "./log" import { install as installSourceMap } from "source-map-support" @@ -357,10 +355,9 @@ export async function executeAppBuilder( maxRetries = 0 ): Promise { const command = appBuilderPath - await chmod(path7za, 0o755) const env: any = { ...process.env, - SZA_PATH: path7za, + SZA_PATH: await getPath7za(), FORCE_COLOR: chalk.level === 0 ? "0" : "1", } const cacheEnv = process.env.ELECTRON_BUILDER_CACHE diff --git a/packages/electron-builder-squirrel-windows/package.json b/packages/electron-builder-squirrel-windows/package.json index 34920d86575..1fe21cba53b 100644 --- a/packages/electron-builder-squirrel-windows/package.json +++ b/packages/electron-builder-squirrel-windows/package.json @@ -24,8 +24,5 @@ "@types/archiver": "5.3.1", "@types/fs-extra": "9.0.13" }, - "optionalDependencies": { - "7zip-bin": "~5.2.0" - }, "types": "./out/SquirrelWindowsTarget.d.ts" } diff --git a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts index c7a920de206..c2124370e73 100644 --- a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts +++ b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts @@ -1,13 +1,13 @@ -import { path7za } from "7zip-bin" import { Arch, debug, exec, log, spawn, isEmptyOrSpaces } from "builder-util" import { copyFile, walk } from "builder-util/out/fs" import { compute7zCompressArgs } from "app-builder-lib/out/targets/archive" import { execWine, prepareWindowsExecutableArgs as prepareArgs } from "app-builder-lib/out/wine" import { WinPackager } from "app-builder-lib/out/winPackager" -import { chmod, createWriteStream, stat, unlink, writeFile } from "fs-extra" +import { createWriteStream, stat, unlink, writeFile } from "fs-extra" import * as path from "path" import * as archiver from "archiver" import * as fs from "fs/promises" +import { getPath7za } from "builder-util-runtime" export function convertVersion(version: string): string { const parts = version.split("-") @@ -126,7 +126,7 @@ export class SquirrelBuilder { private async createEmbeddedArchiveFile(nupkgPath: string, dirToArchive: string) { const embeddedArchiveFile = await this.packager.getTempFile("setup.zip") - await chmod(path7za, 0o755) + const path7za = await getPath7za() await exec( path7za, compute7zCompressArgs("zip", { @@ -230,11 +230,10 @@ async function pack(options: SquirrelOptions, directory: string, updateFile: str } async function execSw(options: SquirrelOptions, args: Array) { - await chmod(path7za, 0o755) return exec(process.platform === "win32" ? path.join(options.vendorPath, "Update.com") : "mono", prepareArgs(args, path.join(options.vendorPath, "Update-Mono.exe")), { env: { ...process.env, - SZA_PATH: path7za, + SZA_PATH: await getPath7za(), }, }) } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 23573c6e5eb..a0535818abe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -101,9 +101,6 @@ importers: packages/app-builder-lib: dependencies: - 7zip-bin: - specifier: ~5.2.0 - version: 5.2.0 '@develar/schema-utils': specifier: ~2.6.5 version: 2.6.5 @@ -273,9 +270,6 @@ importers: packages/builder-util: dependencies: - 7zip-bin: - specifier: ~5.2.0 - version: 5.2.0 '@types/debug': specifier: ^4.1.6 version: 4.1.7 @@ -340,9 +334,15 @@ importers: packages/builder-util-runtime: dependencies: + 7zip-bin: + specifier: ~5.2.0 + version: 5.2.0 debug: specifier: ^4.3.4 version: 4.3.4 + fs-extra: + specifier: ^10.1.0 + version: 10.1.0 sax: specifier: ^1.2.4 version: 1.2.4 @@ -350,6 +350,9 @@ importers: '@types/debug': specifier: 4.1.7 version: 4.1.7 + '@types/fs-extra': + specifier: 9.0.13 + version: 9.0.13 '@types/sax': specifier: 1.2.3 version: 1.2.3 @@ -449,10 +452,6 @@ importers: fs-extra: specifier: ^10.1.0 version: 10.1.0 - optionalDependencies: - 7zip-bin: - specifier: ~5.2.0 - version: 5.2.0 devDependencies: '@types/archiver': specifier: 5.3.1 @@ -558,9 +557,6 @@ importers: test: dependencies: - 7zip-bin: - specifier: ~5.2.0 - version: 5.2.0 '@electron/osx-sign': specifier: ^1.0.4 version: 1.0.5 @@ -2746,7 +2742,7 @@ packages: /@types/fs-extra@9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 16.11.43 + '@types/node': 16.18.55 /@types/glob@8.1.0: resolution: {integrity: sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==} diff --git a/test/package.json b/test/package.json index eb3f2d848bf..e158cb2c47a 100644 --- a/test/package.json +++ b/test/package.json @@ -3,7 +3,6 @@ "version": "0.0.0", "private": true, "dependencies": { - "7zip-bin": "~5.2.0", "@electron/osx-sign": "^1.0.4", "@jest/core": "^27.5.1", "app-builder-lib": "workspace:*", diff --git a/test/src/helpers/packTester.ts b/test/src/helpers/packTester.ts index 36727635dbc..9823b977f38 100644 --- a/test/src/helpers/packTester.ts +++ b/test/src/helpers/packTester.ts @@ -1,6 +1,5 @@ -import { path7x, path7za } from "7zip-bin" import { addValue, deepAssign, exec, log, spawn } from "builder-util" -import { CancellationToken, UpdateFileInfo } from "builder-util-runtime" +import { CancellationToken, UpdateFileInfo, getPath7x, getPath7za } from "builder-util-runtime" import { copyDir, FileCopier, USE_HARD_LINKS, walk } from "builder-util/out/fs" import { executeFinally } from "builder-util/out/promise" import DecompressZip from "decompress-zip" @@ -10,7 +9,7 @@ import { computeArchToTargetNamesMap } from "app-builder-lib/out/targets/targetF import { getLinuxToolsPath } from "app-builder-lib/out/targets/tools" import { convertVersion } from "electron-builder-squirrel-windows/out/squirrelPack" import { PublishPolicy } from "electron-publish" -import { chmod, emptyDir, writeJson } from "fs-extra" +import { emptyDir, writeJson } from "fs-extra" import * as fs from "fs/promises" import { load } from "js-yaml" import * as path from "path" @@ -438,12 +437,11 @@ export async function getTarExecutable() { } async function getContents(packageFile: string) { - await chmod(path7x, 0o755) - const result = await execShell(`ar p '${packageFile}' data.tar.xz | ${await getTarExecutable()} -t -I'${path7x}'`, { + const result = await execShell(`ar p '${packageFile}' data.tar.xz | ${await getTarExecutable()} -t -I'${await getPath7x()}'`, { maxBuffer: 10 * 1024 * 1024, env: { ...process.env, - SZA_PATH: path7za, + SZA_PATH: await getPath7za(), }, }) From af5918f695787d0196fea70ef61bdb825cff7dbe Mon Sep 17 00:00:00 2001 From: Mike Maietta Date: Wed, 6 Dec 2023 16:48:37 -0800 Subject: [PATCH 2/7] add changeset --- .changeset/chilled-apricots-sit.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .changeset/chilled-apricots-sit.md diff --git a/.changeset/chilled-apricots-sit.md b/.changeset/chilled-apricots-sit.md new file mode 100644 index 00000000000..1c1cfcfee82 --- /dev/null +++ b/.changeset/chilled-apricots-sit.md @@ -0,0 +1,8 @@ +--- +"app-builder-lib": patch +"builder-util": patch +"builder-util-runtime": patch +"electron-builder-squirrel-windows": patch +--- + +chore: consolidating usages of `7zip-bin` to builder-util-runtime so as to execute `chmod` logic _always_ From dab03449aefc1cfdfc730b07f690b9e0c39092e0 Mon Sep 17 00:00:00 2001 From: Mike Maietta Date: Wed, 6 Dec 2023 16:51:14 -0800 Subject: [PATCH 3/7] update import --- packages/electron-builder-squirrel-windows/package.json | 1 + pnpm-lock.yaml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/packages/electron-builder-squirrel-windows/package.json b/packages/electron-builder-squirrel-windows/package.json index 1fe21cba53b..859c9a9787c 100644 --- a/packages/electron-builder-squirrel-windows/package.json +++ b/packages/electron-builder-squirrel-windows/package.json @@ -18,6 +18,7 @@ "app-builder-lib": "workspace:*", "archiver": "^5.3.1", "builder-util": "workspace:*", + "builder-util-runtime": "workspace:*", "fs-extra": "^10.1.0" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a0535818abe..dab2aa3b479 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -449,6 +449,9 @@ importers: builder-util: specifier: workspace:* version: link:../builder-util + builder-util-runtime: + specifier: workspace:* + version: link:../builder-util-runtime fs-extra: specifier: ^10.1.0 version: 10.1.0 From 9e20086b9fd3a2e02abee76bc73a446d87b18dc7 Mon Sep 17 00:00:00 2001 From: Mike Maietta Date: Thu, 7 Dec 2023 12:59:50 -0800 Subject: [PATCH 4/7] move helper to builder-util instead of runtime --- packages/app-builder-lib/src/targets/FpmTarget.ts | 2 +- packages/app-builder-lib/src/targets/archive.ts | 2 +- .../src/targets/nsis/NsisTarget.ts | 4 ++-- packages/builder-util-runtime/package.json | 3 --- packages/builder-util-runtime/src/index.ts | 1 - packages/builder-util-runtime/tsconfig.json | 2 +- packages/builder-util/package.json | 1 + .../src/7za.ts | 0 packages/builder-util/src/util.ts | 5 ++++- .../package.json | 1 - .../src/squirrelPack.ts | 3 +-- pnpm-lock.yaml | 15 +++------------ test/src/helpers/packTester.ts | 4 ++-- 13 files changed, 16 insertions(+), 27 deletions(-) rename packages/{builder-util-runtime => builder-util}/src/7za.ts (100%) diff --git a/packages/app-builder-lib/src/targets/FpmTarget.ts b/packages/app-builder-lib/src/targets/FpmTarget.ts index 075862bad45..bdd83080ced 100644 --- a/packages/app-builder-lib/src/targets/FpmTarget.ts +++ b/packages/app-builder-lib/src/targets/FpmTarget.ts @@ -17,7 +17,7 @@ import { getLinuxToolsPath } from "./tools" import { hashFile } from "../util/hash" import { ArtifactCreated } from "../packagerApi" import { getAppUpdatePublishConfiguration } from "../publish/PublishManager" -import { getPath7za } from "builder-util-runtime" +import { getPath7za } from "builder-util" interface FpmOptions { name: string diff --git a/packages/app-builder-lib/src/targets/archive.ts b/packages/app-builder-lib/src/targets/archive.ts index c74aa62507b..3bf60f82164 100644 --- a/packages/app-builder-lib/src/targets/archive.ts +++ b/packages/app-builder-lib/src/targets/archive.ts @@ -6,7 +6,7 @@ import { create, CreateOptions, FileOptions } from "tar" import { TmpDir } from "temp-file" import { CompressionLevel } from "../core" import { getLinuxToolsPath } from "./tools" -import { getPath7za } from "builder-util-runtime" +import { getPath7za } from "builder-util" /** @internal */ export async function tar( diff --git a/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts b/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts index f1edd468d92..8b4d33cdd26 100644 --- a/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts +++ b/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" -import { Arch, asArray, AsyncTaskManager, exec, executeAppBuilder, getPlatformIconFileName, InvalidConfigurationError, log, spawnAndWrite, use } from "builder-util" -import { CURRENT_APP_INSTALLER_FILE_NAME, CURRENT_APP_PACKAGE_FILE_NAME, getPath7za, PackageFileInfo, UUID } from "builder-util-runtime" +import { Arch, asArray, AsyncTaskManager, exec, executeAppBuilder, getPlatformIconFileName, InvalidConfigurationError, log, spawnAndWrite, use, getPath7za } from "builder-util" +import { CURRENT_APP_INSTALLER_FILE_NAME, CURRENT_APP_PACKAGE_FILE_NAME, PackageFileInfo, UUID } from "builder-util-runtime" import { exists, statOrNull, walk } from "builder-util/out/fs" import _debug from "debug" import * as fs from "fs" diff --git a/packages/builder-util-runtime/package.json b/packages/builder-util-runtime/package.json index 6ae89438777..e44ebe50f47 100644 --- a/packages/builder-util-runtime/package.json +++ b/packages/builder-util-runtime/package.json @@ -18,13 +18,10 @@ "node": ">=12.0.0" }, "dependencies": { - "7zip-bin": "~5.2.0", "debug": "^4.3.4", - "fs-extra": "^10.1.0", "sax": "^1.2.4" }, "devDependencies": { - "@types/fs-extra": "9.0.13", "@types/debug": "4.1.7", "@types/sax": "1.2.3" }, diff --git a/packages/builder-util-runtime/src/index.ts b/packages/builder-util-runtime/src/index.ts index 6e08e328fa8..b3d845ac8de 100644 --- a/packages/builder-util-runtime/src/index.ts +++ b/packages/builder-util-runtime/src/index.ts @@ -35,7 +35,6 @@ export { UUID } from "./uuid" export { ProgressCallbackTransform, ProgressInfo } from "./ProgressCallbackTransform" export { parseXml, XElement } from "./xml" export { BlockMap } from "./blockMapApi" -export { getPath7za, getPath7x } from "./7za" // nsis export const CURRENT_APP_INSTALLER_FILE_NAME = "installer.exe" diff --git a/packages/builder-util-runtime/tsconfig.json b/packages/builder-util-runtime/tsconfig.json index ccba996ab8d..7a8f09396ae 100644 --- a/packages/builder-util-runtime/tsconfig.json +++ b/packages/builder-util-runtime/tsconfig.json @@ -13,4 +13,4 @@ "include": [ "src/**/*.ts" ] -} \ No newline at end of file +} diff --git a/packages/builder-util/package.json b/packages/builder-util/package.json index 62e70a365ad..da2264a8010 100644 --- a/packages/builder-util/package.json +++ b/packages/builder-util/package.json @@ -15,6 +15,7 @@ "out" ], "dependencies": { + "7zip-bin": "~5.2.0", "@types/debug": "^4.1.6", "app-builder-bin": "4.0.0", "bluebird-lst": "^1.0.9", diff --git a/packages/builder-util-runtime/src/7za.ts b/packages/builder-util/src/7za.ts similarity index 100% rename from packages/builder-util-runtime/src/7za.ts rename to packages/builder-util/src/7za.ts diff --git a/packages/builder-util/src/util.ts b/packages/builder-util/src/util.ts index 7f0493dd747..9003a6504af 100644 --- a/packages/builder-util/src/util.ts +++ b/packages/builder-util/src/util.ts @@ -1,5 +1,5 @@ import { appBuilderPath } from "app-builder-bin" -import { getPath7za, safeStringifyJson } from "builder-util-runtime" +import { safeStringifyJson } from "builder-util-runtime" import * as chalk from "chalk" import { ChildProcess, execFile, ExecFileOptions, SpawnOptions } from "child_process" import { spawn as _spawn } from "cross-spawn" @@ -9,6 +9,7 @@ import { dump } from "js-yaml" import * as path from "path" import { debug, log } from "./log" import { install as installSourceMap } from "source-map-support" +import { getPath7za } from "./7za" if (process.env.JEST_WORKER_ID == null) { installSourceMap() @@ -26,6 +27,8 @@ export { asArray } from "builder-util-runtime" export { deepAssign } from "./deepAssign" +export { getPath7za, getPath7x } from "./7za" + export const debug7z = _debug("electron-builder:7z") export function serializeToYaml(object: any, skipInvalid = false, noRefs = false) { diff --git a/packages/electron-builder-squirrel-windows/package.json b/packages/electron-builder-squirrel-windows/package.json index 859c9a9787c..1fe21cba53b 100644 --- a/packages/electron-builder-squirrel-windows/package.json +++ b/packages/electron-builder-squirrel-windows/package.json @@ -18,7 +18,6 @@ "app-builder-lib": "workspace:*", "archiver": "^5.3.1", "builder-util": "workspace:*", - "builder-util-runtime": "workspace:*", "fs-extra": "^10.1.0" }, "devDependencies": { diff --git a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts index c2124370e73..6bc348aa944 100644 --- a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts +++ b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts @@ -1,4 +1,4 @@ -import { Arch, debug, exec, log, spawn, isEmptyOrSpaces } from "builder-util" +import { Arch, debug, exec, log, spawn, isEmptyOrSpaces, getPath7za } from "builder-util" import { copyFile, walk } from "builder-util/out/fs" import { compute7zCompressArgs } from "app-builder-lib/out/targets/archive" import { execWine, prepareWindowsExecutableArgs as prepareArgs } from "app-builder-lib/out/wine" @@ -7,7 +7,6 @@ import { createWriteStream, stat, unlink, writeFile } from "fs-extra" import * as path from "path" import * as archiver from "archiver" import * as fs from "fs/promises" -import { getPath7za } from "builder-util-runtime" export function convertVersion(version: string): string { const parts = version.split("-") diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dab2aa3b479..78a822d3b6b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -270,6 +270,9 @@ importers: packages/builder-util: dependencies: + 7zip-bin: + specifier: ~5.2.0 + version: 5.2.0 '@types/debug': specifier: ^4.1.6 version: 4.1.7 @@ -334,15 +337,9 @@ importers: packages/builder-util-runtime: dependencies: - 7zip-bin: - specifier: ~5.2.0 - version: 5.2.0 debug: specifier: ^4.3.4 version: 4.3.4 - fs-extra: - specifier: ^10.1.0 - version: 10.1.0 sax: specifier: ^1.2.4 version: 1.2.4 @@ -350,9 +347,6 @@ importers: '@types/debug': specifier: 4.1.7 version: 4.1.7 - '@types/fs-extra': - specifier: 9.0.13 - version: 9.0.13 '@types/sax': specifier: 1.2.3 version: 1.2.3 @@ -449,9 +443,6 @@ importers: builder-util: specifier: workspace:* version: link:../builder-util - builder-util-runtime: - specifier: workspace:* - version: link:../builder-util-runtime fs-extra: specifier: ^10.1.0 version: 10.1.0 diff --git a/test/src/helpers/packTester.ts b/test/src/helpers/packTester.ts index 9823b977f38..be636ab9554 100644 --- a/test/src/helpers/packTester.ts +++ b/test/src/helpers/packTester.ts @@ -1,5 +1,5 @@ -import { addValue, deepAssign, exec, log, spawn } from "builder-util" -import { CancellationToken, UpdateFileInfo, getPath7x, getPath7za } from "builder-util-runtime" +import { addValue, deepAssign, exec, log, spawn, getPath7x, getPath7za } from "builder-util" +import { CancellationToken, UpdateFileInfo } from "builder-util-runtime" import { copyDir, FileCopier, USE_HARD_LINKS, walk } from "builder-util/out/fs" import { executeFinally } from "builder-util/out/promise" import DecompressZip from "decompress-zip" From de2cd8559bd0cade5789943c34a6d0c1f820c473 Mon Sep 17 00:00:00 2001 From: Mike Maietta Date: Thu, 7 Dec 2023 13:06:59 -0800 Subject: [PATCH 5/7] making optional dependency because it was previously? --- packages/builder-util/package.json | 4 +++- pnpm-lock.yaml | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/builder-util/package.json b/packages/builder-util/package.json index da2264a8010..89900a53123 100644 --- a/packages/builder-util/package.json +++ b/packages/builder-util/package.json @@ -15,7 +15,6 @@ "out" ], "dependencies": { - "7zip-bin": "~5.2.0", "@types/debug": "^4.1.6", "app-builder-bin": "4.0.0", "bluebird-lst": "^1.0.9", @@ -32,6 +31,9 @@ "stat-mode": "^1.0.0", "temp-file": "^3.4.0" }, + "optionalDependencies": { + "7zip-bin": "~5.2.0" + }, "typings": "./out/util.d.ts", "devDependencies": { "@types/cross-spawn": "6.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 78a822d3b6b..d178b6dbcdf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -270,9 +270,6 @@ importers: packages/builder-util: dependencies: - 7zip-bin: - specifier: ~5.2.0 - version: 5.2.0 '@types/debug': specifier: ^4.1.6 version: 4.1.7 @@ -318,6 +315,10 @@ importers: temp-file: specifier: ^3.4.0 version: 3.4.0 + optionalDependencies: + 7zip-bin: + specifier: ~5.2.0 + version: 5.2.0 devDependencies: '@types/cross-spawn': specifier: 6.0.2 @@ -647,7 +648,9 @@ packages: /7zip-bin@5.2.0: resolution: {integrity: sha512-ukTPVhqG4jNzMro2qA9HSCSSVJN3aN7tlb+hfqYCt3ER0yWroeA2VR38MNrOHLQ/cVj+DaIMad0kFCtWWowh/A==} + requiresBuild: true dev: false + optional: true /@aashutoshrathi/word-wrap@1.2.6: resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==} From 6d8bae10c39eadb865179e1c37c24cfadcf0dd52 Mon Sep 17 00:00:00 2001 From: Mike Maietta Date: Thu, 7 Dec 2023 15:26:45 -0800 Subject: [PATCH 6/7] revert --- packages/builder-util/package.json | 4 +--- pnpm-lock.yaml | 8 +++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/builder-util/package.json b/packages/builder-util/package.json index 89900a53123..da2264a8010 100644 --- a/packages/builder-util/package.json +++ b/packages/builder-util/package.json @@ -15,6 +15,7 @@ "out" ], "dependencies": { + "7zip-bin": "~5.2.0", "@types/debug": "^4.1.6", "app-builder-bin": "4.0.0", "bluebird-lst": "^1.0.9", @@ -31,9 +32,6 @@ "stat-mode": "^1.0.0", "temp-file": "^3.4.0" }, - "optionalDependencies": { - "7zip-bin": "~5.2.0" - }, "typings": "./out/util.d.ts", "devDependencies": { "@types/cross-spawn": "6.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d178b6dbcdf..71dce96b222 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -270,6 +270,9 @@ importers: packages/builder-util: dependencies: + 7zip-bin: + specifier: ~5.2.0 + version: 5.2.0 '@types/debug': specifier: ^4.1.6 version: 4.1.7 @@ -315,10 +318,6 @@ importers: temp-file: specifier: ^3.4.0 version: 3.4.0 - optionalDependencies: - 7zip-bin: - specifier: ~5.2.0 - version: 5.2.0 devDependencies: '@types/cross-spawn': specifier: 6.0.2 @@ -650,7 +649,6 @@ packages: resolution: {integrity: sha512-ukTPVhqG4jNzMro2qA9HSCSSVJN3aN7tlb+hfqYCt3ER0yWroeA2VR38MNrOHLQ/cVj+DaIMad0kFCtWWowh/A==} requiresBuild: true dev: false - optional: true /@aashutoshrathi/word-wrap@1.2.6: resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==} From 441ca72d488f4d4b2e9363412e315c3d8d9c302a Mon Sep 17 00:00:00 2001 From: Mike Maietta Date: Thu, 7 Dec 2023 15:42:54 -0800 Subject: [PATCH 7/7] cleanup --- .changeset/chilled-apricots-sit.md | 1 - packages/builder-util-runtime/tsconfig.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.changeset/chilled-apricots-sit.md b/.changeset/chilled-apricots-sit.md index 1c1cfcfee82..94da1d46c5f 100644 --- a/.changeset/chilled-apricots-sit.md +++ b/.changeset/chilled-apricots-sit.md @@ -1,7 +1,6 @@ --- "app-builder-lib": patch "builder-util": patch -"builder-util-runtime": patch "electron-builder-squirrel-windows": patch --- diff --git a/packages/builder-util-runtime/tsconfig.json b/packages/builder-util-runtime/tsconfig.json index 7a8f09396ae..ccba996ab8d 100644 --- a/packages/builder-util-runtime/tsconfig.json +++ b/packages/builder-util-runtime/tsconfig.json @@ -13,4 +13,4 @@ "include": [ "src/**/*.ts" ] -} +} \ No newline at end of file