@@ -17,6 +17,7 @@ import { notifyFileWatcherSockets } from './file-watching/file-watcher-sockets';
17
17
import { serverLogger } from './logger' ;
18
18
import { Workspaces } from '../../config/workspaces' ;
19
19
import { workspaceRoot } from '../../utils/workspace-root' ;
20
+ import { execSync } from 'child_process' ;
20
21
21
22
let cachedSerializedProjectGraphPromise : Promise < {
22
23
error : Error | null ;
@@ -104,12 +105,29 @@ function computeWorkspaceConfigHash(projectsConfigurations: any) {
104
105
return new HashingImpl ( ) . hashArray ( [ JSON . stringify ( projectsConfigurations ) ] ) ;
105
106
}
106
107
108
+ /**
109
+ * Temporary work around to handle nested gitignores. The parcel file watcher doesn't handle them well,
110
+ * so we need to filter them out here.
111
+ */
112
+ function filterUpdatedFiles ( files : string [ ] ) {
113
+ try {
114
+ const quoted = files . map ( ( f ) => '"' + f + '"' ) ;
115
+ const ignored = execSync ( `git check-ignore ${ quoted . join ( ' ' ) } ` )
116
+ . toString ( )
117
+ . split ( '\n' ) ;
118
+ return files . filter ( ( f ) => ignored . indexOf ( f ) === - 1 ) ;
119
+ } catch ( e ) {
120
+ // none of the files were ignored
121
+ return files ;
122
+ }
123
+ }
124
+
107
125
async function processCollectedUpdatedAndDeletedFiles ( ) {
108
126
try {
109
127
performance . mark ( 'hash-watched-changes-start' ) ;
110
- const updatedFiles = await defaultFileHasher . hashFiles ( [
111
- ...collectedUpdatedFiles . values ( ) ,
112
- ] ) ;
128
+ const updatedFiles = await defaultFileHasher . hashFiles (
129
+ filterUpdatedFiles ( [ ...collectedUpdatedFiles . values ( ) ] )
130
+ ) ;
113
131
const deletedFiles = [ ...collectedDeletedFiles . values ( ) ] ;
114
132
performance . mark ( 'hash-watched-changes-end' ) ;
115
133
performance . measure (
1 commit comments
vercel[bot] commentedon Apr 27, 2023
Successfully deployed to the following URLs:
nx-dev – ./
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx-dev-nrwl.vercel.app
nx.dev