Skip to content

Commit

Permalink
feat: enabling support for typescript config files (i.e. electron-bui…
Browse files Browse the repository at this point in the history
…lder.ts) (#7180)
  • Loading branch information
mmaietta committed Oct 19, 2022
1 parent 3816d4f commit edb28c0
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 35 deletions.
6 changes: 6 additions & 0 deletions .changeset/sour-chicken-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"app-builder-lib": minor
"electron-builder": minor
---

feat: enabling typescript config files (i.e. electron-builder.ts)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ will declare to use node-modules instead of PnP.
}
```
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.
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)

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

Expand Down
2 changes: 1 addition & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Building:
--projectDir, --project The path to project directory. Defaults to current
working directory.
--config, -c The path to an electron-builder config. Defaults to
`electron-builder.yml` (or `json`, or `json5`), see
`electron-builder.yml` (or `json`, or `json5`, or `js`, or `ts`), see
https://goo.gl/YFRJOM
Publishing:
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ electron-builder [configuration](#configuration) can be defined
appId: "com.example.app"
```

`json`, [json5](http://json5.org), [toml](https://github.com/toml-lang/toml) or `js` (exported configuration or function that produces configuration) formats also supported.
`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.

!!! tip
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.
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"js-yaml": "^4.1.0",
"lazy-val": "^1.0.5",
"minimatch": "^3.1.2",
"read-config-file": "6.2.0",
"read-config-file": "6.3.2",
"sanitize-filename": "^1.6.3",
"semver": "^7.3.7",
"tar": "^6.1.11",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/fileMatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export function getMainFileMatchers(

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

if (isElectronCompile) {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"fs-extra": "^10.0.0",
"is-ci": "^3.0.0",
"lazy-val": "^1.0.5",
"read-config-file": "6.2.0",
"read-config-file": "6.3.2",
"simple-update-notifier": "^1.0.7",
"yargs": "^17.5.1"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/electron-builder/src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ export function configureBuildCommand(yargs: yargs.Argv): yargs.Argv {
.option("config", {
alias: ["c"],
group: buildGroup,
description: "The path to an electron-builder config. Defaults to `electron-builder.yml` (or `json`, or `json5`), see " + chalk.underline("https://goo.gl/YFRJOM"),
description:
"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"),
})
.group(["help", "version"], "Other:")
.example("electron-builder -mwl", "build for macOS, Windows and Linux")
Expand Down
90 changes: 61 additions & 29 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit edb28c0

Please sign in to comment.