-
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): correctly watch files when app is…
… in a directory that starts with a dot This commit fixes an issue were previously, application files in a directory that starts with a dot were being ignored from watching. Closes #26441 (cherry picked from commit 28583d0)
- Loading branch information
1 parent
7350c98
commit a068067
Showing
4 changed files
with
60 additions
and
9 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
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,56 @@ | ||
import { setTimeout } from 'node:timers/promises'; | ||
import { getGlobalVariable } from '../../utils/env'; | ||
import { appendToFile, createDir, rimraf } from '../../utils/fs'; | ||
import { installWorkspacePackages } from '../../utils/packages'; | ||
import { ng, waitForAnyProcessOutputToMatch } from '../../utils/process'; | ||
import { ngServe, updateJsonFile, useSha } from '../../utils/project'; | ||
|
||
const goodRegEx = getGlobalVariable('argv')['esbuild'] | ||
? /Application bundle generation complete\./ | ||
: / Compiled successfully\./; | ||
|
||
export default async function () { | ||
const originalCwd = process.cwd(); | ||
// Delete angular.json so that we can create a new app. | ||
await rimraf('angular.json'); | ||
await createDir('./.subdirectory'); | ||
|
||
try { | ||
process.chdir('./.subdirectory'); | ||
|
||
await ng('new', 'subdirectory-test-project', '--skip-install'); | ||
process.chdir('./subdirectory-test-project'); | ||
|
||
await useSha(); | ||
await installWorkspacePackages(); | ||
|
||
const useWebpackBuilder = !getGlobalVariable('argv')['esbuild']; | ||
if (useWebpackBuilder) { | ||
await updateJsonFile('angular.json', (json) => { | ||
const build = json['projects']['subdirectory-test-project']['architect']['build']; | ||
build.builder = '@angular-devkit/build-angular:browser'; | ||
build.options = { | ||
...build.options, | ||
main: build.options.browser, | ||
browser: undefined, | ||
}; | ||
|
||
build.configurations.development = { | ||
...build.configurations.development, | ||
vendorChunk: true, | ||
namedChunks: true, | ||
buildOptimizer: false, | ||
}; | ||
}); | ||
} | ||
|
||
await ngServe(); | ||
|
||
// Wait before editing a file. | ||
await setTimeout(1000); | ||
await appendToFile('src/main.ts', 'console.log(1);'); | ||
await waitForAnyProcessOutputToMatch(goodRegEx); | ||
} finally { | ||
process.chdir(originalCwd); | ||
} | ||
} |
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