-
Notifications
You must be signed in to change notification settings - Fork 12k
/
symlinked-global.ts
34 lines (29 loc) · 1.08 KB
/
symlinked-global.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { symlinkSync } from 'fs';
import { resolve } from 'path';
import { expectFileToMatch, writeMultipleFiles } from '../../../utils/fs';
import { ng } from '../../../utils/process';
import { updateJsonFile } from '../../../utils/project';
export default async function () {
await writeMultipleFiles({
'src/styles.scss': `p { color: red }`,
'src/styles-for-link.scss': `p { color: blue }`,
});
symlinkSync(
resolve('src/styles-for-link.scss'),
resolve('src/styles-linked.scss'),
'junction',
);
await updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [
'src/styles.scss',
'src/styles-linked.scss',
];
});
await ng('build');
await expectFileToMatch('dist/test-project/styles.css', 'red');
await expectFileToMatch('dist/test-project/styles.css', 'blue');
await ng('build', '--preserve-symlinks');
await expectFileToMatch('dist/test-project/styles.css', 'red');
await expectFileToMatch('dist/test-project/styles.css', 'blue');
}