Improve error messages when packages are not installed (#764).
This commit is contained in:
parent
acf6477d78
commit
1b9eef5b7a
5 changed files with 45 additions and 33 deletions
23
utility/ensure-verda-exists.js
Normal file
23
utility/ensure-verda-exists.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
"use strict";
|
||||
|
||||
const FgRed = "\x1b[31m";
|
||||
const FgYellow = "\x1b[33m";
|
||||
const Reset = "\x1b[0m";
|
||||
|
||||
const os = require("os");
|
||||
const shellWord = os.platform() === "win32" ? "command prompt" : "shell";
|
||||
|
||||
// Check packages are present
|
||||
try {
|
||||
require("verda/package.json");
|
||||
require("semver/package.json");
|
||||
require("which/package.json");
|
||||
require("@iarna/toml/package.json");
|
||||
} catch (e) {
|
||||
console.error(`${FgRed}It looks like you forgot to run "npm install" before building.${Reset}`);
|
||||
console.error(`"npm install" sets up dependencies required to build the fonts.`);
|
||||
console.error(`Run the following command in your ${shellWord} and retry:`);
|
||||
console.error(` ${FgYellow}npm install${Reset}`);
|
||||
console.error();
|
||||
process.exit(1);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue