mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-21 22:34:21 +08:00
refactor(@schematics/angular): use built-in POSIX path utilities for library schematic
The use of the custom path functions from `@angular-devkit/core` have been removed in favor of the built-in functions from Node.js. These provide equivalent functionality with an improvement in performance. The amount of custom code executed has also been reduced.
This commit is contained in:
parent
5343c31152
commit
fab40ea9f1
@ -6,7 +6,6 @@
|
|||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { join, normalize } from '@angular-devkit/core';
|
|
||||||
import {
|
import {
|
||||||
Rule,
|
Rule,
|
||||||
SchematicContext,
|
SchematicContext,
|
||||||
@ -22,6 +21,7 @@ import {
|
|||||||
url,
|
url,
|
||||||
} from '@angular-devkit/schematics';
|
} from '@angular-devkit/schematics';
|
||||||
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
|
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
|
||||||
|
import { join } from 'node:path/posix';
|
||||||
import { NodeDependencyType, addPackageJsonDependency } from '../utility/dependencies';
|
import { NodeDependencyType, addPackageJsonDependency } from '../utility/dependencies';
|
||||||
import { JSONFile } from '../utility/json-file';
|
import { JSONFile } from '../utility/json-file';
|
||||||
import { latestVersions } from '../utility/latest-versions';
|
import { latestVersions } from '../utility/latest-versions';
|
||||||
@ -138,8 +138,8 @@ export default function (options: LibraryOptions): Rule {
|
|||||||
|
|
||||||
const libDir =
|
const libDir =
|
||||||
options.projectRoot !== undefined
|
options.projectRoot !== undefined
|
||||||
? normalize(options.projectRoot)
|
? join(options.projectRoot)
|
||||||
: join(normalize(newProjectRoot), folderName);
|
: join(newProjectRoot, folderName);
|
||||||
|
|
||||||
const distRoot = `dist/${folderName}`;
|
const distRoot = `dist/${folderName}`;
|
||||||
const sourceDir = `${libDir}/src/lib`;
|
const sourceDir = `${libDir}/src/lib`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user