From 3847f6e0bb0ad16ffa2c38b7b77de1bcc82a0c39 Mon Sep 17 00:00:00 2001 From: Mangala SSS Khalsa Date: Mon, 6 Apr 2020 19:05:20 -0700 Subject: [PATCH] Update build config * declare and reuse RegExp instances * add /tests to copyOnly * trees: configure ignore option for * hidden files (.*) * homedir files * html-report (Intern reporting info) * node_modules --- package.js | 68 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/package.js b/package.js index 727b7b9..2e8296d 100644 --- a/package.js +++ b/package.js @@ -1,35 +1,47 @@ -var miniExcludes = { +// jshint unused: false +var profile = (function () { + var miniExcludes = { 'dstore/README.md': 1, 'dstore/package': 1 - }, - isTestRe = /\/test\//; + }; + var amdRegex = /\.js$/; + var isRqlRegex = /RqlQuery\.js/; + var isTestRegex = /\/tests\//; + var miniExcludeRegex = /\/(?:tests|demos|docs)\//; + var packages = {}; -var packages = {}; -try { - // retrieve the set of packages for determining which modules to include - require(['util/build/buildControl'], function (buildControl) { - packages = buildControl.packages; - }); -} catch (error) { - console.error('Unable to retrieve packages for determining optional package support in dstore'); -} -var profile = { - resourceTags: { - test: function (filename, mid) { - return isTestRe.test(filename); - }, + try { + // retrieve the set of packages for determining which modules to include + require([ 'util/build/buildControl' ], function (buildControl) { + packages = buildControl.packages; + }); + } + catch (error) { + console.error('Unable to retrieve packages for determining optional package support in dstore'); + } - miniExclude: function (filename, mid) { - return /\/(?:tests|demos|docs)\//.test(filename) || mid in miniExcludes; - }, + return { + resourceTags: { + test: function (filename) { + return isTestRegex.test(filename); + }, - amd: function (filename, mid) { - return /\.js$/.test(filename); + miniExclude: function (filename, mid) { + return miniExcludeRegex.test(filename) || mid in miniExcludes; + }, + + amd: function (filename) { + return amdRegex.test(filename); + }, + + copyOnly: function (filename) { + // conditionally omit modules dependent on rql packages + return isTestRegex.test(filename) || (!packages.rql && isRqlRegex.test(filename)); + } }, - copyOnly: function (filename, mid) { - // conditionally omit modules dependent on rql packages - return (!packages['rql'] && /RqlQuery\.js/.test(filename)); - } - } -}; \ No newline at end of file + trees: [ + [ '.', '.', /(?:\/\.)|(?:~$)|(?:(?:html-report|node_modules)\/)/ ] + ] + }; +})();