mirror of
https://github.com/danbulant/bpm
synced 2026-05-19 04:08:47 +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 config = require("./config")();
|
||||
var console = new Console;
|
||||
|
||||
module.exports = class PackageParser {
|
||||
|
|
@ -15,8 +16,39 @@ module.exports = class PackageParser {
|
|||
|
||||
this.pkg = json;
|
||||
|
||||
this.verify();
|
||||
|
||||
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(){
|
||||
if(this.pkg.name)return this.pkg.name;
|
||||
|
|
|
|||
Loading…
Reference in a new issue