Skip to content

Commit

Permalink
fix(components/packages): limit migrations to project files (#2713)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhwhite committed Sep 10, 2024
1 parent 0423363 commit 3f9d815
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Rule } from '@angular-devkit/schematics';

import { visitProjectFiles } from '../../../utility/visit-project-files';

export default function (): Rule {
return (tree) => {
const stringReplace: Record<string, string> = {
"from '@skyux/forms/lib/modules/file-attachment/file-validate-function';": `from '@skyux/forms';`,
};
tree.visit((filePath, fileEntry) => {

visitProjectFiles(tree, '', (filePath, fileEntry) => {
if (filePath.endsWith('.ts') && fileEntry) {
const content = fileEntry.content.toString();
const recorder = tree.beginUpdate(filePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ import { Tree } from '@angular-devkit/schematics';
import { isImported, parseSourceFile } from '@angular/cdk/schematics';

import { moveClassToLibrary } from '../../../utility/move-class-to-library';
import { visitProjectFiles } from '../../../utility/visit-project-files';

export default function () {
return (tree: Tree) => {
tree.visit((path, entry) => {
if (
!path.endsWith('.ts') ||
path.includes('__skyux') ||
path.includes('node_modules')
) {
visitProjectFiles(tree, '', (path, entry) => {
if (!path.endsWith('.ts')) {
return;
}
const content = entry?.content.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NodeDependencyType } from '@schematics/angular/utility/dependencies';

import { ensurePeersInstalled } from '../../../rules/ensure-peers-installed';
import { moveClassToLibrary } from '../../../utility/move-class-to-library';
import { visitProjectFiles } from '../../../utility/visit-project-files';

export default function () {
return chain([
Expand All @@ -15,12 +16,8 @@ export default function () {
},
]),
(tree: Tree) => {
tree.visit((path, entry) => {
if (
!path.endsWith('.ts') ||
path.includes('__skyux') ||
path.includes('node_modules')
) {
visitProjectFiles(tree, '', (path, entry) => {
if (!path.endsWith('.ts')) {
return;
}
const content = entry?.content.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import { isImported, parseSourceFile } from '@angular/cdk/schematics';
import ts from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
import { findNodes } from '@schematics/angular/utility/ast-utils';

import { visitProjectFiles } from '../../../utility/visit-project-files';

export default function () {
return (tree: Tree) => {
tree.visit((path, entry) => {
if (
!path.endsWith('.ts') ||
path.includes('__skyux') ||
path.includes('node_modules')
) {
visitProjectFiles(tree, '', (path, entry) => {
if (!path.endsWith('.ts')) {
return;
}
const content = entry?.content.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Tree } from '@angular-devkit/schematics';
import { FileVisitor } from '@angular-devkit/schematics/src/tree/interface';

const rootIgnore = ['dist', 'coverage'];
const alwaysIgnore = ['node_modules'];
const alwaysIgnore = ['node_modules', '__skyux'];

export function visitProjectFiles(
tree: Tree,
Expand Down

0 comments on commit 3f9d815

Please sign in to comment.