Skip to content

Commit e521c20

Browse files
spike-rabbitkfenner
authored andcommitted
fix(schematics): scss migration should not modify node_modules
1 parent d8a636c commit e521c20

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

projects/element-ng/schematics/scss-import-to-siemens-migration/index.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ describe('scss-import-to-siemens migration', () => {
3939
expect(actual).not.toContain(`@use '@simpl/element-theme/src/theme';`);
4040
});
4141

42+
it(`should not modify node_modules files';`, async () => {
43+
const originalContent = [`// Import theme`, `@use '@simpl/element-theme/src/theme';`];
44+
const actual = await runFileMigration('node_modules/package/styles.scss', originalContent);
45+
expect(actual).toEqual(originalContent);
46+
});
47+
4248
it(`should remove global styles @use '@simpl/element-theme/...`, async () => {
4349
const originalContent = [
4450
`// Import theme`,

projects/element-ng/schematics/scss-import-to-siemens-migration/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ export const scssMigrationRule = (_options: { path: string }): Rule => {
6060

6161
const scssFiles = await discoverSourceFiles(tree, context, _options.path, '.scss');
6262
for (const filePath of scssFiles) {
63+
if (filePath.match(/node_modules/)) {
64+
continue;
65+
}
66+
6367
const content = tree.readText(filePath);
6468
if (
6569
content.includes(STYLE_REPLACEMENTS[0].replace) ||

0 commit comments

Comments
 (0)