style: run prettier on webpack5 files

This commit is contained in:
Igor Randjelovic
2021-03-29 01:24:23 +02:00
parent c55782bfaf
commit c922e77129
13 changed files with 138 additions and 110 deletions

View File

@ -14,7 +14,7 @@ export let copyRules = new Set([]);
/**
* @internal
*/
export let additionalCopyRules = []
export let additionalCopyRules = [];
/**
* Utility to add new copy rules. Accepts a glob or an object. For example
@ -30,11 +30,11 @@ export let additionalCopyRules = []
* @param {string|object} globOrObject
*/
export function addCopyRule(globOrObject: string | object) {
if(typeof globOrObject === 'string') {
if (typeof globOrObject === 'string') {
return copyRules.add(globOrObject);
}
additionalCopyRules.push(globOrObject)
additionalCopyRules.push(globOrObject);
}
/**
@ -72,12 +72,14 @@ export function applyCopyRules(config: Config) {
config.plugin('CopyWebpackPlugin').use(CopyWebpackPlugin, [
{
patterns: Array.from(copyRules).map((glob) => ({
from: glob,
context: entryDir,
noErrorOnMissing: true,
globOptions,
})).concat(additionalCopyRules),
patterns: Array.from(copyRules)
.map((glob) => ({
from: glob,
context: entryDir,
noErrorOnMissing: true,
globOptions,
}))
.concat(additionalCopyRules),
},
]);
}

View File

@ -8,7 +8,9 @@ interface IReplacementMap {
/**
* @internal
*/
export function getFileReplacementsFromEnv(env: IWebpackEnv = _env): IReplacementMap {
export function getFileReplacementsFromEnv(
env: IWebpackEnv = _env
): IReplacementMap {
const fileReplacements: IReplacementMap = {};
const entries: string[] = (() => {
@ -17,10 +19,10 @@ export function getFileReplacementsFromEnv(env: IWebpackEnv = _env): IReplacemen
}
if (typeof env.replace === 'string') {
return [env.replace]
return [env.replace];
}
return []
return [];
})();
entries.forEach((replaceEntry) => {

View File

@ -1,5 +1,5 @@
import dedent from 'ts-dedent';
import { env } from "@nativescript/webpack";
import { env } from '@nativescript/webpack';
// de-indents strings so multi-line string literals can be used
function cleanup(data: any[]) {
@ -29,7 +29,7 @@ export function warn(...data: any): void {
}
export function info(...data: any): void {
if(env.verbose) {
if (env.verbose) {
console.log(`[@nativescript/webpack] Info: \n`, ...cleanup(data));
}
}