fix(core): update
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
import * as plugins from './tools.plugins';
|
||||
import * as toolsInstall from './tools.install';
|
||||
|
||||
let npmgSmartcli = new plugins.smartcli.Smartcli();
|
||||
const toolsCli = new plugins.smartcli.Smartcli();
|
||||
|
||||
npmgSmartcli.addCommand('install').subscribe(async argvArg => {
|
||||
toolsCli.addCommand('install').subscribe(async argvArg => {
|
||||
toolsInstall.install('default');
|
||||
});
|
||||
|
||||
npmgSmartcli.addVersion('no version set');
|
||||
npmgSmartcli.startParse();
|
||||
toolsCli.addVersion('no version set');
|
||||
toolsCli.startParse();
|
||||
|
@ -1,30 +1,38 @@
|
||||
import plugins = require('./tools.plugins');
|
||||
import paths = require('./tools.paths');
|
||||
import { logger } from './tools.logging';
|
||||
|
||||
const installExec = async (packageNames: string[]) => {
|
||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash'
|
||||
});
|
||||
|
||||
let installString = '';
|
||||
for (let packageName of packageNames) {
|
||||
for (const packageName of packageNames) {
|
||||
logger.log('info', `Found ${packageName}!`);
|
||||
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}`);
|
||||
// lets remove old packages
|
||||
const uninstallCommand = `npm uninstall -g ${installString}`;
|
||||
const installCommand = `npm install -g ${installString}`;
|
||||
logger.log('info', `uninstalling old packages with "${uninstallCommand}"`);
|
||||
await smartshellInstance.exec(uninstallCommand);
|
||||
logger.log('info', `installing tools with ${installCommand}`);
|
||||
await smartshellInstance.exec(installCommand);
|
||||
logger.log('ok', `installed tools successfully!`);
|
||||
};
|
||||
|
||||
let packageLibrary = plugins.smartfile.fs.toObjectSync(
|
||||
const packageLibrary = plugins.smartfile.fs.toObjectSync(
|
||||
plugins.path.join(paths.packageBase, 'package_library.json')
|
||||
);
|
||||
|
||||
export const install = async (packageSetArg: String) => {
|
||||
export const install = async (packageSetArg: string) => {
|
||||
switch (packageSetArg) {
|
||||
case 'default':
|
||||
await installExec(packageLibrary.default);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.warn('no set has been specified');
|
||||
logger.log('warn', 'no set has been specified');
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
15
ts/tools.logging.ts
Normal file
15
ts/tools.logging.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import * as plugins from './tools.plugins';
|
||||
|
||||
export const logger = new plugins.smartlog.Smartlog({
|
||||
logContext: {
|
||||
company: 'Some Company',
|
||||
companyunit: 'Some CompanyUnit',
|
||||
containerName: 'Some Containername',
|
||||
environment: 'local',
|
||||
runtime: 'node',
|
||||
zone: 'gitzone'
|
||||
},
|
||||
minimumLogLevel: 'silly'
|
||||
});
|
||||
|
||||
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());
|
@ -1,7 +1,11 @@
|
||||
import * as beautylog from 'beautylog';
|
||||
// node native
|
||||
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 };
|
||||
// pushrocks scope
|
||||
import * as smartlog from '@pushrocks/smartlog';
|
||||
import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local';
|
||||
import * as smartcli from '@pushrocks/smartcli';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartshell from '@pushrocks/smartshell';
|
||||
|
||||
export { smartlog, smartlogDestinationLocal, path, smartcli, smartfile, smartshell };
|
||||
|
Reference in New Issue
Block a user