Skip to content

Commit 0dbb422

Browse files
committed
add time logger
1 parent 6e8383b commit 0dbb422

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@ const { extract } = require('pacote');
88
const fs = require("fs-extra");
99
const os = require('os');
1010
const packageName = 'html5-boilerplate';
11+
const elapsed = require("elapsed-time-logger");
1112

1213
(async () => {
14+
const timer = elapsed.start();
1315
const version = argv['release'] || 'latest';
1416
const targetDir = path.resolve(argv['_'][0] || './');
1517
const spinner = ora(`Downloading ${packageName} version '${version}' to ${targetDir}`).start();
1618
const tempDir = os.tmpdir()+`/${packageName}-staging`;
1719
await fs.ensureDir(tempDir);
1820
try{
1921
const { from: nameWithVersion } = await extract(packageName + '@' + version, tempDir, {});
20-
spinner.text = `${nameWithVersion} copied to ${targetDir}. Have fun!`;
22+
spinner.text = `${nameWithVersion} copied to ${targetDir} in ${timer.get()}. Have fun!`;
2123
}catch(err){
2224
await fs.remove(tempDir);
2325
if(err.code === 'ETARGET'){

package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"license": "ISC",
1616
"dependencies": {
1717
"chalk": "^4.0.0",
18+
"elapsed-time-logger": "^1.1.2",
1819
"fs-extra": "^9.0.0",
1920
"ora": "^4.0.4",
2021
"pacote": "^11.1.10",

0 commit comments

Comments
 (0)