mirror of
https://github.com/locomotivemtl/locomotive-boilerplate.git
synced 2026-01-15 00:55:08 +08:00
Improve glob.js
Added constant `supportsGlob` to provide a boolean to check if a glob function is available.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import loconfig from '../utils/config.js';
|
import loconfig from '../utils/config.js';
|
||||||
import glob from '../utils/glob.js';
|
import glob, { supportsGlob } from '../utils/glob.js';
|
||||||
import message from '../utils/message.js';
|
import message from '../utils/message.js';
|
||||||
import notification from '../utils/notification.js';
|
import notification from '../utils/notification.js';
|
||||||
import resolve from '../utils/template.js';
|
import resolve from '../utils/template.js';
|
||||||
@@ -64,7 +64,7 @@ export const productionConcatFilesArgs = [
|
|||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
export default async function concatFiles(globOptions = null, concatOptions = null) {
|
export default async function concatFiles(globOptions = null, concatOptions = null) {
|
||||||
if (glob) {
|
if (supportsGlob) {
|
||||||
if (globOptions == null) {
|
if (globOptions == null) {
|
||||||
globOptions = productionGlobOptions;
|
globOptions = productionGlobOptions;
|
||||||
} else if (
|
} else if (
|
||||||
@@ -105,7 +105,7 @@ export default async function concatFiles(globOptions = null, concatOptions = nu
|
|||||||
includes = resolve(includes);
|
includes = resolve(includes);
|
||||||
outfile = resolve(outfile);
|
outfile = resolve(outfile);
|
||||||
|
|
||||||
if (glob && globOptions) {
|
if (supportsGlob && globOptions) {
|
||||||
includes = await glob(includes, globOptions);
|
includes = await glob(includes, globOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ try {
|
|||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const supportsGlob = (typeof glob === 'function');
|
||||||
|
|
||||||
export default glob;
|
export default glob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user