Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/core/types/FileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ export interface IFileSystem {
* Returns a list of file paths under a directory based on a match pattern
* @param dirPath Root dir to search in
* @param pattern Pattern to match
* @param ignorePatterns Optional pattern to ignore for each subdirectory
*/
glob(dirPath: string, pattern: string, ignorePattern?: string): string[];
glob(dirPath: string, pattern: string, ignorePatterns?: string[]): string[];
}

export const FS_TOKEN: string = "fs";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/update/Update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export async function updateWorkspace(rootPath: string): Promise<boolean> {
const logicFiles = [];
const styleFiles = [];
const pkgJsonFiles = [];
pkgJsonFiles.push(...fs.glob(rootPath, `package.json`, "node_modules"));
pkgJsonFiles.push(...fs.glob(rootPath, `package.json`, ['node_modules', 'dist']));

let workspaceConfig = null;
switch (framework.toLowerCase()) {
Expand Down
4 changes: 3 additions & 1 deletion packages/ng-schematics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
"@igniteui/angular-templates": "~19.0.1431",
"@igniteui/cli-core": "~14.3.1",
"@schematics/angular": "~19.0.0",
"rxjs": "^7.8.1"
"rxjs": "^7.8.1",
"minimatch": "^10.0.1"
},
"devDependencies": {
"@types/jasmine": "^5.1.4",
"@types/node": "^22.5.5",
"@types/minimatch": "^5.1.2",
"jasmine": "^5.3.0",
"typescript": "~5.6.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ng-schematics/src/upgrade-packages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export default function(options: UpgradeOptions): Rule {
});
const templateManager = new SchematicsTemplateManager();
const config = ProjectConfig.getConfig();
const library = templateManager.getProjectLibrary(config.project.framework, config.project.projectType);
const library = templateManager.getProjectLibrary('angular', config.project?.projectType || 'igx-ts');
let project: ProjectTemplate;
if (!config.project.projectTemplate || !library.hasProject(config.project.projectTemplate)) {
if (!config.project?.projectTemplate || !library.hasProject(config.project?.projectTemplate)) {
// in case project template is missing from the config we provide backward.
project = library.getProject(library.projectIds[0]);
} else {
Expand Down
46 changes: 33 additions & 13 deletions packages/ng-schematics/src/utils/NgFileSystem.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { Tree } from "@angular-devkit/schematics";
import { DirEntry, FileEntry, Tree } from "@angular-devkit/schematics";
import { App, FS_TOKEN, FS_TYPE_TOKEN, FsTypes, IFileSystem } from "@igniteui/cli-core";
import { minimatch } from 'minimatch';
import * as path from "path";

export class NgTreeFileSystem implements IFileSystem {
constructor(private tree: Tree) { }
public fileExists(filePath: string): boolean {
return this.tree.exists(filePath);
}

public readFile(filePath: string, encoding?: string): string {
public readFile(filePath: string, _encoding?: string): string {
return (this.tree.read(filePath) || "").toString();
}

Expand All @@ -23,24 +25,42 @@ export class NgTreeFileSystem implements IFileSystem {
/**
* Returns a list of file paths under a directory based on a match pattern
* @param dirPath Root dir to search in
* @param pattern Supports only recursive wildcard '\*\*\/\*'
* @param ignorePattern Optional pattern to ignore
* @param pattern Supports only recursive wildcard `\*\*\/\*`
* @param ignorePatterns Optional patterns to ignore for each subdirectory
*/
public glob(dirPath: string, pattern: string, ignorePattern?: string): string[] {
public glob(dirPath: string, pattern: string, ignorePatterns?: string[]): string[] {
const dir = this.tree.getDir(dirPath);
const entries: string[] = [];
pattern = pattern.split("**/*").pop() || pattern;

dir.visit((_fullPath, entry) => {
if (ignorePattern && entry?.path.includes(ignorePattern)) {
return;
}

if (entry?.path.endsWith(pattern)) {
const visitor = (_fullPath: string, entry?: Readonly<FileEntry>): void => {
if (entry && minimatch(entry.path, pattern)) {
entries.push(entry.path);
}
});
};

if (ignorePatterns?.length) {
const recurse = (dir: DirEntry): void => {
for (const subdirPath of dir.subdirs) {
if (ignorePatterns.every(p => !minimatch(subdirPath, p))) {
const subDir = dir.dir(subdirPath);
if (subDir.subdirs.length) {
recurse(subDir);
continue;
}
for (const file of dir.subfiles) {
if (minimatch(file, pattern) && ignorePatterns.every(p => !minimatch(file, p))) {
entries.push(path.posix.normalize(`${dir.path}/${file}`));
}
}
}
}
};

recurse(dir);
return entries;
}

dir.visit(visitor);
return entries;
}
}
Expand Down
33 changes: 29 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4915,7 +4915,7 @@ [email protected]:
dependencies:
brace-expansion "^2.0.1"

minimatch@^10.0.0:
minimatch@^10.0.0, minimatch@^10.0.1:
version "10.0.1"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.1.tgz#ce0521856b453c86e25f2c4c0d03e6ff7ddc440b"
integrity sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==
Expand Down Expand Up @@ -6701,7 +6701,16 @@ stream-throttle@^0.1.3:
commander "^2.2.0"
limiter "^1.0.5"

"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -6761,7 +6770,14 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -7408,7 +7424,7 @@ wordwrap@^1.0.0:
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -7426,6 +7442,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down
Loading