Skip to content

Commit 66ca625

Browse files
authored
refactor: update Bitbucket publisher (#6400)
- use fs-extra to support Node < v14 - optional config options for Token and Username (Bitbucket Private Repos)
1 parent f41d5f3 commit 66ca625

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

.changeset/spotty-clouds-invent.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"app-builder-lib": patch
3+
"builder-util-runtime": patch
4+
"builder-util": patch
5+
---
6+
7+
refactor: update Bitbucket publisher to have optional config options for Token and Username (Bitbucket Private Repos)
8+

packages/app-builder-lib/src/publish/BitbucketPublisher.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { HttpPublisher, PublishContext } from "electron-publish"
55
import { BitbucketOptions } from "builder-util-runtime/out/publishOptions"
66
import { configureRequestOptions, HttpExecutor } from "builder-util-runtime"
77
import * as FormData from "form-data"
8-
import { readFile } from "fs/promises"
8+
import { readFile } from "fs-extra"
99

1010
export class BitbucketPublisher extends HttpPublisher {
1111
readonly providerName = "bitbucket"
@@ -18,8 +18,8 @@ export class BitbucketPublisher extends HttpPublisher {
1818
constructor(context: PublishContext, info: BitbucketOptions) {
1919
super(context)
2020

21-
const token = process.env.BITBUCKET_TOKEN
22-
const username = process.env.BITBUCKET_USERNAME
21+
const token = info.token || process.env.BITBUCKET_TOKEN || null
22+
const username = info.username || process.env.BITBUCKET_USERNAME || null
2323

2424
if (isEmptyOrSpaces(token)) {
2525
throw new InvalidConfigurationError(`Bitbucket token is not set using env "BITBUCKET_TOKEN" (see https://www.electron.build/configuration/publish#BitbucketOptions)`)

packages/builder-util-runtime/src/publishOptions.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,16 @@ export interface BitbucketOptions extends PublishConfiguration {
213213
*/
214214
readonly owner: string
215215

216+
/**
217+
* The access token to support auto-update from private bitbucket repositories.
218+
*/
219+
readonly token?: string | null
220+
221+
/**
222+
* The user name to support auto-update from private bitbucket repositories.
223+
*/
224+
readonly username?: string | null
225+
216226
/**
217227
* Repository slug/name
218228
*/

0 commit comments

Comments
 (0)