Skip to content

Commit edb28c0

Browse files
authored
feat: enabling support for typescript config files (i.e. electron-builder.ts) (#7180)
1 parent 3816d4f commit edb28c0

File tree

9 files changed

+75
-35
lines changed

9 files changed

+75
-35
lines changed

.changeset/sour-chicken-study.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"app-builder-lib": minor
3+
"electron-builder": minor
4+
---
5+
6+
feat: enabling typescript config files (i.e. electron-builder.ts)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ will declare to use node-modules instead of PnP.
118118
}
119119
```
120120
See [all options](https://www.electron.build/configuration/configuration). Option [files](https://www.electron.build/configuration/contents#files) to indicate which files should be packed in the final application, including the entry file, maybe required.
121+
You can also use separate configuration files, such as `js`, `ts`, `yml`, and `json`/`json5`. See [read-config-file](https://www.npmjs.com/package/read-config-file) for supported extensions. [JS Example for programmatic API](https://www.electron.build/api/programmatic-usage)
121122

122123
3. Add [icons](https://www.electron.build/icons).
123124

docs/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Building:
2525
--projectDir, --project The path to project directory. Defaults to current
2626
working directory.
2727
--config, -c The path to an electron-builder config. Defaults to
28-
`electron-builder.yml` (or `json`, or `json5`), see
28+
`electron-builder.yml` (or `json`, or `json5`, or `js`, or `ts`), see
2929
https://goo.gl/YFRJOM
3030
3131
Publishing:

docs/configuration/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ electron-builder [configuration](#configuration) can be defined
1111
appId: "com.example.app"
1212
```
1313
14-
`json`, [json5](http://json5.org), [toml](https://github.com/toml-lang/toml) or `js` (exported configuration or function that produces configuration) formats also supported.
14+
`json`, [json5](http://json5.org), [toml](https://github.com/toml-lang/toml) or `js`/`ts` (exported configuration or function that produces configuration) formats also supported.
1515

1616
!!! tip
1717
If you want to use `js` file, do not name it `electron-builder.js`. It will [conflict](https://github.com/electron-userland/electron-builder/issues/6227) with `electron-builder` package name.

packages/app-builder-lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"js-yaml": "^4.1.0",
6969
"lazy-val": "^1.0.5",
7070
"minimatch": "^3.1.2",
71-
"read-config-file": "6.2.0",
71+
"read-config-file": "6.3.2",
7272
"sanitize-filename": "^1.6.3",
7373
"semver": "^7.3.7",
7474
"tar": "^6.1.11",

packages/app-builder-lib/src/fileMatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export function getMainFileMatchers(
181181

182182
patterns.push(`!**/*.{${excludedExts}${packager.config.includePdb === true ? "" : ",pdb"}}`)
183183
patterns.push("!**/._*")
184-
patterns.push("!**/electron-builder.{yaml,yml,json,json5,toml}")
184+
patterns.push("!**/electron-builder.{yaml,yml,json,json5,toml,ts}")
185185
patterns.push(`!**/{${excludedNames}}`)
186186

187187
if (isElectronCompile) {

packages/electron-builder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"fs-extra": "^10.0.0",
6060
"is-ci": "^3.0.0",
6161
"lazy-val": "^1.0.5",
62-
"read-config-file": "6.2.0",
62+
"read-config-file": "6.3.2",
6363
"simple-update-notifier": "^1.0.7",
6464
"yargs": "^17.5.1"
6565
},

packages/electron-builder/src/builder.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ export function configureBuildCommand(yargs: yargs.Argv): yargs.Argv {
286286
.option("config", {
287287
alias: ["c"],
288288
group: buildGroup,
289-
description: "The path to an electron-builder config. Defaults to `electron-builder.yml` (or `json`, or `json5`), see " + chalk.underline("https://goo.gl/YFRJOM"),
289+
description:
290+
"The path to an electron-builder config. Defaults to `electron-builder.yml` (or `json`, or `json5`, or `js`, or `ts`), see " + chalk.underline("https://goo.gl/YFRJOM"),
290291
})
291292
.group(["help", "version"], "Other:")
292293
.example("electron-builder -mwl", "build for macOS, Windows and Linux")

pnpm-lock.yaml

Lines changed: 61 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)