Skip to content

Commit

Permalink
Develop (#414)
Browse files Browse the repository at this point in the history
* wip: events

* chore: fix header labels

* Hotfix/theme (#391)

* fix: theme overrides and clean up

* fix: theming and styling

* wip: app layout

* wip: app layout

* wip

* wip: layout stable

* wip: working with sidebar and top bar

* fix: stabilize layout, lint

* topBar

* Feat/top bar handlers (#393)

* wip: handlers

* init flow

* AppNavigation bar
lint
fix navigation

* remove --verbose

* chore: fix issues

* Feat/notifications (#395)

* wip: notifications list and toolbar

* lint

* notifications components

* lint

* fix: layout

* fix: layout

* Feat/notification handlers (#398)

* wip

* wip layout boundaries

* fix: paddings

* chore: cleanup components and styles

* Feat/topbar (#400)

* wip: settings handler

* lint

* fix: topbar handlers

* Hotfix/tables selection (#402)

* fix: notifications selection

* fix: packages selection

* chore: update layout margins

* Fix/layout issues (#403)

* chore: fix styling

* chore: lint

* wip: notification types

* chore: notifications components and logic

* Hotfix/notifications (#404)

* wip: notification details

* wip: notification details

* Notifications/design flow (#405)

* wip: notifications details

* wip: parsing notifications

* wip: notifications epics, fix HMR

* fix: notifications

* fix: selected names

* chore: error message when installation fails

* Feat/sidebar (#407)

* wip: sidebar actions

* fix: npm install with error handling

* fix: general issues

* Hotfix/npm audit doctor (#409)

* wip

* fix: audit and lint

* fix: doctor hooks

* chore: update dependencies, fix issues

* fix: labels

* Feat/mpm dedupe (#412)

* add npm dedupe action

* chore: cleanup

* chore: update images

* chore: bump version

* chore: update readme
  • Loading branch information
rvpanoz authored Aug 12, 2019
1 parent ea1f8f3 commit 0dae2d7
Show file tree
Hide file tree
Showing 147 changed files with 3,499 additions and 2,879 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ module.exports = {
'compat/compat': 'off',
'consistent-return': 'off',
'camelcase': 'off',
'react/jsx-props-no-spreading': 'off',
'prefer-object-spread': 'off',
'comma-dangle': 'off',
'no-underscore-dangle': 'off',
'generator-star-spacing': 'off',
'import/no-unresolved': 'error',
'import/no-duplicates': 'off',
'import/no-extraneous-dependencies': 'off',
'import/prefer-default-export': 'warn',
'no-nested-ternary': 'off',
'no-underscore-dangle': 'off',
'jsx-a11y/anchor-is-valid': 'off',
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ You can view my presentation in the GreeceJS meetup at http://bit.ly/2RES3AN
<img style="margin-top: 8px; vertical-align: middle;" title="luna-1" src="./media/images/luna-1.png"/>
</div>
<div style="flex: 25%;max-width: 25%;padding: 0 4px;">
<img style="margin-top: 8px;
vertical-align: middle;" title="luna-2" src="./media/images/luna-2.png"/>
<img style="margin-top: 8px; vertical-align: middle;" title="luna-2" src="./media/images/luna-2.png"/>
</div>
</div>

Expand Down
177 changes: 35 additions & 142 deletions app/cli/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import cp from 'child_process';
import path from 'path';
import chalk from 'chalk';
// import log from 'electron-log';
import lockVerify from 'lock-verify';
import mk from '../mk';

const { spawn } = cp;
Expand All @@ -32,7 +30,8 @@ const execute = (
manager = defaultManager,
commandArgs = [],
mode,
directory
directory,
packageJson,
) => {
const [operation] = commandArgs;

Expand Down Expand Up @@ -80,15 +79,13 @@ const execute = (
chalk.greenBright.bold(`finished: ${manager} ${commandArgs.join(' ')}`)
);

const resultString = result.join('');
const commandResult = {
return resolve({
status: 'close',
errors,
data: resultString,
cmd: commandArgs
};

return resolve(commandResult);
data: result.join(''),
cmd: commandArgs,
packageJson: Boolean(packageJson)
});
});
});

Expand All @@ -98,18 +95,11 @@ const execute = (
/**
* npm list
* @param {*} options
* @param {*} callback
*/
const list = (options, callback) => {
const list = (options) => {
const command = ['list'];
const { mode, directory, linked } = options || {};

if (!callback || typeof callback !== 'function') {
return Promise.reject(
'manager[list]: callback must be given and must be a function'
);
}

if (!mode || typeof mode !== 'string') {
return Promise.reject(
'manager[list]: mode must be given and must be one of "global" or "local"'
Expand All @@ -125,7 +115,7 @@ const list = (options, callback) => {
: command.concat(defaultsArgs.list);

// returns a Promise
return execute('npm', run, mode, directory, callback);
return execute('npm', run, mode, directory);
} catch (error) {
Promise.reject(error);
}
Expand All @@ -134,18 +124,11 @@ const list = (options, callback) => {
/**
* npm outdated
* @param {*} options
* @param {*} callback
*/
const outdated = (options, callback) => {
const outdated = (options) => {
const command = ['outdated'];
const { mode, directory } = options || {};

if (!callback || typeof callback !== 'function') {
return Promise.reject(
'manager[outdated]: callback must be given and must be a function'
);
}

if (!mode || typeof mode !== 'string') {
return Promise.reject(
'manager[outdated]: mode must be given and must be one of "global" or "local"'
Expand All @@ -159,7 +142,7 @@ const outdated = (options, callback) => {
: command.concat(defaultsArgs.list);

// returns a Promise
return execute('npm', run, mode, directory, callback);
return execute('npm', run, mode, directory);
} catch (error) {
Promise.reject(error);
}
Expand All @@ -168,9 +151,8 @@ const outdated = (options, callback) => {
/**
* npm search
* @param {*} opts
* @param {*} callback
*/
const search = (opts, callback) => {
const search = (opts) => {
const command = ['search'];
const { directory, mode, pkgName } = opts || {};
const defaults = ['--depth=0', '--json'];
Expand All @@ -182,7 +164,7 @@ const search = (opts, callback) => {
try {
const run = command.concat(defaults, pkgName);

return execute('npm', run, mode, directory, callback);
return execute('npm', run, mode, directory);
} catch (error) {
Promise.reject(error);
}
Expand All @@ -191,17 +173,16 @@ const search = (opts, callback) => {
/**
* npm install
* @param {*} opts
* @param {*} callback
* @param {*} idx
*/
const install = (opts, callback, idx) => {
const { mode, directory, activeManager = 'npm' } = opts || {};
const install = (opts, idx) => {
const { mode, directory, packageJson, activeManager = 'npm' } = opts || {};

try {
const runInstall = require('./npm/install').default;
const run = runInstall(opts, idx);

return execute(activeManager, run, mode, directory, callback);
return execute(activeManager, run, mode, directory, packageJson);
} catch (error) {
Promise.reject(error);
}
Expand All @@ -210,16 +191,15 @@ const install = (opts, callback, idx) => {
/**
* npm update
* @param {*} opts
* @param {*} callback
*/
const update = (opts, callback) => {
const update = (opts) => {
const { mode, directory, activeManager = 'npm' } = opts || {};

try {
const runUpdate = require('./npm/update').default;
const run = runUpdate(opts);

return execute(activeManager, run, mode, directory, callback);
return execute(activeManager, run, mode, directory);
} catch (error) {
Promise.reject(error);
}
Expand All @@ -228,16 +208,15 @@ const update = (opts, callback) => {
/**
* npm uninstall
* @param {*} opts
* @param {*} callback
*/
const uninstall = (opts, callback) => {
const uninstall = (opts) => {
const { mode, directory, activeManager = 'npm' } = opts || {};

try {
const runUninstall = require('./npm/uninstall').default;
const run = runUninstall(opts);

return execute(activeManager, run, mode, directory, callback);
return execute(activeManager, run, mode, directory);
} catch (error) {
Promise.reject(error);
}
Expand All @@ -246,16 +225,15 @@ const uninstall = (opts, callback) => {
/**
* npm view
* @param {*} opts
* @param {*} callback
*/
const view = (opts, callback) => {
const view = (opts) => {
const { mode, directory, activeManager = 'npm' } = opts || {};

try {
const runView = require('./npm/view').default;
const run = runView(opts);

return execute(activeManager, run, mode, directory, callback);
return execute(activeManager, run, mode, directory);
} catch (error) {
Promise.reject(error);
}
Expand All @@ -264,16 +242,15 @@ const view = (opts, callback) => {
/**
* npm audit
* @param {*} opts
* @param {*} callback
*/
const runAudit = (opts, callback) => {
const runAudit = (opts) => {
const { activeManager = 'npm', mode, directory, ...options } = opts || {};

try {
const audit = require('./npm/audit').default;
const run = audit(options);

return execute(activeManager, run, mode, directory, callback);
return execute(activeManager, run, mode, directory);
} catch (error) {
Promise.reject(error);
}
Expand All @@ -282,34 +259,32 @@ const runAudit = (opts, callback) => {
/**
* npm doctor
* @param {*} opts
* @param {*} callback
*/
const runDoctor = (opts, callback) => {
const runDoctor = (opts) => {
const { mode, directory, activeManager = 'npm' } = opts || {};

try {
const doctor = require('./npm/doctor').default;
const run = doctor(opts);

return execute(activeManager, run, mode, directory, callback);
return execute(activeManager, run, mode, directory);
} catch (error) {
Promise.reject(error);
}
};

/**
* npm prune
* npm init
* @param {*} opts
* @param {*} callback
*/
const runPrune = (opts, callback) => {
const { mode, directory, activeManager = 'npm' } = opts || {};
const runInit = (opts) => {
const { mode, directory, activeManager = 'npm' } = opts;

try {
const prune = require('./npm/tooling/prune').default;
const run = prune(opts);
const init = require('./npm/tooling/init').default;
const run = init(opts);

return execute(activeManager, run, mode, directory, callback);
return execute(activeManager, run, mode, directory);
} catch (error) {
Promise.reject(error);
}
Expand All @@ -318,107 +293,25 @@ const runPrune = (opts, callback) => {
/**
* npm dedupe
* @param {*} opts
* @param {*} callback
*/
const runDedupe = (opts, callback) => {
const { mode, directory, activeManager = 'npm' } = opts || {};
const runDedupe = (opts) => {
const { mode, directory, activeManager = 'npm' } = opts;

try {
const dedupe = require('./npm/tooling/dedupe').default;
const run = dedupe(opts);

return execute(activeManager, run, mode, directory, callback);
} catch (error) {
Promise.reject(error);
}
};

/**
*
* @param {*} opts
* @param {*} callback
*/
const runVerify = (opts, callback) => {
const { mode, directory, activeManager = 'npm' } = opts;

try {
const verify = require('./npm/tooling/verify').default;
const run = verify(opts);

return execute(activeManager, run, mode, directory, callback);
} catch (error) {
Promise.reject(error);
}
};

/**
* npm cache clean
* @param {*} opts
* @param {*} callback
*/
const runClean = (opts, callback) => {
const { mode, directory, activeManager = 'npm' } = opts;

try {
const clean = require('./npm/tooling/clean').default;
const run = clean(opts);

return execute(activeManager, run, mode, directory, callback);
} catch (error) {
Promise.reject(error);
}
};

/**
* npm init
* @param {*} opts
* @param {*} callback
*/
const runInit = (opts, callback) => {
const { mode, directory, activeManager = 'npm' } = opts;

try {
const init = require('./npm/tooling/init').default;
const run = init(opts);

return execute(activeManager, run, mode, directory, callback);
return execute(activeManager, run, mode, directory);
} catch (error) {
Promise.reject(error);
}
};

/**
*
* @param {*} opts
*/
const runLockVerify = opts => {
const { directory } = opts || {};

lockVerify(directory).then(result => {
result.warnings.forEach(warning => console.error('Warning:', warning));

if (!result.status) {
result.errors.forEach(error => console.error(error));
}

return {
status: 'close',
errors: [],
data: result,
cmd: ['lockVerify']
};
});
};

export default {
init: runInit,
audit: runAudit,
doctor: runDoctor,
prune: runPrune,
dedupe: runDedupe,
verify: runVerify,
clean: runClean,
lockVerify: runLockVerify,
list,
outdated,
search,
Expand Down
Loading

0 comments on commit 0dae2d7

Please sign in to comment.