-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Expand file tree
/
Copy pathsass-pkg-importer.ts
More file actions
34 lines (29 loc) · 1.23 KB
/
sass-pkg-importer.ts
File metadata and controls
34 lines (29 loc) · 1.23 KB
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 assert from 'node:assert';
import { writeFile } from '../../../utils/fs';
import { getActivePackageManager, uninstallPackage } from '../../../utils/packages';
import { ng } from '../../../utils/process';
import { isPrereleaseCli, updateJsonFile } from '../../../utils/project';
import { appendFile } from 'node:fs/promises';
import { getGlobalVariable } from '../../../utils/env';
export default async function () {
assert(
getGlobalVariable('argv')['esbuild'],
'This test should not be called in the Webpack suite.',
);
// forcibly remove in case another test doesn't clean itself up
await uninstallPackage('@angular/material');
const isPrerelease = await isPrereleaseCli();
const tag = isPrerelease ? '@next' : '';
if (getActivePackageManager() === 'npm') {
await appendFile('.npmrc', '\nlegacy-peer-deps=true');
}
await ng('add', `@angular/material${tag}`, '--skip-confirmation');
await Promise.all([
updateJsonFile('angular.json', (workspaceJson) => {
const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = ['src/styles.scss'];
}),
writeFile('src/styles.scss', `@use 'pkg:@angular/material' as mat;`),
]);
await ng('build');
}