Skip to content

Commit

Permalink
Merge e2e247c into fdd6904
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Ruhs committed Oct 6, 2021
2 parents fdd6904 + e2e247c commit da4a2d9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
7 changes: 2 additions & 5 deletions bin/handpick
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

const program = require('commander');
const ora = require('ora');
const createSpinner = require('nanospinner').createSpinner;
const handpick = require('../');
const core = handpick.core;
const option = handpick.option;
Expand Down Expand Up @@ -34,10 +34,7 @@ option.initWithConfig(
});
CORE = new core(
{
spinner: ora(
{
spinner: 'bouncingBar'
}),
spinner: createSpinner(),
option
});
CORE.init();
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "handpick",
"description": "Handpick conditional dependencies like a boss",
"version": "3.2.0",
"version": "4.0.0",
"license": "MIT",
"keywords":
[
Expand All @@ -26,15 +26,15 @@
"dependencies":
{
"commander": "6.2.1",
"ora": "5.1.0",
"nanospinner": "0.2.1",
"semver": "7.3.4",
"utility-redaxmedia": "1.1.0"
},
"devDependencies":
{
"chai": "4.2.0",
"eslint": "6.8.0",
"eslint-config-redaxmedia": "3.0.0",
"eslint-config-redaxmedia": "3.2.0",
"mocha": "7.2.0"
},
"scripts":
Expand Down
29 changes: 23 additions & 6 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,16 @@ function init()
let originalContent = null;
let managerProcess = null;

spinner.start(startWording());
spinner.start();
spinner.update(
{
text: startWording()
});
readPackageFile()
.then(content =>
{
originalContent = content;

return helper.json.parse(content);
})
.then(packageObject =>
Expand All @@ -269,9 +274,15 @@ function init()
managerProcess.on('close', code =>
{
writePackageFile(originalContent)
.then(code === 0 ? spinner.succeed() : spinner.fail())
.then(spinner.info(endWording(startTime, Date.now(), startPackage, countPackageDirectory())))
.catch(error => spinner.fail(error.toString()));
.then(code === 0 ? spinner.success() : spinner.error())
.then(spinner.update(
{
text: endWording(startTime, Date.now(), startPackage, countPackageDirectory())
}))
.catch(error => spinner.error(
{
text: error.toString()
}));
});
managerProcess.on('error', () => null);
[
Expand All @@ -288,9 +299,15 @@ function init()
}));
});
})
.catch(error => spinner.fail(error.toString()));
.catch(error => spinner.error(
{
text: error.toString()
}));
})
.catch(error => spinner.fail(error.toString()));
.catch(error => spinner.error(
{
text: error.toString()
}));
}

/**
Expand Down

0 comments on commit da4a2d9

Please sign in to comment.