mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
style: run prettier on webpack5 files
This commit is contained in:
@ -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),
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
@ -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) => {
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user