mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 01:54:04 +08:00
ci: add golden-api file for core/node
This is necessary as we introduce namespaces in jobs.
This commit is contained in:
parent
2b3f9de403
commit
6bf80edf54
@ -1,9 +1,8 @@
|
||||
export declare function createConsoleLogger(verbose?: boolean, stdout?: ProcessOutput, stderr?: ProcessOutput): logging.Logger;
|
||||
|
||||
export declare namespace fs {
|
||||
function isFile(filePath: string): boolean;
|
||||
function isDirectory(filePath: string): boolean;
|
||||
}
|
||||
export declare function isDirectory(filePath: string): boolean;
|
||||
|
||||
export declare function isFile(filePath: string): boolean;
|
||||
|
||||
export declare class ModuleNotFoundException extends BaseException {
|
||||
readonly basePath: string;
|
11
packages/angular_devkit/core/node/_golden-api.ts
Normal file
11
packages/angular_devkit/core/node/_golden-api.ts
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
export * from './fs';
|
||||
export * from './cli-logger';
|
||||
export * from './host';
|
||||
export { ModuleNotFoundException, ResolveOptions, resolve } from './resolve';
|
@ -7,34 +7,31 @@
|
||||
*/
|
||||
import { statSync } from 'fs';
|
||||
|
||||
export namespace fs {
|
||||
export function isFile(filePath: string): boolean {
|
||||
let stat;
|
||||
try {
|
||||
stat = statSync(filePath);
|
||||
} catch (e) {
|
||||
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
|
||||
return false;
|
||||
}
|
||||
throw e;
|
||||
export function isFile(filePath: string): boolean {
|
||||
let stat;
|
||||
try {
|
||||
stat = statSync(filePath);
|
||||
} catch (e) {
|
||||
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return stat.isFile() || stat.isFIFO();
|
||||
}
|
||||
|
||||
|
||||
export function isDirectory(filePath: string): boolean {
|
||||
let stat;
|
||||
try {
|
||||
stat = statSync(filePath);
|
||||
} catch (e) {
|
||||
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
|
||||
return false;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return stat.isDirectory();
|
||||
throw e;
|
||||
}
|
||||
|
||||
return stat.isFile() || stat.isFIFO();
|
||||
}
|
||||
|
||||
|
||||
export function isDirectory(filePath: string): boolean {
|
||||
let stat;
|
||||
try {
|
||||
stat = statSync(filePath);
|
||||
} catch (e) {
|
||||
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
|
||||
return false;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return stat.isDirectory();
|
||||
}
|
||||
|
@ -5,7 +5,11 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
export * from './fs';
|
||||
import * as fs from './fs';
|
||||
export * from './cli-logger';
|
||||
export * from './host';
|
||||
export { ModuleNotFoundException, ResolveOptions, resolve } from './resolve';
|
||||
|
||||
export {
|
||||
fs,
|
||||
};
|
||||
|
@ -8,7 +8,7 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { BaseException } from '../src';
|
||||
import { fs as devkitFs } from './fs';
|
||||
import { isFile } from './fs';
|
||||
|
||||
/**
|
||||
* Exception thrown when a module could not be resolved.
|
||||
@ -204,16 +204,16 @@ export function resolve(x: string, options: ResolveOptions): string {
|
||||
throw new ModuleNotFoundException(x, basePath);
|
||||
|
||||
function loadAsFileSync(x: string): string | null {
|
||||
if (devkitFs.isFile(x)) {
|
||||
if (isFile(x)) {
|
||||
return x;
|
||||
}
|
||||
|
||||
return extensions.map(ex => x + ex).find(f => devkitFs.isFile(f)) || null;
|
||||
return extensions.map(ex => x + ex).find(f => isFile(f)) || null;
|
||||
}
|
||||
|
||||
function loadAsDirectorySync(x: string): string | null {
|
||||
const pkgfile = path.join(x, 'package.json');
|
||||
if (devkitFs.isFile(pkgfile)) {
|
||||
if (isFile(pkgfile)) {
|
||||
if (options.resolvePackageJson) {
|
||||
return pkgfile;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user