Skip to content

Commit 5ab2bee

Browse files
authoredAug 8, 2024··
fix: add disableDefaultIgnoredFiles option (#8398)
1 parent 8dabf64 commit 5ab2bee

File tree

5 files changed

+59
-2
lines changed

5 files changed

+59
-2
lines changed
 

‎.changeset/smooth-roses-laugh.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
add disableDefaultIgnoredFiles option

‎docs/generated/PlatformSpecificBuildOptions.md

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<p><code id="PlatformSpecificBuildOptions-compression">compression</code> = <code>normal</code> “store” | “normal” | “maximum” | “undefined” - The compression level. If you want to rapidly test build, <code>store</code> can reduce build time significantly. <code>maximum</code> doesn’t lead to noticeable size difference, but increase build time.</p>
1313
</li>
1414
<li>
15+
<p><code id="PlatformSpecificBuildOptions-disableDefaultIgnoredFiles">disableDefaultIgnoredFiles</code> = <code>false</code> Boolean | “undefined” - Whether to exclude all default ignored files(<a href="https://www.electron.build/configuration/contents#files">https://www.electron.build/configuration/contents#files</a>) and options. Defaults to <code>false</code>.</p>
16+
</li>
17+
<li>
1518
<p><code id="PlatformSpecificBuildOptions-files">files</code> The <a href="/configuration/contents#files">files</a> configuration.</p>
1619
</li>
1720
<li>

‎packages/app-builder-lib/scheme.json

+40
Original file line numberDiff line numberDiff line change
@@ -1652,6 +1652,14 @@
16521652
"description": "Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.",
16531653
"type": "boolean"
16541654
},
1655+
"disableDefaultIgnoredFiles": {
1656+
"default": false,
1657+
"description": "Whether to exclude all default ignored files(https://www.electron.build/configuration/contents#files) and options. Defaults to `false`.",
1658+
"type": [
1659+
"null",
1660+
"boolean"
1661+
]
1662+
},
16551663
"electronLanguages": {
16561664
"anyOf": [
16571665
{
@@ -2275,6 +2283,14 @@
22752283
"description": "Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.",
22762284
"type": "boolean"
22772285
},
2286+
"disableDefaultIgnoredFiles": {
2287+
"default": false,
2288+
"description": "Whether to exclude all default ignored files(https://www.electron.build/configuration/contents#files) and options. Defaults to `false`.",
2289+
"type": [
2290+
"null",
2291+
"boolean"
2292+
]
2293+
},
22782294
"electronLanguages": {
22792295
"anyOf": [
22802296
{
@@ -2905,6 +2921,14 @@
29052921
"description": "Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.",
29062922
"type": "boolean"
29072923
},
2924+
"disableDefaultIgnoredFiles": {
2925+
"default": false,
2926+
"description": "Whether to exclude all default ignored files(https://www.electron.build/configuration/contents#files) and options. Defaults to `false`.",
2927+
"type": [
2928+
"null",
2929+
"boolean"
2930+
]
2931+
},
29082932
"electronLanguages": {
29092933
"anyOf": [
29102934
{
@@ -6057,6 +6081,14 @@
60576081
"description": "Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.",
60586082
"type": "boolean"
60596083
},
6084+
"disableDefaultIgnoredFiles": {
6085+
"default": false,
6086+
"description": "Whether to exclude all default ignored files(https://www.electron.build/configuration/contents#files) and options. Defaults to `false`.",
6087+
"type": [
6088+
"null",
6089+
"boolean"
6090+
]
6091+
},
60606092
"electronLanguages": {
60616093
"anyOf": [
60626094
{
@@ -6695,6 +6727,14 @@
66956727
}
66966728
]
66976729
},
6730+
"disableDefaultIgnoredFiles": {
6731+
"default": false,
6732+
"description": "Whether to exclude all default ignored files(https://www.electron.build/configuration/contents#files) and options. Defaults to `false`.",
6733+
"type": [
6734+
"null",
6735+
"boolean"
6736+
]
6737+
},
66986738
"disableSanityCheckAsar": {
66996739
"default": false,
67006740
"description": "Whether to disable sanity check asar package (useful for custom electron forks that implement their own encrypted integrity validation)",

‎packages/app-builder-lib/src/options/PlatformSpecificBuildOptions.ts

+7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions {
5050
*/
5151
readonly compression?: CompressionLevel | null
5252

53+
/**
54+
* Whether to exclude all default ignored files(https://www.electron.build/configuration/contents#files) and options. Defaults to `false`.
55+
*
56+
* @default false
57+
*/
58+
disableDefaultIgnoredFiles?: boolean | null
59+
5360
files?: Array<FileSet | string> | FileSet | string | null
5461
extraResources?: Array<FileSet | string> | FileSet | string | null
5562
extraFiles?: Array<FileSet | string> | FileSet | string | null

‎packages/app-builder-lib/src/util/NodeModuleCopyHelper.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import BluebirdPromise from "bluebird-lst"
22
import { CONCURRENCY } from "builder-util"
3-
import { lstat, readdir } from "fs-extra"
3+
import { lstat, readdir, lstatSync } from "fs-extra"
44
import * as path from "path"
55
import { excludedNames, FileMatcher } from "../fileMatcher"
66
import { Packager } from "../packager"
@@ -76,7 +76,9 @@ export class NodeModuleCopyHelper extends FileCopyHelper {
7676
return null
7777
}
7878

79-
if (!forceIncluded) {
79+
// check if filematcher matches the files array as more important than the default excluded files.
80+
const fileMatched = filter != null && filter(dirPath, lstatSync(dirPath))
81+
if (!fileMatched || !forceIncluded || !!this.packager.config.disableDefaultIgnoredFiles) {
8082
for (const ext of nodeModuleExcludedExts) {
8183
if (name.endsWith(ext)) {
8284
return null

0 commit comments

Comments
 (0)
Please sign in to comment.