mirror of
				https://gitea.com/actions/setup-python.git
				synced 2025-11-02 07:47:09 +00:00 
			
		
		
		
	Initial pass
This commit is contained in:
		
							
								
								
									
										12
									
								
								node_modules/please-upgrade-node/.eslintrc.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								node_modules/please-upgrade-node/.eslintrc.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
  plugins: ['prettier'],
 | 
			
		||||
  rules: {
 | 
			
		||||
    'prettier/prettier': [
 | 
			
		||||
      'error',
 | 
			
		||||
      {
 | 
			
		||||
        singleQuote: true,
 | 
			
		||||
        semi: false,
 | 
			
		||||
      },
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										21
									
								
								node_modules/please-upgrade-node/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/please-upgrade-node/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -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.
 | 
			
		||||
							
								
								
									
										65
									
								
								node_modules/please-upgrade-node/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								node_modules/please-upgrade-node/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
			
		||||
# Please upgrade Node [](https://www.npmjs.org/package/please-upgrade-node) [](https://travis-ci.org/typicode/please-upgrade-node) [](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 the `npm` 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
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Install
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
npm install please-upgrade-node
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
#!/usr/bin/env node
 | 
			
		||||
const pkg = require('./package.json')
 | 
			
		||||
require('please-upgrade-node')(pkg)
 | 
			
		||||
// Must run BEFORE requiring other modules
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
// package.json
 | 
			
		||||
{
 | 
			
		||||
  "bin": "./bin.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 also pass custom `exitCode` (default: `1`) or `message` function
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
pleaseUpgradeNode(pkg, {
 | 
			
		||||
  exitCode: 0,
 | 
			
		||||
  message: function(requiredVersion) {
 | 
			
		||||
    return 'Oops, this program requires 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)
 | 
			
		||||
							
								
								
									
										25
									
								
								node_modules/please-upgrade-node/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								node_modules/please-upgrade-node/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -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)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										71
									
								
								node_modules/please-upgrade-node/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								node_modules/please-upgrade-node/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,71 @@
 | 
			
		||||
{
 | 
			
		||||
  "_args": [
 | 
			
		||||
    [
 | 
			
		||||
      "please-upgrade-node@3.1.1",
 | 
			
		||||
      "C:\\Users\\Administrator\\Documents\\setup-python"
 | 
			
		||||
    ]
 | 
			
		||||
  ],
 | 
			
		||||
  "_development": true,
 | 
			
		||||
  "_from": "please-upgrade-node@3.1.1",
 | 
			
		||||
  "_id": "please-upgrade-node@3.1.1",
 | 
			
		||||
  "_inBundle": false,
 | 
			
		||||
  "_integrity": "sha512-KY1uHnQ2NlQHqIJQpnh/i54rKkuxCEBx+voJIS/Mvb+L2iYd2NMotwduhKTMjfC1uKoX3VXOxLjIYG66dfJTVQ==",
 | 
			
		||||
  "_location": "/please-upgrade-node",
 | 
			
		||||
  "_phantomChildren": {},
 | 
			
		||||
  "_requested": {
 | 
			
		||||
    "type": "version",
 | 
			
		||||
    "registry": true,
 | 
			
		||||
    "raw": "please-upgrade-node@3.1.1",
 | 
			
		||||
    "name": "please-upgrade-node",
 | 
			
		||||
    "escapedName": "please-upgrade-node",
 | 
			
		||||
    "rawSpec": "3.1.1",
 | 
			
		||||
    "saveSpec": null,
 | 
			
		||||
    "fetchSpec": "3.1.1"
 | 
			
		||||
  },
 | 
			
		||||
  "_requiredBy": [
 | 
			
		||||
    "/husky"
 | 
			
		||||
  ],
 | 
			
		||||
  "_resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz",
 | 
			
		||||
  "_spec": "3.1.1",
 | 
			
		||||
  "_where": "C:\\Users\\Administrator\\Documents\\setup-python",
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "typicode"
 | 
			
		||||
  },
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://github.com/typicode/please-upgrade-node/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "semver-compare": "^1.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "description": "Displays a beginner-friendly message telling your user to upgrade their version of Node",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "eslint": "^4.19.1",
 | 
			
		||||
    "eslint-plugin-prettier": "^2.6.0",
 | 
			
		||||
    "pkg-ok": "^1.1.0",
 | 
			
		||||
    "prettier": "1.12.1",
 | 
			
		||||
    "tape": "^4.9.1"
 | 
			
		||||
  },
 | 
			
		||||
  "homepage": "https://github.com/typicode/please-upgrade-node#readme",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "node",
 | 
			
		||||
    "engines",
 | 
			
		||||
    "version",
 | 
			
		||||
    "check",
 | 
			
		||||
    "verify",
 | 
			
		||||
    "upgrade"
 | 
			
		||||
  ],
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
  "name": "please-upgrade-node",
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "git+https://github.com/typicode/please-upgrade-node.git"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "fix": "npm run lint -- --fix",
 | 
			
		||||
    "lint": "eslint .",
 | 
			
		||||
    "prepublishOnly": "npm test && npm run lint && pkg-ok",
 | 
			
		||||
    "test": "node test"
 | 
			
		||||
  },
 | 
			
		||||
  "version": "3.1.1"
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user