-
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.
feat(@angular-devkit/build-angular): support following symlinked asse…
…t directories By default subdirectories within a symlinked directory are not searched by a glob. The new `followSymlinks` option for the longhand form of the `assets` browser builder option now allows opting in to search such subdirectories.
- Loading branch information
1 parent
ff7edce
commit cc723d8
Showing
6 changed files
with
62 additions
and
17 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
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,37 @@ | ||
import * as fs from 'fs'; | ||
import { expectFileToExist, expectFileToMatch, writeFile } from '../../utils/fs'; | ||
import { ng } from '../../utils/process'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
import { expectToFail } from '../../utils/utils'; | ||
|
||
export default async function () { | ||
await writeFile('src/assets/.file', ''); | ||
await writeFile('src/assets/test.abc', 'hello world'); | ||
|
||
await ng('build'); | ||
|
||
await expectFileToExist('dist/test-project/favicon.ico'); | ||
await expectFileToExist('dist/test-project/assets/.file'); | ||
await expectFileToMatch('dist/test-project/assets/test.abc', 'hello world'); | ||
await expectToFail(() => expectFileToExist('dist/test-project/assets/.gitkeep')); | ||
|
||
// Ensure `followSymlinks` option follows symlinks | ||
await updateJsonFile('angular.json', workspaceJson => { | ||
const appArchitect = workspaceJson.projects['test-project'].architect; | ||
appArchitect['build'].options.assets = [{ glob: '**/*', input: 'src/assets', output: 'assets', followSymlinks: true }]; | ||
}); | ||
fs.mkdirSync('dirToSymlink/subdir1', { recursive: true }); | ||
fs.mkdirSync('dirToSymlink/subdir2/subsubdir1', { recursive: true }); | ||
fs.writeFileSync('dirToSymlink/a.txt', ''); | ||
fs.writeFileSync('dirToSymlink/subdir1/b.txt', ''); | ||
fs.writeFileSync('dirToSymlink/subdir2/c.txt', ''); | ||
fs.writeFileSync('dirToSymlink/subdir2/subsubdir1/d.txt', ''); | ||
fs.symlinkSync(process.cwd() + '/dirToSymlink', 'src/assets/symlinkDir'); | ||
|
||
await ng('build'); | ||
|
||
await expectFileToExist('dist/test-project/assets/symlinkDir/a.txt'); | ||
await expectFileToExist('dist/test-project/assets/symlinkDir/subdir1/b.txt'); | ||
await expectFileToExist('dist/test-project/assets/symlinkDir/subdir2/c.txt'); | ||
await expectFileToExist('dist/test-project/assets/symlinkDir/subdir2/subsubdir1/d.txt'); | ||
} |
This file was deleted.
Oops, something went wrong.