update
This commit is contained in:
@ -1,7 +1,3 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmg.plugins");
|
||||
import install = require("./npmg.install");
|
||||
let npmg = {
|
||||
install: install
|
||||
};
|
||||
export = npmg;
|
||||
import * as cli from './npmg.cli'
|
||||
cli.run()
|
||||
|
@ -0,0 +1,10 @@
|
||||
import * as plugins from './npmg.plugins'
|
||||
import * as install from './npmg.install'
|
||||
|
||||
let npmgSmartcli = new plugins.smartcli.Smartcli()
|
||||
|
||||
export let run = async () => {
|
||||
npmgSmartcli.addCommand('install').then(async (argvArg) => {
|
||||
|
||||
})
|
||||
}
|
@ -1,27 +1,30 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmg.plugins");
|
||||
import paths = require("./npmg.paths");
|
||||
let installExec = function(packageNames:string[]){
|
||||
for (let packageName in packageNames){
|
||||
let execCommand = "npm install -g " + packageNames[packageName];
|
||||
plugins.beautylog.info("now installing " + packageNames[packageName]);
|
||||
plugins.shelljs.exec(execCommand);
|
||||
};
|
||||
};
|
||||
import plugins = require('./npmg.plugins');
|
||||
import paths = require('./npmg.paths');
|
||||
|
||||
let packageLibrary = plugins.smartfile.readFileToObject(
|
||||
plugins.path.join(paths.packageBase,"packageLibrary.json")
|
||||
let installExec = async (packageNames: string[]) => {
|
||||
let installString = ''
|
||||
for (let packageName of packageNames) {
|
||||
installString = installString + `${packageName} `
|
||||
}
|
||||
await plugins.smartshell.exec(`yarn global remove ${installString}`)
|
||||
for (let packageName of packageNames) {
|
||||
plugins.beautylog.info(`now preparing ${packageName}`)
|
||||
await plugins.smartshell.exec(`yarn global remove ${packageName}`)
|
||||
}
|
||||
await plugins.smartshell.exec(`yarn global add ${installString}`)
|
||||
}
|
||||
|
||||
let packageLibrary = plugins.smartfile.fs.toObjectSync(
|
||||
plugins.path.join(paths.packageBase, 'package_library.json')
|
||||
);
|
||||
|
||||
let install = function(packageSetArg:String){
|
||||
switch (packageSetArg){
|
||||
case "default":
|
||||
installExec(packageLibrary.default);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.warn("no set has been specified");
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
export = install;
|
||||
export let install = async (packageSetArg: String) => {
|
||||
switch (packageSetArg) {
|
||||
case 'default':
|
||||
await installExec(packageLibrary.default)
|
||||
break
|
||||
default:
|
||||
plugins.beautylog.warn('no set has been specified');
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,3 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmg.plugins");
|
||||
let paths = {
|
||||
packageBase: plugins.path.join("__dirname","../")
|
||||
}
|
||||
export = paths;
|
||||
import plugins = require('./npmg.plugins');
|
||||
|
||||
export let packageBase = plugins.path.join('__dirname', '../')
|
||||
|
@ -1,5 +1,14 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
export let beautylog = require("beautylog");
|
||||
export let path = require("path");
|
||||
export import shelljs = require("shelljs");
|
||||
export let smartfile = require("smartfile");
|
||||
import 'typings-global'
|
||||
import * as beautylog from 'beautylog'
|
||||
import * as path from 'path'
|
||||
import * as smartcli from 'smartcli'
|
||||
import * as smartfile from 'smartfile'
|
||||
import * as smartshell from 'smartshell'
|
||||
|
||||
export {
|
||||
beautylog,
|
||||
path,
|
||||
smartcli,
|
||||
smartfile,
|
||||
smartshell
|
||||
}
|
||||
|
Reference in New Issue
Block a user