-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular-devkit/build-angular): watch symbolic links
This commit addresses an issue which caused symbolic links not to be watched properly. Closes #15100 (cherry picked from commit 2021e66)
- Loading branch information
1 parent
82485d8
commit 4756d7e
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { symlink } from 'fs/promises'; | ||
import { resolve } from 'path'; | ||
import { appendToFile, expectFileToMatch, writeMultipleFiles } from '../../utils/fs'; | ||
import { execAndWaitForOutputToMatch, waitForAnyProcessOutputToMatch } from '../../utils/process'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
|
||
const buildReadyRegEx = /Build at: /; | ||
|
||
export default async function () { | ||
await updateJsonFile('angular.json', (configJson) => { | ||
configJson.projects['test-project'].architect.build.options.preserveSymlinks = true; | ||
}); | ||
|
||
await writeMultipleFiles({ | ||
'src/link-source.ts': '// empty file', | ||
'src/main.ts': `import './link-dest';`, | ||
}); | ||
|
||
await symlink(resolve('src/link-source.ts'), resolve('src/link-dest.ts')); | ||
|
||
await execAndWaitForOutputToMatch( | ||
'ng', | ||
['build', '--watch', '--configuration=development'], | ||
buildReadyRegEx, | ||
); | ||
|
||
// Trigger a rebuild | ||
await appendToFile('src/link-source.ts', `console.log('foo-bar');`); | ||
await waitForAnyProcessOutputToMatch(buildReadyRegEx); | ||
await expectFileToMatch('dist/test-project/main.js', `console.log('foo-bar')`); | ||
} |