Skip to content

Commit

Permalink
update setup-dev message (#1858)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip authored Jul 28, 2021
1 parent 7da59d8 commit 9a5e8c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/xarc-app-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"mkdirp": "^1.0.4",
"nix-clap": "^1.3.12",
"nyc": "^15.1.0",
"optional-require": "^1.0.2",
"optional-require": "^1.1.0",
"pkg-up": "^3.1.0",
"prompts": "^2.3.2",
"ps-get": "^1.1.0",
Expand Down
21 changes: 11 additions & 10 deletions packages/xarc-app-dev/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Fs from "fs";
import _ from "lodash";
import Url from "url";
import { XarcInternalOptions, XarcOptions } from "../config/opt2/xarc-options";
import { optionalRequire } from "optional-require";

export const getOptArchetypeRequire = require("@xarc/webpack/lib/util/get-opt-require"); // eslint-disable-line

Expand All @@ -29,7 +30,7 @@ export const formUrl = ({
host = "",
port = "",
path = "",
search = ""
search = "",
}): string => {
const proto = protocol.toString().toLowerCase();
const sp = port.toString();
Expand Down Expand Up @@ -155,18 +156,18 @@ export function loadXarcOptions(
const data = Fs.readFileSync(filename, "utf-8");
return (cachedXarcOptions = JSON.parse(data, jsonParser));
} catch (err) {
// eslint-disable-next-line
const runner = optionalRequire("@xarc/run") ? "xrun" : "clap";
if (showError) {
// eslint-disable-next-line
console.error(ck`
<red>ERROR</>: Electrode xarc fail to load <cyan>.etmp/xarc-options.json</> in
dev mode. This means you are trying to use something not through
xarc's development tasks.
<red>ERROR</>: Electrode xarc fail to load <cyan>.etmp/xarc-options.json</> in dev mode.
full path: ${filename}
Please run "clap setup-dev" once to initialize the file
<cyan>.etmp/xarc-options.json</> before doing your thing that loads
xarc's development code.
CAUSE: This means you are loading xarc's development code directly instead of through its task runner.
<green>SOLUTION: Please run "${runner} setup-dev" once to initialize the file <cyan>.etmp/xarc-options.json</>
before loading xarc's development code.</>
`);

console.error(err.stack); // eslint-disable-line
Expand All @@ -175,7 +176,7 @@ xarc's development code.
return (cachedXarcOptions = {
webpack: {},
babel: {},
options: {}
options: {},
} as XarcInternalOptions);
}
}
Expand Down Expand Up @@ -257,5 +258,5 @@ export function getDevAdminPortFromEnv(fallback?: number): number {
process.env.ELECTRODE_ADMIN_PORT
);

return [fromEnv, fallback, 0].find(x => isValidPort(x));
return [fromEnv, fallback, 0].find((x) => isValidPort(x));
}

0 comments on commit 9a5e8c1

Please sign in to comment.