@xarc/app-dev 10.0.9 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/archetype.js +5 -5
- package/config/archetype.js.map +1 -1
- package/config/babel/babelrc-client.js +28 -28
- package/config/babel/babelrc-client.js.map +1 -1
- package/config/babel/babelrc-server.js +1 -1
- package/config/babel/babelrc-server.js.map +1 -1
- package/config/babel/babelrc.js +32 -32
- package/config/babel/babelrc.js.map +1 -1
- package/config/babel/common.js +2 -2
- package/config/babel/common.js.map +1 -1
- package/config/constants.js +1 -1
- package/config/constants.js.map +1 -1
- package/config/dev-proxy.js +8 -8
- package/config/dev-proxy.js.map +1 -1
- package/config/env-app.js +2 -2
- package/config/env-app.js.map +1 -1
- package/config/env-babel.js +3 -3
- package/config/env-babel.js.map +1 -1
- package/config/env-karma.js +2 -2
- package/config/env-karma.js.map +1 -1
- package/config/env-proxy.js +3 -3
- package/config/env-proxy.js.map +1 -1
- package/config/env-webpack.js +3 -3
- package/config/env-webpack.js.map +1 -1
- package/config/jest/__mocks__/framework-mock.js +2 -3
- package/config/jest/__mocks__/framework-mock.js.map +1 -1
- package/config/jest/jest.config.js +1 -1
- package/config/jest/jest.config.js.map +1 -1
- package/config/karma/browser-settings.js +1 -1
- package/config/karma/browser-settings.js.map +1 -1
- package/config/karma/entry-xarc.js +1 -1
- package/config/karma/entry.js +1 -1
- package/config/karma/karma.conf.coverage.js +5 -5
- package/config/karma/karma.conf.coverage.js.map +1 -1
- package/config/karma/karma.conf.dev.js +2 -2
- package/config/karma/karma.conf.dev.js.map +1 -1
- package/config/karma/karma.conf.js +2 -2
- package/config/karma/karma.conf.js.map +1 -1
- package/config/karma/karma.conf.watch.js +4 -4
- package/config/karma/karma.conf.watch.js.map +1 -1
- package/config/karma/util/load-user-config.js +6 -6
- package/config/karma/util/load-user-config.js.map +1 -1
- package/config/mocha/setup.js +3 -4
- package/config/mocha/setup.js.map +1 -1
- package/config/options.js +23 -25
- package/config/options.js.map +1 -1
- package/config/user-config.js +4 -4
- package/config/user-config.js.map +1 -1
- package/lib/app-dev-middleware.js +2 -2
- package/lib/app-dev-middleware.js.map +1 -1
- package/lib/babel-run.js +8 -5
- package/lib/babel-run.js.map +1 -1
- package/lib/dev-admin/admin-http.d.ts +1 -1
- package/lib/dev-admin/admin-http.js +9 -9
- package/lib/dev-admin/admin-http.js.map +1 -1
- package/lib/dev-admin/admin-server.js +65 -65
- package/lib/dev-admin/admin-server.js.map +1 -1
- package/lib/dev-admin/cdn-mock.js +7 -7
- package/lib/dev-admin/cdn-mock.js.map +1 -1
- package/lib/dev-admin/cleanup.js +3 -3
- package/lib/dev-admin/cleanup.js.map +1 -1
- package/lib/dev-admin/console-io.js +2 -2
- package/lib/dev-admin/console-io.js.map +1 -1
- package/lib/dev-admin/dev-http.js +6 -6
- package/lib/dev-admin/dev-http.js.map +1 -1
- package/lib/dev-admin/dev-server-start.js +5 -5
- package/lib/dev-admin/dev-server-start.js.map +1 -1
- package/lib/dev-admin/dev-server.js +1 -1
- package/lib/dev-admin/dev-server.js.map +1 -1
- package/lib/dev-admin/index.js +2 -2
- package/lib/dev-admin/index.js.map +1 -1
- package/lib/dev-admin/json-formatter-js.js +38 -38
- package/lib/dev-admin/log-view.js +19 -19
- package/lib/dev-admin/middleware.js +24 -24
- package/lib/dev-admin/middleware.js.map +1 -1
- package/lib/dev-admin/redbird-proxy.js +50 -50
- package/lib/dev-admin/redbird-proxy.js.map +1 -1
- package/lib/dev-admin/redbird-spawn.js +10 -10
- package/lib/dev-admin/redbird-spawn.js.map +1 -1
- package/lib/dev-tasks.d.ts +1 -1
- package/lib/dev-tasks.js +134 -133
- package/lib/dev-tasks.js.map +1 -1
- package/lib/fake-res.js +4 -4
- package/lib/fake-res.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/module-processor.js +2 -2
- package/lib/module-processor.js.map +1 -1
- package/lib/stats-mapper.js +2 -2
- package/lib/stats-mapper.js.map +1 -1
- package/lib/stats-utils.js +2 -2
- package/lib/stats-utils.js.map +1 -1
- package/lib/tasks/eslint.js +29 -29
- package/lib/tasks/eslint.js.map +1 -1
- package/lib/tasks/package-json.js +6 -6
- package/lib/tasks/package-json.js.map +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +20 -19
- package/lib/utils.js.map +1 -1
- package/package.json +8 -8
- package/scripts/l10n/flatten-messages.js +2 -2
- package/scripts/map-isomorphic-cdn.js +1 -1
- package/scripts/merge-isomorphic-assets.js +2 -2
- package/src/config/babel/babelrc-client.ts +25 -25
- package/src/config/babel/babelrc.ts +26 -26
- package/src/config/jest/__mocks__/framework-mock.ts +3 -3
- package/src/config/karma/entry-xarc.js +1 -1
- package/src/config/karma/entry.js +1 -1
- package/src/config/karma/util/load-user-config.ts +2 -2
- package/src/config/mocha/setup.ts +2 -2
- package/src/config/options.ts +12 -14
- package/src/config/user-config.ts +1 -1
- package/src/lib/babel-run.ts +7 -3
- package/src/lib/dev-admin/admin-server.ts +32 -32
- package/src/lib/dev-admin/json-formatter-js.js +38 -38
- package/src/lib/dev-admin/log-view.js +19 -19
- package/src/lib/dev-admin/redbird-proxy.ts +25 -23
- package/src/lib/dev-tasks.ts +110 -105
- package/src/lib/tasks/eslint.ts +26 -26
- package/src/lib/utils.ts +11 -10
package/lib/dev-tasks.js
CHANGED
|
@@ -6,29 +6,29 @@ const utils_1 = require("./utils");
|
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
7
7
|
/* eslint-disable object-shorthand, max-statements, no-magic-numbers */
|
|
8
8
|
/* eslint-disable no-console, no-process-exit, global-require, no-param-reassign */
|
|
9
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
10
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
11
|
-
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
12
|
-
const require_at_1 = tslib_1.__importDefault(require("require-at"));
|
|
13
|
-
const optional_require_1 =
|
|
14
|
-
const run_1 = tslib_1.__importDefault(require("@xarc/run"));
|
|
9
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
10
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
11
|
+
const assert_1 = (0, tslib_1.__importDefault)(require("assert"));
|
|
12
|
+
const require_at_1 = (0, tslib_1.__importDefault)(require("require-at"));
|
|
13
|
+
const optional_require_1 = require("optional-require");
|
|
14
|
+
const run_1 = (0, tslib_1.__importDefault)(require("@xarc/run"));
|
|
15
15
|
exports.xrun = run_1.default;
|
|
16
16
|
exports.xclap = run_1.default;
|
|
17
17
|
const archetype_1 = require("../config/archetype");
|
|
18
|
-
const chalker_1 = tslib_1.__importDefault(require("chalker"));
|
|
19
|
-
const xaa = tslib_1.__importStar(require("xaa")); // really import ESM into single xaa var
|
|
18
|
+
const chalker_1 = (0, tslib_1.__importDefault)(require("chalker"));
|
|
19
|
+
const xaa = (0, tslib_1.__importStar)(require("xaa")); // really import ESM into single xaa var
|
|
20
20
|
const ps_get_1 = require("ps-get");
|
|
21
|
-
const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
|
|
21
|
+
const chokidar_1 = (0, tslib_1.__importDefault)(require("chokidar"));
|
|
22
22
|
const child_process_1 = require("child_process");
|
|
23
|
-
const filter_scan_dir_1 = tslib_1.__importDefault(require("filter-scan-dir"));
|
|
24
|
-
const xsh_1 = tslib_1.__importDefault(require("xsh"));
|
|
23
|
+
const filter_scan_dir_1 = (0, tslib_1.__importDefault)(require("filter-scan-dir"));
|
|
24
|
+
const xsh_1 = (0, tslib_1.__importDefault)(require("xsh"));
|
|
25
25
|
const logger_1 = require("./logger");
|
|
26
26
|
const utils_2 = require("./utils");
|
|
27
27
|
const constants_1 = require("./tasks/constants");
|
|
28
28
|
const eslint_1 = require("./tasks/eslint");
|
|
29
29
|
const package_json_1 = require("./tasks/package-json");
|
|
30
30
|
const { getWebpackStartConfig, setWebpackProfile } = require("@xarc/webpack/lib/util/custom-check");
|
|
31
|
-
const optionalRequire = optional_require_1.
|
|
31
|
+
const optionalRequire = (0, optional_require_1.makeOptionalRequire)(require);
|
|
32
32
|
let xarcCwd;
|
|
33
33
|
/**
|
|
34
34
|
* Get the webpack's CLI command from @xarc/webpack
|
|
@@ -86,7 +86,7 @@ function setWebpackDev() {
|
|
|
86
86
|
* @returns the instance of @xarc/run that's required
|
|
87
87
|
*/
|
|
88
88
|
const getDevTaskRunner = (cwd = process.cwd()) => {
|
|
89
|
-
return require_at_1.default(cwd)("@xarc/run") || run_1.default;
|
|
89
|
+
return (0, require_at_1.default)(cwd)("@xarc/run") || run_1.default;
|
|
90
90
|
};
|
|
91
91
|
exports.getDevTaskRunner = getDevTaskRunner;
|
|
92
92
|
/**
|
|
@@ -116,7 +116,7 @@ exports.getDevTaskRunner = getDevTaskRunner;
|
|
|
116
116
|
* @returns The `@xarc/run` task runner instance that was used.
|
|
117
117
|
*/
|
|
118
118
|
function loadXarcDevTasks(userXrun, userOptions = {}) {
|
|
119
|
-
let xarcOptions = archetype_1.getDevOptions(userOptions);
|
|
119
|
+
let xarcOptions = (0, archetype_1.getDevOptions)(userOptions);
|
|
120
120
|
xarcCwd = xarcOptions.cwd;
|
|
121
121
|
/**
|
|
122
122
|
*
|
|
@@ -131,8 +131,8 @@ function loadXarcDevTasks(userXrun, userOptions = {}) {
|
|
|
131
131
|
const flattenMessagesL10n = require(`../scripts/l10n/flatten-messages.js`);
|
|
132
132
|
const mapIsomorphicCdn = require(`../scripts/map-isomorphic-cdn.js`);
|
|
133
133
|
const config = xarcOptions.config;
|
|
134
|
-
const karmaConfig = file => path_1.default.join(config.karma, file);
|
|
135
|
-
const mochaConfig = file => path_1.default.join(config.mocha, file);
|
|
134
|
+
const karmaConfig = (file) => path_1.default.join(config.karma, file);
|
|
135
|
+
const mochaConfig = (file) => path_1.default.join(config.mocha, file);
|
|
136
136
|
const shell = xsh_1.default.$;
|
|
137
137
|
const exec = xsh_1.default.exec;
|
|
138
138
|
const mkCmd = xsh_1.default.mkCmd;
|
|
@@ -148,12 +148,12 @@ function loadXarcDevTasks(userXrun, userOptions = {}) {
|
|
|
148
148
|
}
|
|
149
149
|
timer = setTimeout(async () => {
|
|
150
150
|
timer = undefined;
|
|
151
|
-
const run = msg => {
|
|
151
|
+
const run = (msg) => {
|
|
152
152
|
child = true;
|
|
153
153
|
console.log(`${msg} '${cmd}'`);
|
|
154
|
-
const ch = child_process_1.spawn(cmd, {
|
|
154
|
+
const ch = (0, child_process_1.spawn)(cmd, {
|
|
155
155
|
shell: true,
|
|
156
|
-
stdio: "inherit"
|
|
156
|
+
stdio: "inherit",
|
|
157
157
|
});
|
|
158
158
|
ch.on("close", () => {
|
|
159
159
|
if (child === "restart") {
|
|
@@ -171,7 +171,7 @@ function loadXarcDevTasks(userXrun, userOptions = {}) {
|
|
|
171
171
|
else if (child.kill && child.pid) {
|
|
172
172
|
const ch = child;
|
|
173
173
|
child = "restart";
|
|
174
|
-
(await ps_get_1.psChildren(ch.pid)).reverse().forEach(c => process.kill(c.pid));
|
|
174
|
+
(await (0, ps_get_1.psChildren)(ch.pid)).reverse().forEach((c) => process.kill(c.pid));
|
|
175
175
|
ch.kill();
|
|
176
176
|
}
|
|
177
177
|
}, 500);
|
|
@@ -244,7 +244,7 @@ function loadXarcDevTasks(userXrun, userOptions = {}) {
|
|
|
244
244
|
const url = `http://${HOST}:${PORT}${PATH}`;
|
|
245
245
|
const statsPath = path_1.default.resolve(xarcCwd, "dist/server/stats.json");
|
|
246
246
|
const stats = JSON.parse(fs_1.default.readFileSync(statsPath, "utf-8"));
|
|
247
|
-
const cssAsset = stats.assets.find(asset => asset.name.endsWith(".css"));
|
|
247
|
+
const cssAsset = stats.assets.find((asset) => asset.name.endsWith(".css"));
|
|
248
248
|
const cssAssetPath = path_1.default.resolve(xarcCwd, `dist/js/${cssAsset.name}`);
|
|
249
249
|
const targetPath = path_1.default.resolve(xarcCwd, "dist/js/critical.css");
|
|
250
250
|
const serverPromise = require(path_1.default.resolve(xarcCwd, `${xarcOptions.AppMode.src.server}/index.js`))();
|
|
@@ -257,7 +257,7 @@ function loadXarcDevTasks(userXrun, userOptions = {}) {
|
|
|
257
257
|
strict: false,
|
|
258
258
|
maxEmbeddedBase64Length: 1000,
|
|
259
259
|
renderWaitTime: 2000,
|
|
260
|
-
blockJSRequests: false
|
|
260
|
+
blockJSRequests: false,
|
|
261
261
|
};
|
|
262
262
|
serverPromise.then(() => {
|
|
263
263
|
penthouse(penthouseOptions, (err, css) => {
|
|
@@ -265,7 +265,7 @@ function loadXarcDevTasks(userXrun, userOptions = {}) {
|
|
|
265
265
|
throw err;
|
|
266
266
|
}
|
|
267
267
|
const minifiedCSS = new CleanCSS().minify(css).styles;
|
|
268
|
-
fs_1.default.writeFile(targetPath, minifiedCSS, writeErr => {
|
|
268
|
+
fs_1.default.writeFile(targetPath, minifiedCSS, (writeErr) => {
|
|
269
269
|
if (writeErr) {
|
|
270
270
|
throw writeErr;
|
|
271
271
|
}
|
|
@@ -302,7 +302,7 @@ ie >= 11
|
|
|
302
302
|
`);
|
|
303
303
|
logger_1.logger.info(`Generating ${configRcFile} for you - please commit it.`);
|
|
304
304
|
}
|
|
305
|
-
package_json_1.updateAppDep(xarcCwd);
|
|
305
|
+
(0, package_json_1.updateAppDep)(xarcCwd);
|
|
306
306
|
/*
|
|
307
307
|
*
|
|
308
308
|
* For information on how to specify a task, see:
|
|
@@ -326,10 +326,10 @@ ie >= 11
|
|
|
326
326
|
}
|
|
327
327
|
return exec(`nyc check-coverage --temp-dir "coverage/client" --branches ${minimum} --lines ${minimum} --functions ${minimum} --statements ${minimum} --per-file`);
|
|
328
328
|
};
|
|
329
|
-
const optimizeModuleForProd = module => {
|
|
329
|
+
const optimizeModuleForProd = (module) => {
|
|
330
330
|
const modulePath = path_1.default.resolve(xarcCwd, "node_modules", module);
|
|
331
|
-
assert_1.default(shell.test("-d", modulePath), `${modulePath} is not a directory`);
|
|
332
|
-
utils_2.createGitIgnoreDir(path_1.default.resolve(xarcCwd, xarcOptions.prodModulesDir), "Electrode production modules dir");
|
|
331
|
+
(0, assert_1.default)(shell.test("-d", modulePath), `${modulePath} is not a directory`);
|
|
332
|
+
(0, utils_2.createGitIgnoreDir)(path_1.default.resolve(xarcCwd, xarcOptions.prodModulesDir), "Electrode production modules dir");
|
|
333
333
|
const prodPath = path_1.default.join(xarcOptions.prodModulesDir, module);
|
|
334
334
|
const cmd = mkCmd(`babel -q ${quote(modulePath)} --no-babelrc --ignore dist -D`, `--plugins transform-node-env-inline,minify-dead-code-elimination`, `-d ${quote(prodPath)}`);
|
|
335
335
|
return exec(cmd).then(() => {
|
|
@@ -342,11 +342,12 @@ ie >= 11
|
|
|
342
342
|
const makeBabelConfig = (destDir, _rcFile, resultFile = "babel.config.js") => {
|
|
343
343
|
destDir = path_1.default.resolve(xarcCwd, destDir);
|
|
344
344
|
const files = [".babelrc.js", resultFile];
|
|
345
|
-
if (!fs_1.default.existsSync(destDir) ||
|
|
345
|
+
if (!fs_1.default.existsSync(destDir) ||
|
|
346
|
+
files.find((file) => fs_1.default.existsSync(path_1.default.join(destDir, file)))) {
|
|
346
347
|
return;
|
|
347
348
|
}
|
|
348
349
|
const newName = path_1.default.join(destDir, resultFile);
|
|
349
|
-
console.log(chalker_1.default `<orange>Generating <cyan>${newName}</> for you - please commit it.</>`);
|
|
350
|
+
console.log((0, chalker_1.default) `<orange>Generating <cyan>${newName}</> for you - please commit it.</>`);
|
|
350
351
|
fs_1.default.writeFileSync(newName,
|
|
351
352
|
// NOTE: do not change module.exports below, this is .js file for app
|
|
352
353
|
`"use strict";
|
|
@@ -357,41 +358,41 @@ module.exports = {
|
|
|
357
358
|
`);
|
|
358
359
|
};
|
|
359
360
|
const AppMode = xarcOptions.AppMode;
|
|
360
|
-
const babelCliIgnore = quote([...constants_1.jestTestDirectories.map(dir => `**/${dir}`), `**/*.spec.js`, `**/*.spec.jsx`]
|
|
361
|
+
const babelCliIgnore = quote([...constants_1.jestTestDirectories.map((dir) => `**/${dir}`), `**/*.spec.js`, `**/*.spec.jsx`]
|
|
361
362
|
.concat(xarcOptions.babel.enableTypeScript && [`**/*.test.ts`, `**/*.test.tsx`])
|
|
362
363
|
.concat(`**/.__dev_hmr`)
|
|
363
|
-
.filter(x => x)
|
|
364
|
+
.filter((x) => x)
|
|
364
365
|
.join(","));
|
|
365
366
|
const babelCliExtensions = quote([".js", ".jsx"]
|
|
366
367
|
.concat(xarcOptions.babel.enableTypeScript && [".ts", ".tsx"])
|
|
367
|
-
.filter(x => x)
|
|
368
|
+
.filter((x) => x)
|
|
368
369
|
.join(","));
|
|
369
|
-
const babelEnvTargetsArr = Object.keys(xarcOptions.babel.envTargets).filter(k => k !== "node");
|
|
370
|
+
const babelEnvTargetsArr = Object.keys(xarcOptions.babel.envTargets).filter((k) => k !== "node");
|
|
370
371
|
const buildDistDirs = babelEnvTargetsArr
|
|
371
|
-
.filter(name => name !== "default")
|
|
372
|
-
.map(name => `dist-${name}`);
|
|
372
|
+
.filter((name) => name !== "default")
|
|
373
|
+
.map((name) => `dist-${name}`);
|
|
373
374
|
let tasks = {
|
|
374
|
-
".mk-prod-dir": () => utils_2.createGitIgnoreDir(path_1.default.resolve(xarcCwd, xarcOptions.prodDir), "Electrode production dir"),
|
|
375
|
-
".mk-dist-dir": () => utils_2.createGitIgnoreDir(path_1.default.resolve(xarcCwd, "dist"), "Electrode dist dir"),
|
|
376
|
-
".mk-dll-dir": () => utils_2.createGitIgnoreDir(path_1.default.resolve(xarcCwd, "dll"), "Electrode dll dir"),
|
|
375
|
+
".mk-prod-dir": () => (0, utils_2.createGitIgnoreDir)(path_1.default.resolve(xarcCwd, xarcOptions.prodDir), "Electrode production dir"),
|
|
376
|
+
".mk-dist-dir": () => (0, utils_2.createGitIgnoreDir)(path_1.default.resolve(xarcCwd, "dist"), "Electrode dist dir"),
|
|
377
|
+
".mk-dll-dir": () => (0, utils_2.createGitIgnoreDir)(path_1.default.resolve(xarcCwd, "dll"), "Electrode dll dir"),
|
|
377
378
|
".production-env": () => {
|
|
378
379
|
setProductionEnv();
|
|
379
|
-
xarcOptions = archetype_1.getDevOptions(userOptions); // re-evaluate options
|
|
380
|
+
xarcOptions = (0, archetype_1.getDevOptions)(userOptions); // re-evaluate options
|
|
380
381
|
},
|
|
381
382
|
".development-env": () => {
|
|
382
383
|
setDevelopmentEnv();
|
|
383
|
-
xarcOptions = archetype_1.getDevOptions(userOptions); // re-evaluate options
|
|
384
|
+
xarcOptions = (0, archetype_1.getDevOptions)(userOptions); // re-evaluate options
|
|
384
385
|
},
|
|
385
386
|
".webpack-dev": () => {
|
|
386
387
|
setWebpackDev();
|
|
387
|
-
xarcOptions = archetype_1.getDevOptions(userOptions); // re-evaluate options
|
|
388
|
+
xarcOptions = (0, archetype_1.getDevOptions)(userOptions); // re-evaluate options
|
|
388
389
|
},
|
|
389
390
|
".static-files-env": () => setStaticFilesEnv(),
|
|
390
391
|
".remove-log-files": () => removeLogFiles(),
|
|
391
392
|
build: {
|
|
392
393
|
dep: [".remove-log-files", ".production-env"],
|
|
393
394
|
desc: `Build your app's ${AppMode.src.dir} directory into ${AppMode.lib.dir} for production`,
|
|
394
|
-
task: [".build-lib", "build-dist", ".check.top.level.babelrc", "mv-to-dist"]
|
|
395
|
+
task: [".build-lib", "build-dist", ".check.top.level.babelrc", "mv-to-dist"],
|
|
395
396
|
},
|
|
396
397
|
//
|
|
397
398
|
// browser coverage
|
|
@@ -407,12 +408,12 @@ module.exports = {
|
|
|
407
408
|
".clean.dist",
|
|
408
409
|
".build-browser-coverage-1",
|
|
409
410
|
"build-dist:flatten-l10n",
|
|
410
|
-
"build-dist:clean-tmp"
|
|
411
|
-
]
|
|
411
|
+
"build-dist:clean-tmp",
|
|
412
|
+
],
|
|
412
413
|
},
|
|
413
414
|
"build-dev-static": {
|
|
414
415
|
desc: "Build static copy of your app's client bundle for development",
|
|
415
|
-
task: [".clean.dist", "build-dist-dev-static"]
|
|
416
|
+
task: [".clean.dist", "build-dist-dev-static"],
|
|
416
417
|
},
|
|
417
418
|
"build-dist": [
|
|
418
419
|
".production-env",
|
|
@@ -424,7 +425,7 @@ module.exports = {
|
|
|
424
425
|
"build-dist:flatten-l10n",
|
|
425
426
|
"build-dist:merge-isomorphic-assets",
|
|
426
427
|
"copy-dll",
|
|
427
|
-
"build-dist:clean-tmp"
|
|
428
|
+
"build-dist:clean-tmp",
|
|
428
429
|
],
|
|
429
430
|
".copy-xarc-options-to-dist": () => shell.cp(path_1.default.join(eTmpDir, "xarc-options.json"), "dist"),
|
|
430
431
|
"mv-to-dist": ["mv-to-dist:clean", "mv-to-dist:mv-dirs", "mv-to-dist:keep-targets"],
|
|
@@ -433,7 +434,7 @@ module.exports = {
|
|
|
433
434
|
task: function () {
|
|
434
435
|
setWebpackProfile("static");
|
|
435
436
|
return mkCmd(`~$${webpackCmd()} --config`, quote(getWebpackStartConfig("webpack.config.dev.static.js")), `--color`);
|
|
436
|
-
}
|
|
437
|
+
},
|
|
437
438
|
},
|
|
438
439
|
".ss-prod-react": () => optimizeModuleForProd("react"),
|
|
439
440
|
".ss-prod-react-dom": () => optimizeModuleForProd("react-dom"),
|
|
@@ -443,7 +444,7 @@ module.exports = {
|
|
|
443
444
|
"ss-prod-react": {
|
|
444
445
|
desc: `Make optimized copy of react&react-dom for server side in dir ${xarcOptions.prodModulesDir}`,
|
|
445
446
|
dep: [".ss-clean.prod-react", ".mk-prod-dir"],
|
|
446
|
-
task: xrun2.concurrent(".ss-prod-react", ".ss-prod-react-dom")
|
|
447
|
+
task: xrun2.concurrent(".ss-prod-react", ".ss-prod-react-dom"),
|
|
447
448
|
},
|
|
448
449
|
"build-dist-dll": () => undefined,
|
|
449
450
|
"copy-dll": () => undefined,
|
|
@@ -453,47 +454,47 @@ module.exports = {
|
|
|
453
454
|
task: xrun2.concurrent(babelEnvTargetsArr.map((name, index) => xrun2.exec([
|
|
454
455
|
`${webpackCmd()} --config`,
|
|
455
456
|
quote(getWebpackStartConfig("webpack.config.js")),
|
|
456
|
-
`--color
|
|
457
|
+
`--color`,
|
|
457
458
|
], {
|
|
458
459
|
xclap: {
|
|
459
|
-
delayRunMs: index * 2000
|
|
460
|
+
delayRunMs: index * 2000,
|
|
460
461
|
},
|
|
461
462
|
execOptions: {
|
|
462
463
|
env: {
|
|
463
|
-
ENV_TARGET: name
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
})))
|
|
464
|
+
ENV_TARGET: name,
|
|
465
|
+
},
|
|
466
|
+
},
|
|
467
|
+
}))),
|
|
467
468
|
},
|
|
468
469
|
"mv-to-dist:clean": {
|
|
469
470
|
desc: `clean static resources within ${buildDistDirs}`,
|
|
470
471
|
task: () => {
|
|
471
|
-
buildDistDirs.forEach(dir => {
|
|
472
|
+
buildDistDirs.forEach((dir) => {
|
|
472
473
|
// clean static resources within `dist-X` built by user specified env targets
|
|
473
474
|
// and leave [.js, .map, .json] files only
|
|
474
475
|
const removedFiles = filter_scan_dir_1.default.sync({
|
|
475
476
|
dir: path_1.default.resolve(xarcCwd, dir),
|
|
476
477
|
includeRoot: true,
|
|
477
|
-
ignoreExt: [".js", ".map", ".json"]
|
|
478
|
+
ignoreExt: [".js", ".map", ".json"],
|
|
478
479
|
});
|
|
479
480
|
shell.rm("-rf", ...removedFiles);
|
|
480
481
|
});
|
|
481
482
|
return;
|
|
482
|
-
}
|
|
483
|
+
},
|
|
483
484
|
},
|
|
484
485
|
"mv-to-dist:mv-dirs": {
|
|
485
486
|
desc: `move ${buildDistDirs} to dist`,
|
|
486
487
|
task: () => {
|
|
487
|
-
buildDistDirs.forEach(dir => {
|
|
488
|
+
buildDistDirs.forEach((dir) => {
|
|
488
489
|
filter_scan_dir_1.default
|
|
489
490
|
.sync({
|
|
490
491
|
dir,
|
|
491
492
|
includeRoot: true,
|
|
492
|
-
filterExt: [".js", ".json", ".map"]
|
|
493
|
+
filterExt: [".js", ".json", ".map"],
|
|
493
494
|
// the regex above matches all the sw-registration.js, sw-registration.js.map,
|
|
494
495
|
// main.bundle.js and main.bundle.js.map and stats.json
|
|
495
496
|
})
|
|
496
|
-
.forEach(file => {
|
|
497
|
+
.forEach((file) => {
|
|
497
498
|
if (file.endsWith(".js")) {
|
|
498
499
|
shell.cp("-r", file, "dist/js");
|
|
499
500
|
}
|
|
@@ -506,17 +507,17 @@ module.exports = {
|
|
|
506
507
|
});
|
|
507
508
|
});
|
|
508
509
|
return;
|
|
509
|
-
}
|
|
510
|
+
},
|
|
510
511
|
},
|
|
511
512
|
"mv-to-dist:keep-targets": {
|
|
512
513
|
desc: `write each targets to respective isomorphic-assets.json`,
|
|
513
514
|
task: () => {
|
|
514
|
-
buildDistDirs.forEach(dir => {
|
|
515
|
+
buildDistDirs.forEach((dir) => {
|
|
515
516
|
// add `targets` field to `dist-X/isomorphic-assets.json`
|
|
516
517
|
const isomorphicPath = path_1.default.resolve(xarcCwd, dir, "isomorphic-assets.json");
|
|
517
518
|
if (fs_1.default.existsSync(isomorphicPath)) {
|
|
518
519
|
fs_1.default.readFile(isomorphicPath, {
|
|
519
|
-
encoding: "utf8"
|
|
520
|
+
encoding: "utf8",
|
|
520
521
|
}, (err, data) => {
|
|
521
522
|
if (err)
|
|
522
523
|
throw err;
|
|
@@ -524,7 +525,7 @@ module.exports = {
|
|
|
524
525
|
const { envTargets } = xarcOptions.babel;
|
|
525
526
|
assetsJson.targets = envTargets[dir.split("-")[1]];
|
|
526
527
|
// eslint-disable-next-line no-shadow
|
|
527
|
-
fs_1.default.writeFile(isomorphicPath, JSON.stringify(assetsJson, null, 2), err => {
|
|
528
|
+
fs_1.default.writeFile(isomorphicPath, JSON.stringify(assetsJson, null, 2), (err) => {
|
|
528
529
|
if (err)
|
|
529
530
|
throw err;
|
|
530
531
|
});
|
|
@@ -532,11 +533,11 @@ module.exports = {
|
|
|
532
533
|
}
|
|
533
534
|
});
|
|
534
535
|
return;
|
|
535
|
-
}
|
|
536
|
+
},
|
|
536
537
|
},
|
|
537
538
|
"build-dist:clean-tmp": {
|
|
538
539
|
desc: false,
|
|
539
|
-
task: () => shell.rm("-rf", "./tmp")
|
|
540
|
+
task: () => shell.rm("-rf", "./tmp"),
|
|
540
541
|
},
|
|
541
542
|
"build-dist:flatten-l10n": flattenMessagesL10n,
|
|
542
543
|
"build-dist:merge-isomorphic-assets": mergeIsomorphicAssets,
|
|
@@ -552,7 +553,7 @@ module.exports = {
|
|
|
552
553
|
},
|
|
553
554
|
".clean.lib:client": () => shell.rm("-rf", AppMode.lib.client),
|
|
554
555
|
".mk.lib.client.dir": () => {
|
|
555
|
-
utils_2.createGitIgnoreDir(path_1.default.resolve(xarcCwd, AppMode.lib.client), `Electrode app transpiled code from ${AppMode.src.client}`);
|
|
556
|
+
(0, utils_2.createGitIgnoreDir)(path_1.default.resolve(xarcCwd, AppMode.lib.client), `Electrode app transpiled code from ${AppMode.src.client}`);
|
|
556
557
|
},
|
|
557
558
|
".build.babelrc": () => {
|
|
558
559
|
makeBabelConfig(xarcCwd, "babelrc.js");
|
|
@@ -565,10 +566,10 @@ module.exports = {
|
|
|
565
566
|
includeRoot: true,
|
|
566
567
|
includeDir: true,
|
|
567
568
|
grouping: true,
|
|
568
|
-
filterDir: x => (x === `.__dev_hmr` && "dirs") || "otherDirs",
|
|
569
|
-
filter: (x, p) => x.indexOf(".spec.") > 0 || x.indexOf(".test.") > 0 || p === `.__dev_hmr
|
|
569
|
+
filterDir: (x) => (x === `.__dev_hmr` && "dirs") || "otherDirs",
|
|
570
|
+
filter: (x, p) => x.indexOf(".spec.") > 0 || x.indexOf(".test.") > 0 || p === `.__dev_hmr`,
|
|
570
571
|
});
|
|
571
|
-
scanned.files.forEach(f => {
|
|
572
|
+
scanned.files.forEach((f) => {
|
|
572
573
|
try {
|
|
573
574
|
fs_1.default.unlinkSync(f);
|
|
574
575
|
}
|
|
@@ -576,7 +577,7 @@ module.exports = {
|
|
|
576
577
|
//
|
|
577
578
|
}
|
|
578
579
|
});
|
|
579
|
-
[].concat(scanned.dirs, scanned.otherDirs).forEach(d => {
|
|
580
|
+
[].concat(scanned.dirs, scanned.otherDirs).forEach((d) => {
|
|
580
581
|
try {
|
|
581
582
|
if (d)
|
|
582
583
|
fs_1.default.rmdirSync(d);
|
|
@@ -585,7 +586,7 @@ module.exports = {
|
|
|
585
586
|
// ignore
|
|
586
587
|
}
|
|
587
588
|
});
|
|
588
|
-
}
|
|
589
|
+
},
|
|
589
590
|
},
|
|
590
591
|
"build-lib:all": {
|
|
591
592
|
desc: false,
|
|
@@ -594,20 +595,20 @@ module.exports = {
|
|
|
594
595
|
".clean.lib:server",
|
|
595
596
|
".mk.lib.client.dir",
|
|
596
597
|
".mk.lib.server.dir",
|
|
597
|
-
".build.babelrc"
|
|
598
|
+
".build.babelrc",
|
|
598
599
|
],
|
|
599
600
|
task: xrun2.exec([
|
|
600
601
|
`babel ${AppMode.src.dir}`,
|
|
601
602
|
`--out-dir=${AppMode.lib.dir}`,
|
|
602
603
|
`--extensions=${babelCliExtensions}`,
|
|
603
604
|
`--source-maps=inline --copy-files`,
|
|
604
|
-
`--verbose --ignore=${babelCliIgnore}
|
|
605
|
+
`--verbose --ignore=${babelCliIgnore}`,
|
|
605
606
|
], {
|
|
606
607
|
env: {
|
|
607
|
-
XARC_BABEL_TARGET: "node"
|
|
608
|
-
}
|
|
608
|
+
XARC_BABEL_TARGET: "node",
|
|
609
|
+
},
|
|
609
610
|
}),
|
|
610
|
-
finally: [".build-lib:delete-babel-ignored-files"]
|
|
611
|
+
finally: [".build-lib:delete-babel-ignored-files"],
|
|
611
612
|
},
|
|
612
613
|
// TODO: to be removed
|
|
613
614
|
"build-lib:client": {
|
|
@@ -620,18 +621,18 @@ module.exports = {
|
|
|
620
621
|
dir: AppMode.src.dir,
|
|
621
622
|
includeDir: true,
|
|
622
623
|
grouping: true,
|
|
623
|
-
filterDir: x => !x.startsWith("server") && "dirs",
|
|
624
|
-
filter: () => false
|
|
624
|
+
filterDir: (x) => !x.startsWith("server") && "dirs",
|
|
625
|
+
filter: () => false,
|
|
625
626
|
}).dirs)
|
|
626
|
-
.filter(x => x)
|
|
627
|
+
.filter((x) => x)
|
|
627
628
|
: [AppMode.client];
|
|
628
|
-
return dirs.map(x => mkCmd(`~$babel ${path_1.default.posix.join(AppMode.src.dir, x)}`, `--out-dir=${path_1.default.posix.join(AppMode.lib.dir, x)}`, `--extensions=${babelCliExtensions}`, `--source-maps=inline --copy-files`, `--verbose --ignore=${babelCliIgnore}`));
|
|
629
|
+
return dirs.map((x) => mkCmd(`~$babel ${path_1.default.posix.join(AppMode.src.dir, x)}`, `--out-dir=${path_1.default.posix.join(AppMode.lib.dir, x)}`, `--extensions=${babelCliExtensions}`, `--source-maps=inline --copy-files`, `--verbose --ignore=${babelCliIgnore}`));
|
|
629
630
|
},
|
|
630
|
-
finally: [".build-lib:delete-babel-ignored-files"]
|
|
631
|
+
finally: [".build-lib:delete-babel-ignored-files"],
|
|
631
632
|
},
|
|
632
633
|
".clean.lib:server": () => shell.rm("-rf", AppMode.lib.server),
|
|
633
634
|
".mk.lib.server.dir": () => {
|
|
634
|
-
utils_2.createGitIgnoreDir(path_1.default.resolve(xarcCwd, AppMode.lib.server), `Electrode app transpiled code from ${AppMode.src.server}`);
|
|
635
|
+
(0, utils_2.createGitIgnoreDir)(path_1.default.resolve(xarcCwd, AppMode.lib.server), `Electrode app transpiled code from ${AppMode.src.server}`);
|
|
635
636
|
},
|
|
636
637
|
// TODO: to be removed
|
|
637
638
|
"build-lib:server": {
|
|
@@ -639,8 +640,8 @@ module.exports = {
|
|
|
639
640
|
dep: [".clean.lib:server", ".mk.lib.server.dir"],
|
|
640
641
|
task: [
|
|
641
642
|
mkCmd(`~$babel ${AppMode.src.server} --out-dir=${AppMode.lib.server}`, `--extensions=${babelCliExtensions}`, `--source-maps=inline --copy-files`, `--ignore=${babelCliIgnore}`),
|
|
642
|
-
".build-lib:delete-babel-ignored-files"
|
|
643
|
-
]
|
|
643
|
+
".build-lib:delete-babel-ignored-files",
|
|
644
|
+
],
|
|
644
645
|
},
|
|
645
646
|
check: ["lint", "test-cov"],
|
|
646
647
|
"check-ci": ["lint", "test-ci"],
|
|
@@ -673,14 +674,14 @@ module.exports = {
|
|
|
673
674
|
}
|
|
674
675
|
const mockTask = xrun2.concurrent([
|
|
675
676
|
"dev-proxy --mock-cdn --no-dev",
|
|
676
|
-
xrun2.serial(() => xaa.delay(500), () => watchExec(["config/assets.json", "lib/server"], `node ${context.args.join(" ")} lib/server`))
|
|
677
|
+
xrun2.serial(() => xaa.delay(500), () => watchExec(["config/assets.json", "lib/server"], `node ${context.args.join(" ")} lib/server`)),
|
|
677
678
|
]);
|
|
678
679
|
if (!fs_1.default.existsSync("dist")) {
|
|
679
680
|
console.log("dist does not exist, running build task first.");
|
|
680
681
|
return xrun2.serial("build", () => console.log("build completed, starting mock prod mode with proxy"), mockTask);
|
|
681
682
|
}
|
|
682
683
|
return xrun2.serial(() => console.log("dist exist, skipping build task"), mockTask);
|
|
683
|
-
}
|
|
684
|
+
},
|
|
684
685
|
},
|
|
685
686
|
"setup-dev": {
|
|
686
687
|
desc: `Setup development related options for your application. \
|
|
@@ -688,7 +689,7 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
688
689
|
dep: [".webpack-dev", ".development-env"],
|
|
689
690
|
task() {
|
|
690
691
|
console.log(`xarc dev options configured.`);
|
|
691
|
-
}
|
|
692
|
+
},
|
|
692
693
|
},
|
|
693
694
|
dev: {
|
|
694
695
|
desc: `Start your app with watch in development mode with dev-admin.
|
|
@@ -697,50 +698,50 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
697
698
|
task() {
|
|
698
699
|
const args = this.args.join(" ");
|
|
699
700
|
return [".webpack-dev", [`server-admin ${args}`, "generate-service-worker"]];
|
|
700
|
-
}
|
|
701
|
+
},
|
|
701
702
|
},
|
|
702
703
|
hot: {
|
|
703
704
|
desc: "Start app dev with hot reload enabled",
|
|
704
705
|
task: () => {
|
|
705
706
|
xarcOptions.webpack.enableHotModuleReload = true;
|
|
706
707
|
return "dev";
|
|
707
|
-
}
|
|
708
|
+
},
|
|
708
709
|
},
|
|
709
710
|
"dev-static": {
|
|
710
711
|
desc: "Start server in development mode with statically built files",
|
|
711
|
-
task: ["build-dev-static", "app-server"]
|
|
712
|
+
task: ["build-dev-static", "app-server"],
|
|
712
713
|
},
|
|
713
714
|
"npm:test": ["check"],
|
|
714
715
|
"npm:release": mapIsomorphicCdn,
|
|
715
716
|
server: ["app-server"],
|
|
716
717
|
"app-server": {
|
|
717
718
|
desc: "Start the app server only. Must run 'clap build' first.",
|
|
718
|
-
task: () => startAppServer()
|
|
719
|
+
task: () => startAppServer(),
|
|
719
720
|
},
|
|
720
721
|
"server-debug": {
|
|
721
722
|
desc: "Start the app serve with 'node debug'",
|
|
722
|
-
task: () => startAppServer(["debug"])
|
|
723
|
+
task: () => startAppServer(["debug"]),
|
|
723
724
|
},
|
|
724
725
|
"server-build-debug": {
|
|
725
726
|
desc: "Build and debug with devTools",
|
|
726
|
-
task: ["build", "server-devtools"]
|
|
727
|
+
task: ["build", "server-devtools"],
|
|
727
728
|
},
|
|
728
729
|
"server-build-debug-brk": {
|
|
729
730
|
desc: "Build and debug with devTools with breakpoint starting the app",
|
|
730
|
-
task: ["build", "server-devtools-debug-brk"]
|
|
731
|
+
task: ["build", "server-devtools-debug-brk"],
|
|
731
732
|
},
|
|
732
733
|
"server-devtools": {
|
|
733
734
|
desc: "Debug the app server with 'node --inspect'",
|
|
734
|
-
task: () => startAppServer(["--inspect"])
|
|
735
|
+
task: () => startAppServer(["--inspect"]),
|
|
735
736
|
},
|
|
736
737
|
"server-devtools-debug-brk": {
|
|
737
738
|
desc: "Debug the app server with 'node --inspect --debug-brk'",
|
|
738
|
-
task: () => startAppServer(["--inspect", "--debug-brk"])
|
|
739
|
+
task: () => startAppServer(["--inspect", "--debug-brk"]),
|
|
739
740
|
},
|
|
740
741
|
"server-prod": {
|
|
741
742
|
dep: [".production-env", ".static-files-env"],
|
|
742
743
|
desc: "Start server in production mode with static files routes. Must run 'clap build' first.",
|
|
743
|
-
task: () => startAppServer()
|
|
744
|
+
task: () => startAppServer(),
|
|
744
745
|
},
|
|
745
746
|
".init-bundle.valid.log": () => fs_1.default.writeFileSync(path_1.default.resolve(xarcCwd, eTmpDir, "bundle.valid.log"), `${Date.now()}`),
|
|
746
747
|
"server-admin": {
|
|
@@ -750,14 +751,14 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
750
751
|
AppMode.setEnv(AppMode.src.dir);
|
|
751
752
|
// eslint-disable-next-line no-shadow
|
|
752
753
|
const exec = quote(path_1.default.join(xarcOptions.devDir, "lib/babel-run"));
|
|
753
|
-
const isNodeArgs = x => x.startsWith("--inspect");
|
|
754
|
+
const isNodeArgs = (x) => x.startsWith("--inspect");
|
|
754
755
|
const nodeArgs = context.args.filter(isNodeArgs).join(" ");
|
|
755
|
-
const otherArgs = context.args.filter(x => !isNodeArgs(x)).join(" ");
|
|
756
|
+
const otherArgs = context.args.filter((x) => !isNodeArgs(x)).join(" ");
|
|
756
757
|
// get user specified port for admin
|
|
757
|
-
const userPort = utils_1.getDevAdminPortFromEnv(xarcOptions.adminPort);
|
|
758
|
+
const userPort = (0, utils_1.getDevAdminPortFromEnv)(xarcOptions.adminPort);
|
|
758
759
|
const portArg = !otherArgs.includes("--port") && userPort ? `--port ${userPort}` : "";
|
|
759
760
|
return mkCmd(`~(tty)$node`, nodeArgs, quote(path_1.default.join(xarcOptions.devDir, "lib/dev-admin")), otherArgs, portArg, `--exec ${exec} --ext js,jsx,json,yaml,log,ts,tsx`, `--watch config ${AppMode.src.server}`, `-- ${AppMode.src.server}`);
|
|
760
|
-
}
|
|
761
|
+
},
|
|
761
762
|
},
|
|
762
763
|
"server-admin.test": {
|
|
763
764
|
desc: "Start development with admin server in test mode",
|
|
@@ -766,11 +767,11 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
766
767
|
AppMode.setEnv(AppMode.src.dir);
|
|
767
768
|
// eslint-disable-next-line no-shadow
|
|
768
769
|
const exec = quote(path_1.default.join(xarcOptions.devDir, "lib/babel-run"));
|
|
769
|
-
const isNodeArgs = x => x.startsWith("--inspect");
|
|
770
|
+
const isNodeArgs = (x) => x.startsWith("--inspect");
|
|
770
771
|
const nodeArgs = context.args.filter(isNodeArgs);
|
|
771
|
-
const otherArgs = context.args.filter(x => !isNodeArgs(x));
|
|
772
|
+
const otherArgs = context.args.filter((x) => !isNodeArgs(x));
|
|
772
773
|
return mkCmd(`~(tty)$node`, nodeArgs.join(" "), quote(path_1.default.join(xarcOptions.devDir, "lib/dev-admin")), otherArgs.join(" "), `--exec ${exec} --ext js,jsx,json,yaml,log,ts,tsx`, `--watch config ${AppMode.src.server}`, `-- ${AppMode.src.server}`);
|
|
773
|
-
}
|
|
774
|
+
},
|
|
774
775
|
},
|
|
775
776
|
"dev-proxy": {
|
|
776
777
|
desc: `Start Electrode dev reverse proxy by itself - useful for running it with sudo.
|
|
@@ -779,7 +780,7 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
779
780
|
const debug = context.argOpts.debug ? "--inspect-brk " : "";
|
|
780
781
|
const proxySpawn = require.resolve("@xarc/app-dev/lib/dev-admin/redbird-spawn");
|
|
781
782
|
return `~(tty)$node ${debug}${proxySpawn} ${context.args.join(" ")}`;
|
|
782
|
-
}
|
|
783
|
+
},
|
|
783
784
|
},
|
|
784
785
|
"test-server": xrun2.concurrent(["lint-server", "lint-server-test"], "test-server-cov"),
|
|
785
786
|
"test-watch-all": xrun2.concurrent("server-admin.test", "test-frontend-dev-watch"),
|
|
@@ -787,8 +788,8 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
787
788
|
"test-cov": [
|
|
788
789
|
"?.karma.test-frontend-cov",
|
|
789
790
|
"?.jest.test-frontend-cov",
|
|
790
|
-
"test-server-cov"
|
|
791
|
-
].filter(x => x),
|
|
791
|
+
"test-server-cov",
|
|
792
|
+
].filter((x) => x),
|
|
792
793
|
"test-dev": ["test-frontend-dev", "test-server-dev"],
|
|
793
794
|
"test-watch": ["test-watch-all"],
|
|
794
795
|
"test-frontend": ["?.karma.test-frontend"],
|
|
@@ -805,21 +806,21 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
805
806
|
const error = "Please ensure `options.criticalCSS = true` in your `archetype/config.js` or `archetype/config/index.js`, then reinstall your dependencies";
|
|
806
807
|
throw new Error(`Missing Dependencies\n${error}`);
|
|
807
808
|
}
|
|
808
|
-
}
|
|
809
|
+
},
|
|
809
810
|
},
|
|
810
811
|
"generate-service-worker": {
|
|
811
812
|
desc: "Generate Service Worker using the options provided in the app/config/sw-precache-config.json " +
|
|
812
813
|
"file for prod/dev mode",
|
|
813
|
-
task: () => generateServiceWorker()
|
|
814
|
+
task: () => generateServiceWorker(),
|
|
814
815
|
},
|
|
815
816
|
pwa: {
|
|
816
817
|
desc: "PWA must have dist by running `clap build` first and then start the app server only.",
|
|
817
|
-
task: ["build", "server"]
|
|
818
|
+
task: ["build", "server"],
|
|
818
819
|
},
|
|
819
820
|
"generate-browsers-listrc": {
|
|
820
821
|
desc: "Generate .browserlistrc config file, it's used by Browserlist for AutoPrefixer/PostCSS",
|
|
821
|
-
task: () => generateBrowsersListRc()
|
|
822
|
-
}
|
|
822
|
+
task: () => generateBrowsersListRc(),
|
|
823
|
+
},
|
|
823
824
|
};
|
|
824
825
|
tasks = Object.assign(tasks, {
|
|
825
826
|
".clean.lib": () => shell.rm("-rf", AppMode.lib.client, AppMode.lib.server, AppMode.savedFile),
|
|
@@ -827,8 +828,8 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
827
828
|
".build-lib": {
|
|
828
829
|
desc: false,
|
|
829
830
|
dep: [".clean.lib", ".mk-prod-dir"],
|
|
830
|
-
task: ["build-lib:all", ".build-lib:app-mode"]
|
|
831
|
-
}
|
|
831
|
+
task: ["build-lib:all", ".build-lib:app-mode"],
|
|
832
|
+
},
|
|
832
833
|
});
|
|
833
834
|
if (fs_1.default.existsSync(path_1.default.resolve(xarcCwd, AppMode.src.client, "dll.config.js"))) {
|
|
834
835
|
Object.assign(tasks, {
|
|
@@ -837,12 +838,12 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
837
838
|
task: () => {
|
|
838
839
|
setWebpackProfile("dll");
|
|
839
840
|
return exec(`${webpackCmd()} --config`, quote(getWebpackStartConfig("webpack.config.dll.js")), `--color`);
|
|
840
|
-
}
|
|
841
|
+
},
|
|
841
842
|
},
|
|
842
|
-
"copy-dll": () => shell.cp("-r", "dll/*", "dist")
|
|
843
|
+
"copy-dll": () => shell.cp("-r", "dll/*", "dist"),
|
|
843
844
|
});
|
|
844
845
|
}
|
|
845
|
-
Object.assign(tasks, eslint_1.eslintTasks(xarcOptions, xrun2));
|
|
846
|
+
Object.assign(tasks, (0, eslint_1.eslintTasks)(xarcOptions, xrun2));
|
|
846
847
|
if (xarcOptions.options.karma) {
|
|
847
848
|
const noSingleRun = process.argv.indexOf("--no-single-run") >= 0 ? "--no-single-run" : "";
|
|
848
849
|
Object.assign(tasks, {
|
|
@@ -851,14 +852,14 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
851
852
|
task: () => {
|
|
852
853
|
setWebpackProfile("test");
|
|
853
854
|
return mkCmd(`~$karma start`, quote(karmaConfig("karma.conf.js")), `--colors`, noSingleRun);
|
|
854
|
-
}
|
|
855
|
+
},
|
|
855
856
|
},
|
|
856
857
|
".karma.test-frontend-ci": {
|
|
857
858
|
dep: [setKarmaCovEnv],
|
|
858
859
|
task: () => {
|
|
859
860
|
setWebpackProfile("coverage");
|
|
860
861
|
return mkCmd(`~$karma start`, quote(karmaConfig("karma.conf.coverage.js")), `--colors`, noSingleRun);
|
|
861
|
-
}
|
|
862
|
+
},
|
|
862
863
|
},
|
|
863
864
|
".karma.test-frontend-cov": {
|
|
864
865
|
dep: [setKarmaCovEnv],
|
|
@@ -869,13 +870,13 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
869
870
|
return mkCmd(`~$karma start`, quote(karmaConfig("karma.conf.coverage.js")), `--colors`, noSingleRun);
|
|
870
871
|
}
|
|
871
872
|
return undefined;
|
|
872
|
-
}
|
|
873
|
+
},
|
|
873
874
|
},
|
|
874
875
|
".karma.test-frontend-dev": ["test-frontend"],
|
|
875
876
|
".karma.test-frontend-dev-watch": () => {
|
|
876
877
|
setWebpackProfile("test");
|
|
877
878
|
return mkCmd(`~$karma start`, quote(karmaConfig("karma.conf.watch.js")), `--colors --browsers Chrome --no-single-run --auto-watch`, noSingleRun);
|
|
878
|
-
}
|
|
879
|
+
},
|
|
879
880
|
});
|
|
880
881
|
}
|
|
881
882
|
else {
|
|
@@ -888,7 +889,7 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
888
889
|
".karma.test-frontend-ci": karmaTasksDisabled,
|
|
889
890
|
".karma.test-frontend-cov": karmaTasksDisabled,
|
|
890
891
|
".karma.test-frontend-dev": karmaTasksDisabled,
|
|
891
|
-
".karma.test-frontend-dev-watch": karmaTasksDisabled
|
|
892
|
+
".karma.test-frontend-dev-watch": karmaTasksDisabled,
|
|
892
893
|
});
|
|
893
894
|
}
|
|
894
895
|
if (xarcOptions.options.jest) {
|
|
@@ -897,19 +898,19 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
897
898
|
desc: "Run jest tests (--inspect-brk to start debugger)",
|
|
898
899
|
task() {
|
|
899
900
|
return `.jest.test-frontend-cov ${this.argv.slice(1).join(" ")}`;
|
|
900
|
-
}
|
|
901
|
+
},
|
|
901
902
|
},
|
|
902
903
|
".jest.test-frontend-cov"() {
|
|
903
|
-
const testDir = constants_1.jestTestDirectories.find(x => shell.test("-d", x));
|
|
904
|
+
const testDir = constants_1.jestTestDirectories.find((x) => shell.test("-d", x));
|
|
904
905
|
let runJest = testDir;
|
|
905
906
|
if (!runJest) {
|
|
906
907
|
const scanned = filter_scan_dir_1.default.sync({
|
|
907
908
|
dir: path_1.default.resolve(xarcCwd, AppMode.src.dir),
|
|
908
909
|
grouping: true,
|
|
909
910
|
includeDir: true,
|
|
910
|
-
filterDir: d => (constants_1.jestTestDirectories.indexOf(d) >= 0 ? "dirs" : "otherDirs"),
|
|
911
|
+
filterDir: (d) => (constants_1.jestTestDirectories.indexOf(d) >= 0 ? "dirs" : "otherDirs"),
|
|
911
912
|
filterExt: [".js", ".jsx", ".ts", ".tsx"],
|
|
912
|
-
filter: x => x.indexOf(".spec.") > 0 || x.indexOf(".test.") > 0
|
|
913
|
+
filter: (x) => x.indexOf(".spec.") > 0 || x.indexOf(".test.") > 0,
|
|
913
914
|
});
|
|
914
915
|
runJest = Boolean(scanned.dirs || scanned.files.length > 0);
|
|
915
916
|
}
|
|
@@ -921,13 +922,13 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
921
922
|
const jestBinJs = require.resolve("jest/bin/jest");
|
|
922
923
|
logger_1.logger.info("Running jest unit tests");
|
|
923
924
|
const brk = this.argv.indexOf("--inspect-brk") >= 0 ? "--inspect-brk" : "";
|
|
924
|
-
const jestOpts = this.argv.slice(1).filter(x => x !== "--inspect-brk");
|
|
925
|
+
const jestOpts = this.argv.slice(1).filter((x) => x !== "--inspect-brk");
|
|
925
926
|
return mkCmd(`~(tty)$node`, brk, jestBinJs, jestOpts.join(" "), `--config ${xarcOptions.config.jest}/jest.config.js`);
|
|
926
927
|
}
|
|
927
928
|
else {
|
|
928
929
|
return undefined;
|
|
929
930
|
}
|
|
930
|
-
}
|
|
931
|
+
},
|
|
931
932
|
});
|
|
932
933
|
}
|
|
933
934
|
else {
|
|
@@ -935,7 +936,7 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
935
936
|
jest: () => {
|
|
936
937
|
logger_1.logger.info(`Running jest tests is not enabled because @xarc/opt-jest is not installed.
|
|
937
938
|
Please add it to your devDependencies to enable running jest tests.`);
|
|
938
|
-
}
|
|
939
|
+
},
|
|
939
940
|
});
|
|
940
941
|
}
|
|
941
942
|
if (xarcOptions.options.mocha) {
|
|
@@ -953,7 +954,7 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
953
954
|
return mkCmd(`~$mocha -c --opts`, quote(mochaConfig("mocha.opts")), `test/server`);
|
|
954
955
|
}
|
|
955
956
|
return undefined;
|
|
956
|
-
}
|
|
957
|
+
},
|
|
957
958
|
});
|
|
958
959
|
}
|
|
959
960
|
else {
|
|
@@ -963,7 +964,7 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
963
964
|
};
|
|
964
965
|
Object.assign(tasks, {
|
|
965
966
|
"test-server-cov": mochaTestDisabled,
|
|
966
|
-
"test-server-dev": mochaTestDisabled
|
|
967
|
+
"test-server-dev": mochaTestDisabled,
|
|
967
968
|
});
|
|
968
969
|
}
|
|
969
970
|
return tasks;
|
|
@@ -973,7 +974,7 @@ You only need to run this if you are doing something not through the xarc tasks.
|
|
|
973
974
|
// // if it's not then this will fail with an error message that it's not found.
|
|
974
975
|
// require.resolve(`${archetype.devArchetypeName}/package.json`);
|
|
975
976
|
// }
|
|
976
|
-
userXrun = userXrun || exports.getDevTaskRunner(xarcCwd);
|
|
977
|
+
userXrun = userXrun || (0, exports.getDevTaskRunner)(xarcCwd);
|
|
977
978
|
process.env._ELECTRODE_DEV_ = "1";
|
|
978
979
|
if (!process.env.hasOwnProperty("FORCE_COLOR")) {
|
|
979
980
|
process.env.FORCE_COLOR = "1"; // force color for chalk
|