feat(core): new tools scope
This commit is contained in:
@ -1,3 +1,2 @@
|
||||
import plugins = require("./npmg.plugins");
|
||||
import * as cli from './npmg.cli'
|
||||
cli.run()
|
||||
import plugins = require('./tools.plugins');
|
||||
import * as cli from './tools.cli';
|
||||
|
@ -1,11 +0,0 @@
|
||||
import * as plugins from './npmg.plugins'
|
||||
import * as npmgInstall from './npmg.install'
|
||||
|
||||
let npmgSmartcli = new plugins.smartcli.Smartcli()
|
||||
|
||||
export let run = async () => {
|
||||
npmgSmartcli.addCommand('install').then(async (argvArg) => {
|
||||
npmgInstall.install('default')
|
||||
})
|
||||
npmgSmartcli.startParse()
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
import plugins = require('./npmg.plugins');
|
||||
import paths = require('./npmg.paths');
|
||||
|
||||
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')
|
||||
);
|
||||
|
||||
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,3 +0,0 @@
|
||||
import plugins = require('./npmg.plugins');
|
||||
|
||||
export let packageBase = plugins.path.join('__dirname', '../')
|
@ -1,14 +0,0 @@
|
||||
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
|
||||
}
|
11
ts/tools.cli.ts
Normal file
11
ts/tools.cli.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import * as plugins from './tools.plugins';
|
||||
import * as toolsInstall from './tools.install';
|
||||
|
||||
let npmgSmartcli = new plugins.smartcli.Smartcli();
|
||||
|
||||
npmgSmartcli.addCommand('install').subscribe(async argvArg => {
|
||||
toolsInstall.install('default');
|
||||
});
|
||||
|
||||
npmgSmartcli.addVersion('no version set');
|
||||
npmgSmartcli.startParse();
|
30
ts/tools.install.ts
Normal file
30
ts/tools.install.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import plugins = require('./tools.plugins');
|
||||
import paths = require('./tools.paths');
|
||||
|
||||
const 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}`);
|
||||
plugins.beautylog.log(`Installing ${packageName}`);
|
||||
}
|
||||
await plugins.smartshell.exec(`npm install -g ${installString}`);
|
||||
};
|
||||
|
||||
let packageLibrary = plugins.smartfile.fs.toObjectSync(
|
||||
plugins.path.join(paths.packageBase, 'package_library.json')
|
||||
);
|
||||
|
||||
export const install = async (packageSetArg: String) => {
|
||||
switch (packageSetArg) {
|
||||
case 'default':
|
||||
await installExec(packageLibrary.default);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.warn('no set has been specified');
|
||||
break;
|
||||
}
|
||||
};
|
3
ts/tools.paths.ts
Normal file
3
ts/tools.paths.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import plugins = require('./tools.plugins');
|
||||
|
||||
export let packageBase = plugins.path.join('__dirname', '../');
|
8
ts/tools.plugins.ts
Normal file
8
ts/tools.plugins.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import 'typings-global';
|
||||
import * as beautylog from 'beautylog';
|
||||
import * as path from 'path';
|
||||
import * as smartcli from '@pushrocks/smartcli';
|
||||
import * as smartfile from 'smartfile';
|
||||
import * as smartshell from 'smartshell';
|
||||
|
||||
export { beautylog, path, smartcli, smartfile, smartshell };
|
Reference in New Issue
Block a user