@@ -62,7 +62,8 @@ export class FileMatcher {
62
62
const parsedPattern = new Minimatch ( pattern , minimatchOptions )
63
63
result . push ( parsedPattern )
64
64
65
- if ( ! hasMagic ( parsedPattern ) ) {
65
+ // do not add if contains dot (possibly file if has extension)
66
+ if ( ! pattern . includes ( "." ) && ! hasMagic ( parsedPattern ) ) {
66
67
// https://github.com/electron-userland/electron-builder/issues/545
67
68
// add **/*
68
69
result . push ( new Minimatch ( `${ pattern } /**/*` , minimatchOptions ) )
@@ -88,36 +89,38 @@ export function createFileMatcher(appDir: string, resourcesPath: string, macroEx
88
89
const patterns = packager . info . isPrepackedAppAsar ? null : getFileMatchers ( packager . info . config , "files" , appDir , path . join ( resourcesPath , "app" ) , false , macroExpander , platformSpecificBuildOptions )
89
90
const matcher = patterns == null ? new FileMatcher ( appDir , path . join ( resourcesPath , "app" ) , macroExpander ) : patterns [ 0 ]
90
91
91
- const relativeBuildResourceDir = path . relative ( matcher . from , buildResourceDir )
92
- const ignoreBuildResourceDirPattern = ( relativeBuildResourceDir . length !== 0 && ! relativeBuildResourceDir . startsWith ( "." ) ) ? `!${ relativeBuildResourceDir } {,/**/*}` : null
93
92
const customFirstPatterns : Array < string > = [ ]
94
93
if ( matcher . isEmpty ( ) || matcher . containsOnlyIgnore ( ) ) {
95
- if ( ignoreBuildResourceDirPattern != null ) {
96
- matcher . addPattern ( ignoreBuildResourceDirPattern )
97
- }
98
94
customFirstPatterns . push ( "**/*" )
99
95
}
100
96
else {
101
- if ( ignoreBuildResourceDirPattern != null ) {
102
- customFirstPatterns . push ( ignoreBuildResourceDirPattern )
103
- }
104
-
105
97
// prependPattern - user pattern should be after to be able to override
106
98
customFirstPatterns . push ( "**/node_modules/**/*" )
107
99
matcher . addPattern ( "package.json" )
108
100
}
109
101
102
+ // https://github.com/electron-userland/electron-builder/issues/1482
103
+ const relativeBuildResourceDir = path . relative ( matcher . from , buildResourceDir )
104
+ if ( relativeBuildResourceDir . length !== 0 && ! relativeBuildResourceDir . startsWith ( "." ) ) {
105
+ customFirstPatterns . push ( `!${ relativeBuildResourceDir } {,/**/*}` )
106
+ }
107
+
110
108
if ( packager . platform !== Platform . WINDOWS ) {
111
109
// https://github.com/electron-userland/electron-builder/issues/1738
112
110
customFirstPatterns . push ( "!**/node_modules/**/*.{dll,exe}" )
113
111
}
114
112
115
- matcher . patterns . unshift ( ...customFirstPatterns )
113
+ // add our default exclusions after user possibly defined "all" pattern
114
+ const insertIndex = Math . max ( 0 , matcher . patterns . findIndex ( it => it == "**/*" ) )
115
+ matcher . patterns . splice ( insertIndex , 0 , ...customFirstPatterns )
116
116
117
117
// https://github.com/electron-userland/electron-builder/issues/1738#issuecomment-310729208
118
- // must be before common ignore patterns (to ignore common ignores like .svn)
119
- matcher . addPattern ( "!**/node_modules/lzma-native/build/**/*" )
120
- matcher . addPattern ( "**/node_modules/lzma-native/build/{Release,Debug}" )
118
+ // https://github.com/electron-userland/electron-builder/issues/1741#issuecomment-311111418 so, do not use inclusive pattern
119
+ // matcher.addPattern("**/node_modules/lzma-native/build/{Release,Debug}")
120
+ matcher . addPattern ( "!**/node_modules/lzma-native/build/*.{mk,gypi,Makefile}" )
121
+ matcher . addPattern ( "!**/node_modules/lzma-native/build/{Makefile,gyp-mac-tool}" )
122
+ matcher . addPattern ( "!**/node_modules/lzma-native/build/liblzma{,/**/*}" )
123
+
121
124
matcher . addPattern ( "!**/node_modules/lzma-native/deps/xz-*" )
122
125
matcher . addPattern ( "!**/node_modules/lzma-native/deps/doc{,/**/*}" )
123
126
@@ -128,11 +131,9 @@ export function createFileMatcher(appDir: string, resourcesPath: string, macroEx
128
131
//noinspection SpellCheckingInspection
129
132
matcher . addPattern ( "!**/{.git,.hg,.svn,CVS,RCS,SCCS," +
130
133
"__pycache__,.DS_Store,thumbs.db,.gitignore,.gitattributes," +
131
- ".editorconfig,.flowconfig,.jshintrc,.eslintrc," +
132
- ".yarn-integrity,.yarn-metadata.json,yarn-error.log,yarn.lock,npm-debug.log," +
133
- ".idea,.vs," +
134
- "appveyor.yml,.travis.yml,circle.yml," +
135
- ".nyc_output}" )
134
+ ".idea,.vs,.editorconfig,.flowconfig,.jshintrc,.eslintrc," +
135
+ ".yarn-integrity,.yarn-metadata.json,yarn-error.log,yarn.lock,package-lock.json,npm-debug.log," +
136
+ "appveyor.yml,.travis.yml,circle.yml,.nyc_output}" )
136
137
137
138
return matcher
138
139
}
0 commit comments