mirror of
https://github.com/danbulant/bpm
synced 2026-06-19 14:31:20 +00:00
Verify project.json & start working on install
This commit is contained in:
parent
3db7b4d204
commit
ecc07fa44f
1 changed files with 32 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
const Console = require("./console");
|
const Console = require("./console");
|
||||||
|
const config = require("./config")();
|
||||||
var console = new Console;
|
var console = new Console;
|
||||||
|
|
||||||
module.exports = class PackageParser {
|
module.exports = class PackageParser {
|
||||||
|
|
@ -15,9 +16,40 @@ module.exports = class PackageParser {
|
||||||
|
|
||||||
this.pkg = json;
|
this.pkg = json;
|
||||||
|
|
||||||
|
this.verify();
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verify(){
|
||||||
|
var pkg = this.pkg;
|
||||||
|
|
||||||
|
if(global.args.flags.supressChecking || global.args.flags.sch)return;
|
||||||
|
|
||||||
|
if(!pkg.name)console.warn("No name present in package.json");
|
||||||
|
if(!pkg.description)console.warn("No description present in package.json")
|
||||||
|
if(!pkg.repository)console.warn("Repository not specified")
|
||||||
|
if(!pkg.license)console.warn("License not selected")
|
||||||
|
if(!pkg.author)console.warn("Author not set")
|
||||||
|
if(!pkg.version)console.warn("Version not set. Some commands may not work.")
|
||||||
|
if(!pkg.keywords)console.warn("Add keywords to your package.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
install(dev = false){
|
||||||
|
var deps = {};
|
||||||
|
|
||||||
|
Object.assign(deps, this.getDependencies());
|
||||||
|
if(dev){
|
||||||
|
Object.assign(deps, this.getDependencies(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(var peer in this.getPeerDependencies()){
|
||||||
|
console.warn("Peer dependency found. Install peer dependencies yourself: " + peer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
getName(){
|
getName(){
|
||||||
if(this.pkg.name)return this.pkg.name;
|
if(this.pkg.name)return this.pkg.name;
|
||||||
throw Error("Name isn't specified in the package.json");
|
throw Error("Name isn't specified in the package.json");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue