Skip to content

Commit f72b689

Browse files
author
Angular Builds
committed
4955ee0 fix(@angular-devkit/schematics): properly resolve relative schematics when executed from a nested directory
1 parent 225c03f commit f72b689

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular-devkit/schematics",
3-
"version": "20.0.0-next.3+sha-441ba9a",
3+
"version": "20.0.0-next.3+sha-4955ee0",
44
"description": "Angular Schematics - Library",
55
"main": "src/index.js",
66
"typings": "src/index.d.ts",
@@ -18,7 +18,7 @@
1818
"tooling"
1919
],
2020
"dependencies": {
21-
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#441ba9a",
21+
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#4955ee0",
2222
"jsonc-parser": "3.3.1",
2323
"magic-string": "0.30.17",
2424
"ora": "5.4.1",

tools/node-module-engine-host.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,13 @@ class NodeModulesEngineHost extends file_system_engine_host_base_1.FileSystemEng
3939
references.add(requester);
4040
}
4141
}
42-
const relativeBase = requester ? (0, node_path_1.dirname)(requester) : process.cwd();
4342
let collectionPath = undefined;
44-
if (name.startsWith('.')) {
45-
name = (0, node_path_1.resolve)(relativeBase, name);
46-
}
4743
const resolveOptions = {
4844
paths: requester ? [(0, node_path_1.dirname)(requester), ...(this.paths || [])] : this.paths,
4945
};
5046
// Try to resolve as a package
5147
try {
52-
const packageJsonPath = require.resolve((0, node_path_1.join)(name, 'package.json'), resolveOptions);
48+
const packageJsonPath = require.resolve(`${name}/package.json`, resolveOptions);
5349
const { schematics } = require(packageJsonPath);
5450
if (!schematics || typeof schematics !== 'string') {
5551
throw new NodePackageDoesNotSupportSchematics(name);

uniqueId

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Tue Apr 01 2025 10:54:20 GMT+0000 (Coordinated Universal Time)
1+
Tue Apr 01 2025 13:08:02 GMT+0000 (Coordinated Universal Time)

0 commit comments

Comments
 (0)