tools/ts/npmg.install.ts

31 lines
958 B
TypeScript
Raw Normal View History

2017-05-28 18:03:40 +00:00
import plugins = require('./npmg.plugins');
import paths = require('./npmg.paths');
2016-03-02 00:34:48 +00:00
2017-05-28 18:03:40 +00:00
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}`)
}
2016-03-02 00:34:48 +00:00
2017-05-28 18:03:40 +00:00
let packageLibrary = plugins.smartfile.fs.toObjectSync(
plugins.path.join(paths.packageBase, 'package_library.json')
);
2016-03-02 00:34:48 +00:00
2017-05-28 18:03:40 +00:00
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
}
}