Skip to content

Commit

Permalink
Require Node.js 10
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Sep 29, 2020
1 parent 3dfe42d commit 5b440c2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- '14'
- '12'
- '10'
- '8'
10 changes: 5 additions & 5 deletions index.js
Expand Up @@ -55,7 +55,7 @@ class UpdateNotifier {
// after the set interval, so not to bother users right away
lastUpdateCheck: Date.now()
});
} catch (_) {
} catch {
// Expecting error code EACCES or EPERM
const message =
chalk().yellow(format(' %s update check failed ', options.pkg.name)) +
Expand Down Expand Up @@ -119,13 +119,13 @@ class UpdateNotifier {
return this;
}

options = Object.assign({
options = {
isGlobal: isInstalledGlobally(),
isYarnGlobal: isYarnGlobal()()
}, options);
isYarnGlobal: isYarnGlobal()(),
...options
};

let installCommand;

if (options.isYarnGlobal) {
installCommand = `yarn global add ${this.packageName}`;
} else if (options.isGlobal) {
Expand Down
15 changes: 5 additions & 10 deletions package.json
Expand Up @@ -11,10 +11,10 @@
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=10"
},
"scripts": {
"test": "xo && ava --timeout=20s -s"
"test": "xo && ava --timeout=20s --serial"
},
"files": [
"index.js",
Expand All @@ -35,13 +35,13 @@
],
"dependencies": {
"boxen": "^4.2.0",
"chalk": "^3.0.0",
"chalk": "^4.1.0",
"configstore": "^5.0.1",
"has-yarn": "^2.1.0",
"import-lazy": "^2.1.0",
"is-ci": "^2.0.0",
"is-installed-globally": "^0.3.1",
"is-npm": "^4.0.0",
"is-npm": "^5.0.0",
"is-yarn-global": "^0.3.0",
"latest-version": "^5.0.0",
"pupa": "^2.0.1",
Expand All @@ -55,11 +55,6 @@
"fixture-stdout": "^0.2.1",
"mock-require": "^3.0.3",
"strip-ansi": "^6.0.0",
"xo": "^0.25.0"
},
"xo": {
"rules": {
"prefer-object-spread": 0
}
"xo": "^0.33.1"
}
}
5 changes: 4 additions & 1 deletion test/fs-error.js
Expand Up @@ -4,7 +4,10 @@ import test from 'ava';
let updateNotifier;

test.before(() => {
['..', 'configstore', 'xdg-basedir'].forEach(clearModule);
for (const name of ['..', 'configstore', 'xdg-basedir']) {
clearModule(name);
}

// Set configstore.config to something that requires root access
process.env.XDG_CONFIG_HOME = '/usr';
updateNotifier = require('..');
Expand Down
5 changes: 4 additions & 1 deletion test/notify.js
Expand Up @@ -19,7 +19,10 @@ function Control(shouldNotifyInNpmScript) {
}

const setupTest = isNpmReturnValue => {
['..', 'is-npm'].forEach(clearModule);
for (const name of ['..', 'is-npm']) {
clearModule(name);
}

process.stdout.isTTY = true;
mock('is-npm', {isNpmOrYarn: isNpmReturnValue || false});
const updateNotifier = require('..');
Expand Down

0 comments on commit 5b440c2

Please sign in to comment.