mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
chore: organize test files
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import * as lib from '../index';
|
||||
import { error, info, warn } from './log';
|
||||
|
||||
import { getAllDependencies, getDependencyPath } from './dependencies';
|
||||
import { info, warn } from './log';
|
||||
import * as lib from '../index';
|
||||
import { clearCurrentPlugin, setCurrentPlugin } from '../index';
|
||||
|
||||
export function applyExternalConfigs() {
|
||||
getAllDependencies().forEach((dependency) => {
|
||||
@ -11,7 +13,7 @@ export function applyExternalConfigs() {
|
||||
|
||||
if (fs.existsSync(configPath)) {
|
||||
info(`Discovered config: ${configPath}`);
|
||||
|
||||
setCurrentPlugin(dependency);
|
||||
try {
|
||||
const externalConfig = require(configPath);
|
||||
|
||||
@ -27,14 +29,13 @@ export function applyExternalConfigs() {
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
error(
|
||||
`
|
||||
Unable to apply config: ${configPath}.
|
||||
Error is:
|
||||
`,
|
||||
err
|
||||
);
|
||||
warn(`
|
||||
Unable to apply config: ${configPath}.
|
||||
Error is: ${err}
|
||||
`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
clearCurrentPlugin();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ function cleanup(data: any[]) {
|
||||
}
|
||||
|
||||
export function error(...data: any): Error {
|
||||
console.error(`[@nativescript/webpack] Error: \n`, ...cleanup(data));
|
||||
console.warn(`[@nativescript/webpack] Error: \n`, ...cleanup(data));
|
||||
|
||||
// we return the error - the caller can throw or ignore
|
||||
if (typeof data[0] === 'string') {
|
||||
@ -26,7 +26,7 @@ export function warn(...data: any): void {
|
||||
}
|
||||
|
||||
export function info(...data: any): void {
|
||||
console.info(`[@nativescript/webpack] Info: \n`, ...cleanup(data));
|
||||
console.log(`[@nativescript/webpack] Info: \n`, ...cleanup(data));
|
||||
}
|
||||
|
||||
// todo: refine
|
||||
|
Reference in New Issue
Block a user