diff --git a/.changeset/fluffy-wolves-smile.md b/.changeset/fluffy-wolves-smile.md new file mode 100644 index 00000000000..4640d23ee87 --- /dev/null +++ b/.changeset/fluffy-wolves-smile.md @@ -0,0 +1,10 @@ +--- +"app-builder-lib": patch +"builder-util": patch +"dmg-builder": patch +"electron-builder": patch +"electron-builder-squirrel-windows": patch +"electron-publish": patch +--- + +chore: refactor files for publishing to electron-publish diff --git a/mkdocs.yml b/mkdocs.yml index 6682d083bce..aa719e9b6ed 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -86,6 +86,7 @@ nav: - electron-builder: electron-builder/globals.md - app-builder-lib: app-builder-lib/globals.md - electron-updater: electron-updater/globals.md + - electron-publish: electron-publish/globals.md - Configuration: - Common Configuration: configuration.md diff --git a/packages/app-builder-lib/package.json b/packages/app-builder-lib/package.json index 99b6f42f67d..a83c0af8a13 100644 --- a/packages/app-builder-lib/package.json +++ b/packages/app-builder-lib/package.json @@ -66,7 +66,6 @@ "dotenv-expand": "^11.0.6", "ejs": "^3.1.8", "electron-publish": "workspace:*", - "form-data": "^4.0.0", "fs-extra": "^10.1.0", "hosted-git-info": "^4.1.0", "is-ci": "^3.0.0", @@ -76,7 +75,6 @@ "lazy-val": "^1.0.5", "minimatch": "^10.0.0", "resedit": "^1.7.0", - "sanitize-filename": "^1.6.3", "semver": "^7.3.8", "tar": "^6.1.12", "temp-file": "^3.4.0" diff --git a/packages/app-builder-lib/scheme.json b/packages/app-builder-lib/scheme.json index 1de899a15ae..6c70de56c35 100644 --- a/packages/app-builder-lib/scheme.json +++ b/packages/app-builder-lib/scheme.json @@ -1965,7 +1965,8 @@ "string" ] } - ] + ], + "description": "Publisher configuration. See [Auto Update](./publish.md) for more information." }, "releaseInfo": { "$ref": "#/definitions/ReleaseInfo", @@ -2742,7 +2743,8 @@ "string" ] } - ] + ], + "description": "Publisher configuration. See [Auto Update](./publish.md) for more information." }, "releaseInfo": { "$ref": "#/definitions/ReleaseInfo", @@ -3383,7 +3385,8 @@ "string" ] } - ] + ], + "description": "Publisher configuration. See [Auto Update](./publish.md) for more information." }, "releaseInfo": { "$ref": "#/definitions/ReleaseInfo", @@ -6453,7 +6456,8 @@ "string" ] } - ] + ], + "description": "Publisher configuration. See [Auto Update](./publish.md) for more information." }, "publisherName": { "anyOf": [ @@ -7547,7 +7551,8 @@ "string" ] } - ] + ], + "description": "Publisher configuration. See [Auto Update](./publish.md) for more information." }, "releaseInfo": { "$ref": "#/definitions/ReleaseInfo", diff --git a/packages/app-builder-lib/src/appInfo.ts b/packages/app-builder-lib/src/appInfo.ts index 9c3e0fed5a9..95f6bbec845 100644 --- a/packages/app-builder-lib/src/appInfo.ts +++ b/packages/app-builder-lib/src/appInfo.ts @@ -3,7 +3,7 @@ import { prerelease } from "semver" import { PlatformSpecificBuildOptions } from "./options/PlatformSpecificBuildOptions" import { Packager } from "./packager" import { expandMacro } from "./util/macroExpander" -import { sanitizeFileName } from "./util/filename" +import { sanitizeFileName } from "builder-util/out/filename" // fpm bug - rpm build --description is not escaped, well... decided to replace quite to smart quote // http://leancrew.com/all-this/2010/11/smart-quotes-in-javascript/ diff --git a/packages/app-builder-lib/src/index.ts b/packages/app-builder-lib/src/index.ts index 73bc8794b9f..5d5ba0baf13 100644 --- a/packages/app-builder-lib/src/index.ts +++ b/packages/app-builder-lib/src/index.ts @@ -1,4 +1,4 @@ -import { PublishOptions } from "electron-publish/out/publisher" +import { PublishOptions } from "electron-publish" import { log, InvalidConfigurationError, executeFinally } from "builder-util" import { asArray } from "builder-util-runtime" import { Packager } from "./packager" diff --git a/packages/app-builder-lib/src/linuxPackager.ts b/packages/app-builder-lib/src/linuxPackager.ts index a3c6fb862f0..055ac42b7ca 100644 --- a/packages/app-builder-lib/src/linuxPackager.ts +++ b/packages/app-builder-lib/src/linuxPackager.ts @@ -9,7 +9,7 @@ import FpmTarget from "./targets/FpmTarget" import { LinuxTargetHelper } from "./targets/LinuxTargetHelper" import SnapTarget from "./targets/snap" import { createCommonTarget } from "./targets/targetFactory" -import { sanitizeFileName } from "./util/filename" +import { sanitizeFileName } from "builder-util/out/filename" export class LinuxPackager extends PlatformPackager { readonly executableName: string diff --git a/packages/app-builder-lib/src/options/CommonWindowsInstallerConfiguration.ts b/packages/app-builder-lib/src/options/CommonWindowsInstallerConfiguration.ts index 66ce3d27aa1..af503c8ae0d 100644 --- a/packages/app-builder-lib/src/options/CommonWindowsInstallerConfiguration.ts +++ b/packages/app-builder-lib/src/options/CommonWindowsInstallerConfiguration.ts @@ -1,5 +1,5 @@ import { InvalidConfigurationError, isEmptyOrSpaces } from "builder-util" -import { sanitizeFileName } from "../util/filename" +import { sanitizeFileName } from "builder-util/out/filename" import { WinPackager } from "../winPackager" export interface CommonWindowsInstallerConfiguration { diff --git a/packages/app-builder-lib/src/options/PlatformSpecificBuildOptions.ts b/packages/app-builder-lib/src/options/PlatformSpecificBuildOptions.ts index be1fdb1b73e..ea56efd8e8b 100644 --- a/packages/app-builder-lib/src/options/PlatformSpecificBuildOptions.ts +++ b/packages/app-builder-lib/src/options/PlatformSpecificBuildOptions.ts @@ -163,6 +163,9 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions, Fil */ readonly electronUpdaterCompatibility?: string | null + /** + * Publisher configuration. See [Auto Update](./publish.md) for more information. + */ publish?: Publish /** diff --git a/packages/app-builder-lib/src/publish/PublishManager.ts b/packages/app-builder-lib/src/publish/PublishManager.ts index e97edf5d4ee..6f4a7dbb19b 100644 --- a/packages/app-builder-lib/src/publish/PublishManager.ts +++ b/packages/app-builder-lib/src/publish/PublishManager.ts @@ -13,11 +13,19 @@ import { BitbucketOptions, } from "builder-util-runtime" import _debug from "debug" -import { getCiTag, PublishContext, Publisher, PublishOptions, UploadTask } from "electron-publish" -import { GitHubPublisher } from "electron-publish/out/gitHubPublisher" -import { MultiProgress } from "electron-publish/out/multiProgress" -import S3Publisher from "./s3/s3Publisher" -import SpacesPublisher from "./s3/spacesPublisher" +import { + BitbucketPublisher, + getCiTag, + GitHubPublisher, + KeygenPublisher, + PublishContext, + Publisher, + PublishOptions, + S3Publisher, + SnapStorePublisher, + SpacesPublisher, + UploadTask, +} from "electron-publish" import { writeFile } from "fs/promises" import * as isCi from "is-ci" import * as path from "path" @@ -28,10 +36,8 @@ import { Packager } from "../packager" import { PlatformPackager } from "../platformPackager" import { expandMacro } from "../util/macroExpander" import { WinPackager } from "../winPackager" -import { SnapStorePublisher } from "./SnapStorePublisher" import { createUpdateInfoTasks, UpdateInfoFileTask, writeUpdateInfoFiles } from "./updateInfoBuilder" -import { KeygenPublisher } from "./KeygenPublisher" -import { BitbucketPublisher } from "./BitbucketPublisher" +import { MultiProgress } from "electron-publish/out/multiProgress" const publishForPrWarning = "There are serious security concerns with PUBLISH_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)" + diff --git a/packages/builder-util/package.json b/packages/builder-util/package.json index 0fda1f80a8a..880dd48f56f 100644 --- a/packages/builder-util/package.json +++ b/packages/builder-util/package.json @@ -28,6 +28,7 @@ "https-proxy-agent": "^7.0.0", "is-ci": "^3.0.0", "js-yaml": "^4.1.0", + "sanitize-filename": "^1.6.3", "source-map-support": "^0.5.19", "stat-mode": "^1.0.0", "temp-file": "^3.4.0" diff --git a/packages/app-builder-lib/src/util/filename.ts b/packages/builder-util/src/filename.ts similarity index 100% rename from packages/app-builder-lib/src/util/filename.ts rename to packages/builder-util/src/filename.ts diff --git a/packages/dmg-builder/src/dmg.ts b/packages/dmg-builder/src/dmg.ts index 9948b8ce980..7a808b333c1 100644 --- a/packages/dmg-builder/src/dmg.ts +++ b/packages/dmg-builder/src/dmg.ts @@ -3,7 +3,7 @@ import { findIdentity, isSignAllowed } from "app-builder-lib/out/codeSign/macCod import { MacPackager } from "app-builder-lib/out/macPackager" import { createBlockmap } from "app-builder-lib/out/targets/differentialUpdateInfoBuilder" import { executeAppBuilderAsJson } from "app-builder-lib/out/util/appBuilder" -import { sanitizeFileName } from "app-builder-lib/out/util/filename" +import { sanitizeFileName } from "builder-util/out/filename" import { Arch, AsyncTaskManager, exec, getArchSuffix, InvalidConfigurationError, isEmptyOrSpaces, log, copyDir, copyFile, exists, statOrNull } from "builder-util" import { CancellationToken } from "builder-util-runtime" import { stat } from "fs-extra" diff --git a/packages/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts b/packages/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts index f0f273330f6..1a698f703ce 100644 --- a/packages/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts +++ b/packages/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts @@ -1,4 +1,4 @@ -import { sanitizeFileName } from "app-builder-lib/out/util/filename" +import { sanitizeFileName } from "builder-util/out/filename" import { InvalidConfigurationError, log, isEmptyOrSpaces } from "builder-util" import { getBinFromUrl } from "app-builder-lib/out/binDownload" import { Arch, getArchSuffix, SquirrelWindowsOptions, Target } from "app-builder-lib" diff --git a/packages/electron-builder/src/cli/create-self-signed-cert.ts b/packages/electron-builder/src/cli/create-self-signed-cert.ts index 7d2bdda7d3c..340be4f7541 100644 --- a/packages/electron-builder/src/cli/create-self-signed-cert.ts +++ b/packages/electron-builder/src/cli/create-self-signed-cert.ts @@ -1,4 +1,4 @@ -import { sanitizeFileName } from "app-builder-lib/out/util/filename" +import { sanitizeFileName } from "builder-util/out/filename" import { exec, log, spawn, TmpDir, unlinkIfExists } from "builder-util" import * as chalk from "chalk" import { getSignVendorPath } from "app-builder-lib/out/codeSign/windowsSignToolManager" diff --git a/packages/electron-builder/src/publish.ts b/packages/electron-builder/src/publish.ts index da2bd97743a..d731398a6d9 100644 --- a/packages/electron-builder/src/publish.ts +++ b/packages/electron-builder/src/publish.ts @@ -40,14 +40,14 @@ export function configurePublishCommand(yargs: yargs.Argv): yargs.Argv { .demandOption("files") } -export async function publish(args: { files: string[]; version: string | undefined; config: string | undefined }) { +export async function publish(args: { files: string[]; version: string | undefined; configurationFilePath: string | undefined }) { const uploadTasks = args.files.map(f => { return { file: path.resolve(f), arch: null, } }) - return publishArtifactsWithOptions(uploadTasks, args.version, args.config) + return publishArtifactsWithOptions(uploadTasks, args.version, args.configurationFilePath) } export async function publishArtifactsWithOptions( diff --git a/packages/electron-publish/package.json b/packages/electron-publish/package.json index 535a22c5d74..b9454f2d578 100644 --- a/packages/electron-publish/package.json +++ b/packages/electron-publish/package.json @@ -1,7 +1,7 @@ { "name": "electron-publish", "version": "26.0.0-alpha.1", - "main": "out/publisher.js", + "main": "out/index.js", "author": "Vladimir Krivosheev", "license": "MIT", "repository": { @@ -19,11 +19,12 @@ "builder-util": "workspace:*", "builder-util-runtime": "workspace:*", "chalk": "^4.1.2", + "form-data": "^4.0.0", "fs-extra": "^10.1.0", "lazy-val": "^1.0.5", "mime": "^2.5.2" }, - "typings": "./out/publisher.d.ts", + "typings": "./out/index.d.ts", "devDependencies": { "@types/mime": "2.0.3" } diff --git a/packages/app-builder-lib/src/publish/BitbucketPublisher.ts b/packages/electron-publish/src/bitbucketPublisher.ts similarity index 97% rename from packages/app-builder-lib/src/publish/BitbucketPublisher.ts rename to packages/electron-publish/src/bitbucketPublisher.ts index c6ea059de7a..6b79bc2f6bf 100644 --- a/packages/app-builder-lib/src/publish/BitbucketPublisher.ts +++ b/packages/electron-publish/src/bitbucketPublisher.ts @@ -1,7 +1,8 @@ import { Arch, InvalidConfigurationError, isEmptyOrSpaces, log } from "builder-util" import { httpExecutor } from "builder-util" import { ClientRequest, RequestOptions } from "http" -import { HttpPublisher, PublishContext } from "electron-publish" +import { PublishContext } from "./" +import { HttpPublisher } from "./httpPublisher" import { BitbucketOptions } from "builder-util-runtime/out/publishOptions" import { configureRequestOptions, HttpExecutor } from "builder-util-runtime" import * as FormData from "form-data" diff --git a/packages/electron-publish/src/gitHubPublisher.ts b/packages/electron-publish/src/gitHubPublisher.ts index d634af0b890..18dab54ac3e 100644 --- a/packages/electron-publish/src/gitHubPublisher.ts +++ b/packages/electron-publish/src/gitHubPublisher.ts @@ -5,7 +5,9 @@ import { ClientRequest } from "http" import { Lazy } from "lazy-val" import * as mime from "mime" import { parse as parseUrl, UrlWithStringQuery } from "url" -import { getCiTag, HttpPublisher, PublishContext, PublishOptions } from "./publisher" +import { getCiTag } from "./publisher" +import { HttpPublisher } from "./httpPublisher" +import { PublishContext, PublishOptions } from "./index" export interface Release { id: number diff --git a/packages/electron-publish/src/httpPublisher.ts b/packages/electron-publish/src/httpPublisher.ts new file mode 100644 index 00000000000..e744eb8d112 --- /dev/null +++ b/packages/electron-publish/src/httpPublisher.ts @@ -0,0 +1,69 @@ +import { Arch } from "builder-util" +import { stat } from "fs-extra" +import { ClientRequest } from "http" +import { basename } from "path/posix" +import { Publisher } from "./publisher" +import { PublishContext, UploadTask } from "." + +export abstract class HttpPublisher extends Publisher { + protected constructor( + protected readonly context: PublishContext, + private readonly useSafeArtifactName = false + ) { + super(context) + } + + async upload(task: UploadTask): Promise { + const fileName = (this.useSafeArtifactName ? task.safeArtifactName : null) || basename(task.file) + + if (task.fileContent != null) { + await this.doUpload( + fileName, + task.arch || Arch.x64, + task.fileContent.length, + (request, reject) => { + if (task.timeout) { + request.setTimeout(task.timeout, () => { + request.destroy() + reject(new Error("Request timed out")) + }) + } + return request.end(task.fileContent) + }, + task.file + ) + return + } + + const fileStat = await stat(task.file) + + const progressBar = this.createProgressBar(fileName, fileStat.size) + return this.doUpload( + fileName, + task.arch || Arch.x64, + fileStat.size, + (request, reject) => { + if (progressBar != null) { + // reset (because can be called several times (several attempts) + progressBar.update(0) + } + if (task.timeout) { + request.setTimeout(task.timeout, () => { + request.destroy() + reject(new Error("Request timed out")) + }) + } + return this.createReadStreamAndProgressBar(task.file, fileStat, progressBar, reject).pipe(request) + }, + task.file + ) + } + + protected abstract doUpload( + fileName: string, + arch: Arch, + dataLength: number, + requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void, + file: string + ): Promise +} diff --git a/packages/electron-publish/src/index.ts b/packages/electron-publish/src/index.ts new file mode 100644 index 00000000000..b6566708ec4 --- /dev/null +++ b/packages/electron-publish/src/index.ts @@ -0,0 +1,35 @@ +import { CancellationToken } from "builder-util-runtime" +import { MultiProgress } from "./multiProgress" +import { Arch } from "builder-util" + +export { SpacesPublisher } from "./s3/spacesPublisher" +export { KeygenPublisher } from "./keygenPublisher" +export { SnapStorePublisher } from "./snapStorePublisher" +export { S3Publisher } from "./s3/s3Publisher" +export { GitHubPublisher } from "./gitHubPublisher" +export { BitbucketPublisher } from "./bitbucketPublisher" + +export type PublishPolicy = "onTag" | "onTagOrDraft" | "always" | "never" + +export { ProgressCallback } from "./progress" + +export interface PublishOptions { + publish?: PublishPolicy | null +} + +export { Publisher, getCiTag } from "./publisher" +export { HttpPublisher } from "./httpPublisher" + +export interface PublishContext { + readonly cancellationToken: CancellationToken + readonly progress: MultiProgress | null +} + +export interface UploadTask { + file: string + fileContent?: Buffer | null + + arch: Arch | null + safeArtifactName?: string | null + timeout?: number | null +} diff --git a/packages/app-builder-lib/src/publish/KeygenPublisher.ts b/packages/electron-publish/src/keygenPublisher.ts similarity index 98% rename from packages/app-builder-lib/src/publish/KeygenPublisher.ts rename to packages/electron-publish/src/keygenPublisher.ts index 7fe58f25170..8be78963e7d 100644 --- a/packages/app-builder-lib/src/publish/KeygenPublisher.ts +++ b/packages/electron-publish/src/keygenPublisher.ts @@ -1,10 +1,11 @@ import { Arch, InvalidConfigurationError, log, isEmptyOrSpaces } from "builder-util" import { httpExecutor } from "builder-util" import { ClientRequest, RequestOptions } from "http" -import { HttpPublisher, PublishContext } from "electron-publish" +import { PublishContext } from "./" +import { HttpPublisher } from "./httpPublisher" import { KeygenOptions } from "builder-util-runtime/out/publishOptions" import { configureRequestOptions, HttpExecutor, parseJson } from "builder-util-runtime" -import { getCompleteExtname } from "../util/filename" +import { getCompleteExtname } from "builder-util/out/filename" type RecursivePartial = { [P in keyof T]?: RecursivePartial diff --git a/packages/electron-publish/src/publisher.ts b/packages/electron-publish/src/publisher.ts index 4be0129ce3d..edf8a6440d3 100644 --- a/packages/electron-publish/src/publisher.ts +++ b/packages/electron-publish/src/publisher.ts @@ -1,39 +1,15 @@ -import { Arch, log, PADDING } from "builder-util" -import { CancellationToken, ProgressCallbackTransform, PublishProvider } from "builder-util-runtime" +import { log, PADDING } from "builder-util" +import { ProgressCallbackTransform, PublishProvider } from "builder-util-runtime" import * as chalk from "chalk" -import { createReadStream, stat, Stats } from "fs-extra" -import { ClientRequest } from "http" -import { basename } from "path" -import { MultiProgress } from "./multiProgress" +import { createReadStream, Stats } from "fs-extra" import { ProgressBar } from "./progress" - -export type PublishPolicy = "onTag" | "onTagOrDraft" | "always" | "never" - -export { ProgressCallback } from "./progress" - -export interface PublishOptions { - publish?: PublishPolicy | null -} - -export interface PublishContext { - readonly cancellationToken: CancellationToken - readonly progress: MultiProgress | null -} +import { PublishContext, UploadTask } from "." const progressBarOptions = { incomplete: " ", width: 20, } -export interface UploadTask { - file: string - fileContent?: Buffer | null - - arch: Arch | null - safeArtifactName?: string | null - timeout?: number | null -} - export abstract class Publisher { protected constructor(protected readonly context: PublishContext) {} @@ -68,69 +44,6 @@ export abstract class Publisher { abstract toString(): string } -export abstract class HttpPublisher extends Publisher { - protected constructor( - protected readonly context: PublishContext, - private readonly useSafeArtifactName = false - ) { - super(context) - } - - async upload(task: UploadTask): Promise { - const fileName = (this.useSafeArtifactName ? task.safeArtifactName : null) || basename(task.file) - - if (task.fileContent != null) { - await this.doUpload( - fileName, - task.arch || Arch.x64, - task.fileContent.length, - (request, reject) => { - if (task.timeout) { - request.setTimeout(task.timeout, () => { - request.destroy() - reject(new Error("Request timed out")) - }) - } - return request.end(task.fileContent) - }, - task.file - ) - return - } - - const fileStat = await stat(task.file) - - const progressBar = this.createProgressBar(fileName, fileStat.size) - return this.doUpload( - fileName, - task.arch || Arch.x64, - fileStat.size, - (request, reject) => { - if (progressBar != null) { - // reset (because can be called several times (several attempts) - progressBar.update(0) - } - if (task.timeout) { - request.setTimeout(task.timeout, () => { - request.destroy() - reject(new Error("Request timed out")) - }) - } - return this.createReadStreamAndProgressBar(task.file, fileStat, progressBar, reject).pipe(request) - }, - task.file - ) - } - - protected abstract doUpload( - fileName: string, - arch: Arch, - dataLength: number, - requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void, - file: string - ): Promise -} - export function getCiTag() { const tag = process.env.TRAVIS_TAG || diff --git a/packages/app-builder-lib/src/publish/s3/BaseS3Publisher.ts b/packages/electron-publish/src/s3/baseS3Publisher.ts similarity index 96% rename from packages/app-builder-lib/src/publish/s3/BaseS3Publisher.ts rename to packages/electron-publish/src/s3/baseS3Publisher.ts index e1f418838ac..40240c93e0d 100644 --- a/packages/app-builder-lib/src/publish/s3/BaseS3Publisher.ts +++ b/packages/electron-publish/src/s3/baseS3Publisher.ts @@ -1,8 +1,9 @@ import { log, executeAppBuilder } from "builder-util" import { BaseS3Options } from "builder-util-runtime" -import { PublishContext, Publisher, UploadTask } from "electron-publish" import { mkdir, symlink } from "fs/promises" import * as path from "path" +import { PublishContext, UploadTask } from ".." +import { Publisher } from "../publisher" export abstract class BaseS3Publisher extends Publisher { protected constructor( diff --git a/packages/app-builder-lib/src/publish/s3/s3Publisher.ts b/packages/electron-publish/src/s3/s3Publisher.ts similarity index 93% rename from packages/app-builder-lib/src/publish/s3/s3Publisher.ts rename to packages/electron-publish/src/s3/s3Publisher.ts index 17a8cced9f6..5826123fbf0 100644 --- a/packages/app-builder-lib/src/publish/s3/s3Publisher.ts +++ b/packages/electron-publish/src/s3/s3Publisher.ts @@ -1,9 +1,9 @@ import { executeAppBuilder, InvalidConfigurationError, log } from "builder-util" +import { BaseS3Publisher } from "./baseS3Publisher" import { S3Options } from "builder-util-runtime" -import { PublishContext } from "electron-publish" -import { BaseS3Publisher } from "./BaseS3Publisher" +import { PublishContext } from ".." -export default class S3Publisher extends BaseS3Publisher { +export class S3Publisher extends BaseS3Publisher { readonly providerName = "s3" constructor( diff --git a/packages/app-builder-lib/src/publish/s3/spacesPublisher.ts b/packages/electron-publish/src/s3/spacesPublisher.ts similarity index 91% rename from packages/app-builder-lib/src/publish/s3/spacesPublisher.ts rename to packages/electron-publish/src/s3/spacesPublisher.ts index c46cb07f1f1..d5149602910 100644 --- a/packages/app-builder-lib/src/publish/s3/spacesPublisher.ts +++ b/packages/electron-publish/src/s3/spacesPublisher.ts @@ -1,9 +1,9 @@ import { InvalidConfigurationError, isEmptyOrSpaces } from "builder-util" import { SpacesOptions } from "builder-util-runtime" -import { PublishContext } from "electron-publish" -import { BaseS3Publisher } from "./BaseS3Publisher" +import { PublishContext } from "../" +import { BaseS3Publisher } from "./baseS3Publisher" -export default class SpacesPublisher extends BaseS3Publisher { +export class SpacesPublisher extends BaseS3Publisher { readonly providerName = "spaces" constructor( diff --git a/packages/app-builder-lib/src/publish/SnapStorePublisher.ts b/packages/electron-publish/src/snapStorePublisher.ts similarity index 91% rename from packages/app-builder-lib/src/publish/SnapStorePublisher.ts rename to packages/electron-publish/src/snapStorePublisher.ts index ca9e02f99cf..f3e0d599704 100644 --- a/packages/app-builder-lib/src/publish/SnapStorePublisher.ts +++ b/packages/electron-publish/src/snapStorePublisher.ts @@ -1,7 +1,8 @@ -import { Publisher, UploadTask, PublishContext } from "electron-publish" import { executeAppBuilder } from "builder-util" import * as path from "path" import { SnapStoreOptions } from "builder-util-runtime/out/publishOptions" +import { PublishContext, UploadTask } from "." +import { Publisher } from "./publisher" export class SnapStorePublisher extends Publisher { readonly providerName = "snapStore" diff --git a/packages/electron-publish/tsconfig.json b/packages/electron-publish/tsconfig.json index 76e15a61b0f..1d0ee3793fa 100644 --- a/packages/electron-publish/tsconfig.json +++ b/packages/electron-publish/tsconfig.json @@ -13,7 +13,7 @@ } ], "jsdoc": { - "out": "../../scripts/jsdoc/out/publisher", + "out": "../../scripts/jsdoc/out/index", "access": "public" }, "include": [ diff --git a/packages/electron-publish/typedoc.json b/packages/electron-publish/typedoc.json index c4891d94ab3..8157ef6b283 100644 --- a/packages/electron-publish/typedoc.json +++ b/packages/electron-publish/typedoc.json @@ -1,5 +1,5 @@ { "$schema": "https://typedoc.org/schema.json", "includeVersion": true, - "entryPoints": ["src/publisher.ts"] + "entryPoints": ["src/index.ts"] } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aa0777c36a6..caf52373e6f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -140,9 +140,6 @@ importers: electron-publish: specifier: workspace:* version: link:../electron-publish - form-data: - specifier: ^4.0.0 - version: 4.0.0 fs-extra: specifier: ^10.1.0 version: 10.1.0 @@ -170,9 +167,6 @@ importers: resedit: specifier: ^1.7.0 version: 1.7.1 - sanitize-filename: - specifier: ^1.6.3 - version: 1.6.3 semver: specifier: ^7.3.8 version: 7.6.0 @@ -312,6 +306,9 @@ importers: js-yaml: specifier: ^4.1.0 version: 4.1.0 + sanitize-filename: + specifier: ^1.6.3 + version: 1.6.3 source-map-support: specifier: ^0.5.19 version: 0.5.21 @@ -492,6 +489,9 @@ importers: chalk: specifier: ^4.1.2 version: 4.1.2 + form-data: + specifier: ^4.0.0 + version: 4.0.0 fs-extra: specifier: ^10.1.0 version: 10.1.0 @@ -3243,15 +3243,6 @@ packages: supports-color: optional: true - debug@4.3.5: - resolution: {integrity: sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - debug@4.3.7: resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} engines: {node: '>=6.0'} @@ -7787,7 +7778,7 @@ snapshots: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.24.0 '@babel/types': 7.24.0 - debug: 4.3.5 + debug: 4.3.7 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -8079,7 +8070,7 @@ snapshots: '@electron/notarize@2.5.0': dependencies: - debug: 4.3.5 + debug: 4.3.7 fs-extra: 9.1.0 promise-retry: 2.0.1 transitivePeerDependencies: @@ -8088,7 +8079,7 @@ snapshots: '@electron/osx-sign@1.0.5': dependencies: compare-version: 0.1.2 - debug: 4.3.4 + debug: 4.3.7 fs-extra: 10.1.0 isbinaryfile: 4.0.10 minimist: 1.2.8 @@ -8099,7 +8090,7 @@ snapshots: '@electron/osx-sign@1.3.1': dependencies: compare-version: 0.1.2 - debug: 4.3.5 + debug: 4.3.7 fs-extra: 10.1.0 isbinaryfile: 4.0.10 minimist: 1.2.8 @@ -8131,7 +8122,7 @@ snapshots: dependencies: '@electron/asar': 3.2.13 '@malept/cross-spawn-promise': 2.0.0 - debug: 4.3.4 + debug: 4.3.7 dir-compare: 4.2.0 fs-extra: 11.2.0 minimatch: 9.0.3 @@ -8425,7 +8416,7 @@ snapshots: '@malept/flatpak-bundler@0.4.0': dependencies: - debug: 4.3.4 + debug: 4.3.7 fs-extra: 9.1.0 lodash: 4.17.21 tmp-promise: 3.0.3 @@ -9693,10 +9684,6 @@ snapshots: dependencies: ms: 2.1.2 - debug@4.3.5: - dependencies: - ms: 2.1.2 - debug@4.3.7: dependencies: ms: 2.1.3 @@ -9770,7 +9757,7 @@ snapshots: '@vue/compiler-sfc': 3.4.21 camelcase: 6.3.0 cosmiconfig: 7.1.0 - debug: 4.3.4 + debug: 4.3.7 deps-regex: 0.1.4 ignore: 5.3.1 is-core-module: 2.13.1 @@ -10562,7 +10549,7 @@ snapshots: http-proxy-agent@7.0.2: dependencies: agent-base: 7.1.1 - debug: 4.3.5 + debug: 4.3.7 transitivePeerDependencies: - supports-color @@ -10581,7 +10568,7 @@ snapshots: https-proxy-agent@7.0.5: dependencies: agent-base: 7.1.1 - debug: 4.3.5 + debug: 4.3.7 transitivePeerDependencies: - supports-color @@ -12357,7 +12344,7 @@ snapshots: simple-update-notifier@2.0.0: dependencies: - semver: 7.6.0 + semver: 7.6.3 sisteransi@1.0.5: {} diff --git a/test/src/ArtifactPublisherTest.ts b/test/src/ArtifactPublisherTest.ts index 069845a8091..8e7ddf15032 100644 --- a/test/src/ArtifactPublisherTest.ts +++ b/test/src/ArtifactPublisherTest.ts @@ -1,13 +1,10 @@ import { Arch } from "builder-util" import { BitbucketOptions, CancellationToken, HttpError, KeygenOptions, S3Options, SpacesOptions } from "builder-util-runtime" -import { PublishContext } from "electron-publish" -import { GitHubPublisher } from "electron-publish/out/gitHubPublisher" +import { BitbucketPublisher, GitHubPublisher, KeygenPublisher, PublishContext } from "electron-publish" import { isCI as isCi } from "ci-info" import * as path from "path" -import { KeygenPublisher } from "app-builder-lib/out/publish/KeygenPublisher" import { Platform } from "app-builder-lib" import { createPublisher } from "app-builder-lib/out/publish/PublishManager" -import { BitbucketPublisher } from "app-builder-lib/out/publish/BitbucketPublisher" import { publishArtifactsWithOptions } from "electron-builder" if (isCi && process.platform === "win32") { diff --git a/test/src/filenameUtilTest.ts b/test/src/filenameUtilTest.ts index 4be6415995a..d6e4ae34686 100644 --- a/test/src/filenameUtilTest.ts +++ b/test/src/filenameUtilTest.ts @@ -1,4 +1,4 @@ -import { getCompleteExtname } from "app-builder-lib/out/util/filename" +import { getCompleteExtname } from "builder-util/out/filename" // [inputFilename, expectedExtname] const tests = [ diff --git a/test/src/updater/nsisUpdaterTest.ts b/test/src/updater/nsisUpdaterTest.ts index d225d1e3ee6..eb62309d7f7 100644 --- a/test/src/updater/nsisUpdaterTest.ts +++ b/test/src/updater/nsisUpdaterTest.ts @@ -1,4 +1,4 @@ -import { BitbucketPublisher } from "app-builder-lib/out/publish/BitbucketPublisher" +import { BitbucketPublisher } from "electron-publish" import { BitbucketOptions, GenericServerOptions, GithubOptions, KeygenOptions, S3Options, SpacesOptions } from "builder-util-runtime" import { UpdateCheckResult } from "electron-updater" import { outputFile } from "fs-extra"