summaryrefslogtreecommitdiff
path: root/node_modules/please-upgrade-node
diff options
context:
space:
mode:
authorShipwreckt <me@shipwreckt.co.uk>2025-10-31 20:02:14 +0000
committerShipwreckt <me@shipwreckt.co.uk>2025-10-31 20:02:14 +0000
commit7a52ddeba2a68388b544f529d2d92104420f77b0 (patch)
tree15ddd47457a2cb4a96060747437d36474e4f6b4e /node_modules/please-upgrade-node
parent53d6ae2b5568437afa5e4995580a3fb679b7b91b (diff)
Changed from static to 11ty!
Diffstat (limited to 'node_modules/please-upgrade-node')
-rw-r--r--node_modules/please-upgrade-node/.eslintrc.js12
-rw-r--r--node_modules/please-upgrade-node/.github/FUNDING.yml1
-rw-r--r--node_modules/please-upgrade-node/LICENSE21
-rw-r--r--node_modules/please-upgrade-node/README.md72
-rw-r--r--node_modules/please-upgrade-node/index.d.ts11
-rw-r--r--node_modules/please-upgrade-node/index.js25
-rw-r--r--node_modules/please-upgrade-node/package.json46
7 files changed, 188 insertions, 0 deletions
diff --git a/node_modules/please-upgrade-node/.eslintrc.js b/node_modules/please-upgrade-node/.eslintrc.js
new file mode 100644
index 0000000..7a16026
--- /dev/null
+++ b/node_modules/please-upgrade-node/.eslintrc.js
@@ -0,0 +1,12 @@
+module.exports = {
+ plugins: ['prettier'],
+ rules: {
+ 'prettier/prettier': [
+ 'error',
+ {
+ singleQuote: true,
+ semi: false,
+ },
+ ]
+ }
+}
diff --git a/node_modules/please-upgrade-node/.github/FUNDING.yml b/node_modules/please-upgrade-node/.github/FUNDING.yml
new file mode 100644
index 0000000..f433b7e
--- /dev/null
+++ b/node_modules/please-upgrade-node/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: typicode
diff --git a/node_modules/please-upgrade-node/LICENSE b/node_modules/please-upgrade-node/LICENSE
new file mode 100644
index 0000000..8864d4a
--- /dev/null
+++ b/node_modules/please-upgrade-node/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/please-upgrade-node/README.md b/node_modules/please-upgrade-node/README.md
new file mode 100644
index 0000000..28bb5a2
--- /dev/null
+++ b/node_modules/please-upgrade-node/README.md
@@ -0,0 +1,72 @@
+# Please upgrade Node [![](http://img.shields.io/npm/dm/please-upgrade-node.svg?style=flat)](https://www.npmjs.org/package/please-upgrade-node) [![Build Status](https://travis-ci.org/typicode/please-upgrade-node.svg?branch=master)](https://travis-ci.org/typicode/please-upgrade-node) [![npm](https://img.shields.io/npm/v/please-upgrade-node.svg)](https://www.npmjs.com/package/please-upgrade-node)
+
+> :information_desk_person: show a message to your users to upgrade Node instead of a stacktrace
+
+It's common for new Node users to miss or not understand engines warning when installing a CLI. This package displays a beginner-friendly message if their Node version is below the one expected.
+
+```sh
+$ node -v
+0.12
+
+$ modern-cli
+modern-cli requires at least version 6 of Node, please upgrade
+```
+
+## Support
+
+If you like this project, you can support me on [GitHub Sponsors](https://github.com/users/typicode/sponsorship)
+
+## Usage
+
+```sh
+npm install please-upgrade-node
+```
+
+Add `please-upgrade-node` at the top of your CLI
+
+```js
+#!/usr/bin/env node
+const pkg = require('./package.json')
+require('please-upgrade-node')(pkg) // <- Must run BEFORE requiring any other modules
+
+// ...
+```
+
+Set in your `package.json` the required Node version
+
+```js
+{
+ "engines": {
+ "node": ">=6"
+ }
+}
+```
+
+__Important__: `>=` is the only operator supported by `please-upgrade-node` (e.g. `>=6`, `>=6.0`, `>=6.0.0`).
+
+## Options
+
+You can set custom `exitCode` and `message` function if needed
+
+```js
+pleaseUpgradeNode(pkg, {
+ exitCode: 0, // Default: 1
+ message: function(requiredVersion) {
+ return 'Oops this program require Node ' + requiredVersion
+ }
+})
+```
+
+__Important__: to keep `message` function compatible with older versions of Node, avoid using ES6 features like `=>` or string interpolation.
+
+## See also
+
+* [pkg-ok](https://github.com/typicode/pkg-ok) - :ok_hand: Prevents publishing a module with bad paths
+* [husky](https://github.com/typicode/husky) - :dog: Git hooks made easy
+* [update-notifier](https://github.com/yeoman/update-notifier) - Update notifications for your CLI app
+
+Thanks to [zeit/serve](https://github.com/zeit/serve) for the error message inspiration.
+
+## License
+
+MIT - [Typicode :cactus:](https://github.com/typicode) - [Patreon](https://patreon.com/typicode)
diff --git a/node_modules/please-upgrade-node/index.d.ts b/node_modules/please-upgrade-node/index.d.ts
new file mode 100644
index 0000000..b5d6b51
--- /dev/null
+++ b/node_modules/please-upgrade-node/index.d.ts
@@ -0,0 +1,11 @@
+interface Options {
+ exitCode: number;
+ message: (version: string) => string;
+}
+
+declare function pleaseUpgradeNode(
+ pkg: Record<string, unknown>,
+ opts?: Partial<Options>
+): void;
+
+export = pleaseUpgradeNode;
diff --git a/node_modules/please-upgrade-node/index.js b/node_modules/please-upgrade-node/index.js
new file mode 100644
index 0000000..9023106
--- /dev/null
+++ b/node_modules/please-upgrade-node/index.js
@@ -0,0 +1,25 @@
+var semverCompare = require('semver-compare')
+
+module.exports = function pleaseUpgradeNode(pkg, opts) {
+ var opts = opts || {}
+ var requiredVersion = pkg.engines.node.replace('>=', '')
+ var currentVersion = process.version.replace('v', '')
+ if (semverCompare(currentVersion, requiredVersion) === -1) {
+ if (opts.message) {
+ console.error(opts.message(requiredVersion))
+ } else {
+ console.error(
+ pkg.name +
+ ' requires at least version ' +
+ requiredVersion +
+ ' of Node, please upgrade'
+ )
+ }
+
+ if (opts.hasOwnProperty('exitCode')) {
+ process.exit(opts.exitCode)
+ } else {
+ process.exit(1)
+ }
+ }
+}
diff --git a/node_modules/please-upgrade-node/package.json b/node_modules/please-upgrade-node/package.json
new file mode 100644
index 0000000..087b454
--- /dev/null
+++ b/node_modules/please-upgrade-node/package.json
@@ -0,0 +1,46 @@
+{
+ "name": "please-upgrade-node",
+ "version": "3.2.0",
+ "description": "Displays a beginner-friendly message telling your user to upgrade their version of Node",
+ "main": "index.js",
+ "scripts": {
+ "test": "node test",
+ "lint": "eslint .",
+ "fix": "npm run lint -- --fix",
+ "prepublishOnly": "npm test && npm run lint && pkg-ok"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/typicode/please-upgrade-node.git"
+ },
+ "keywords": [
+ "node",
+ "engines",
+ "version",
+ "check",
+ "verify",
+ "upgrade"
+ ],
+ "author": "typicode",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/typicode/please-upgrade-node/issues"
+ },
+ "homepage": "https://github.com/typicode/please-upgrade-node#readme",
+ "devDependencies": {
+ "eslint": "^4.19.1",
+ "eslint-plugin-prettier": "^2.6.0",
+ "husky": "^1.0.0-rc.12",
+ "pkg-ok": "^1.1.0",
+ "prettier": "1.12.1",
+ "tape": "^4.9.1"
+ },
+ "dependencies": {
+ "semver-compare": "^1.0.0"
+ },
+ "husky": {
+ "hooks": {
+ "pre-commit": "npm test && npm run lint"
+ }
+ }
+}