Skip to content

Commit

Permalink
add devbrk and hotbrk tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip committed Apr 11, 2018
1 parent fd83ebe commit 837a87c
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions packages/electrode-archetype-react-app/arch-clap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use strict";

/* eslint-disable object-shorthand */

const Fs = require("fs");
const archetype = require("./config/archetype");
const assert = require("assert");
Expand Down Expand Up @@ -37,6 +39,10 @@ function quote(str) {
return str.startsWith(`"`) ? str : `"${str}"`;
}

function taskArgs(argv) {
return (argv && argv.length > 1 && argv.slice(1)) || [];
}

function webpackConfig(file) {
return Path.join(config.webpack, file);
}
Expand Down Expand Up @@ -486,21 +492,35 @@ Individual .babelrc files were generated for you in src/client and src/server
"cov-frontend-95": () => checkFrontendCov("95"),

debug: ["build-dev-static", "server-debug"],
devbrk: ["dev --inspect-brk"],
dev: {
desc: "Start your app with watch in development mode with webpack-dev-server",
dep: [".remove-log-files", ".development-env", ".clean.build", ".mk-dist-dir"],
task: [".webpack-dev", ["wds.dev", "server-watch", "generate-service-worker"]]
task: function() {
const args = taskArgs(this.argv);
return [
".webpack-dev",
["wds.dev", `server-watch ${args.join(" ")}`, "generate-service-worker"]
];
}
},

"dev-static": {
desc: "Start server in development mode with statically built files",
task: ["build-dev-static", "app-server"]
},

hotbrk: ["hot --inspect-brk"],
hot: {
desc: "Start your app with watch in hot mode with webpack-dev-server",
dep: [".development-env", ".webpack-hot"],
task: [".webpack-dev", ["wds.hot", "server-watch", "generate-service-worker"]]
task: function() {
const args = taskArgs(this.argv);
return [
".webpack-dev",
["wds.hot", `server-watch ${args.join(" ")}`, "generate-service-worker"]
];
}
},

lint: [["lint-client", "lint-client-test", "lint-server", "lint-server-test"]],
Expand Down Expand Up @@ -589,7 +609,7 @@ Individual .babelrc files were generated for you in src/client and src/server
"server-watch": {
dep: [".init-bundle.valid.log"],
desc: "Start app's node server in watch mode with nodemon",
task: () => {
task: function() {
const watches = [Path.join(eTmpDir, "bundle.valid.log"), AppMode.src.server, "config"]
.map(n => `--watch ${n}`)
.join(" ");
Expand All @@ -599,7 +619,7 @@ Individual .babelrc files were generated for you in src/client and src/server
: `node ${AppMode.src.server}`;
return mkCmd(
`~$nodemon`,
`--inspect`,
taskArgs(this.argv).join(" "),
`--delay 1 -C --ext js,jsx,json,yaml,log ${watches}`,
`--exec ${nodeRunApp}`
);
Expand Down

0 comments on commit 837a87c

Please sign in to comment.