mirror of
https://code.forgejo.org/actions/setup-node
synced 2025-05-10 17:12:34 +00:00
Add auth support (#21)
* Updates * Update * Update * Update * Update * Yarn sometimes prefers npmrc, so use same token * Description * Update readme * Feedback * Add type * new toolkit and scoped registries * npmrc in RUNNER_TEMP * Dont always auth * Try exporting blank token * Get auth working for now pending runner changes * Fix string interpolation for auth token. * Don't export both userconfigs * Update authutil.js * Add single quotes for authString * Fix the registry string. * Use userconfig and append trailing slash * Keep in root of repo * Try just adding auth token * Remove auth token * Try changes again * Add tests * Npm and GPR samples * Add types
This commit is contained in:
parent
0675b87d74
commit
78148dae50
391 changed files with 79848 additions and 43 deletions
38
node_modules/universal-user-agent/.travis.yml
generated
vendored
Normal file
38
node_modules/universal-user-agent/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
language: node_js
|
||||
cache:
|
||||
directories:
|
||||
- ~/.npm
|
||||
- node_modules/cypress/dist
|
||||
|
||||
# Trigger a push build on master and greenkeeper branches + PRs build on every branches
|
||||
# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^greenkeeper.*$/
|
||||
|
||||
stages:
|
||||
- test
|
||||
- name: release
|
||||
if: branch = master AND type IN (push)
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: test
|
||||
node_js: 6
|
||||
script: npm run test
|
||||
- node_js: 8
|
||||
script: npm run test
|
||||
- node_js: 10
|
||||
env: Node 10 & coverage upload
|
||||
script:
|
||||
- npm run test
|
||||
- npm run coverage:upload
|
||||
- node_js: lts/*
|
||||
env: browser tests
|
||||
script: npm run test:browser
|
||||
|
||||
- stage: release
|
||||
node_js: lts/*
|
||||
env: semantic-release
|
||||
script: npm run semantic-release
|
7
node_modules/universal-user-agent/LICENSE.md
generated
vendored
Normal file
7
node_modules/universal-user-agent/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
# [ISC License](https://spdx.org/licenses/ISC)
|
||||
|
||||
Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m)
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
25
node_modules/universal-user-agent/README.md
generated
vendored
Normal file
25
node_modules/universal-user-agent/README.md
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
# universal-user-agent
|
||||
|
||||
> Get a user agent string in both browser and node
|
||||
|
||||
[](https://www.npmjs.com/package/universal-user-agent)
|
||||
[](https://travis-ci.com/gr2m/universal-user-agent)
|
||||
[](https://coveralls.io/github/gr2m/universal-user-agent)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
```js
|
||||
const getUserAgent = require('universal-user-agent')
|
||||
const userAgent = getUserAgent()
|
||||
|
||||
// userAgent will look like this
|
||||
// in browser: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0"
|
||||
// in node: Node.js/v8.9.4 (macOS High Sierra; x64)
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
The Node implementation was originally inspired by [default-user-agent](https://www.npmjs.com/package/default-user-agent).
|
||||
|
||||
## License
|
||||
|
||||
[ISC](LICENSE.md)
|
6
node_modules/universal-user-agent/browser.js
generated
vendored
Normal file
6
node_modules/universal-user-agent/browser.js
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
module.exports = getUserAgentBrowser
|
||||
|
||||
function getUserAgentBrowser () {
|
||||
/* global navigator */
|
||||
return navigator.userAgent
|
||||
}
|
4
node_modules/universal-user-agent/cypress.json
generated
vendored
Normal file
4
node_modules/universal-user-agent/cypress.json
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"integrationFolder": "test",
|
||||
"video": false
|
||||
}
|
1
node_modules/universal-user-agent/index.d.ts
generated
vendored
Normal file
1
node_modules/universal-user-agent/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function getUserAgentNode(): string;
|
15
node_modules/universal-user-agent/index.js
generated
vendored
Normal file
15
node_modules/universal-user-agent/index.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
module.exports = getUserAgentNode
|
||||
|
||||
const osName = require('os-name')
|
||||
|
||||
function getUserAgentNode () {
|
||||
try {
|
||||
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`
|
||||
} catch (error) {
|
||||
if (/wmic os get Caption/.test(error.message)) {
|
||||
return 'Windows <version undetectable>'
|
||||
}
|
||||
|
||||
throw error
|
||||
}
|
||||
}
|
82
node_modules/universal-user-agent/package.json
generated
vendored
Normal file
82
node_modules/universal-user-agent/package.json
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
"_from": "universal-user-agent@^2.0.3",
|
||||
"_id": "universal-user-agent@2.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-8itiX7G05Tu3mGDTdNY2fB4KJ8MgZLS54RdG6PkkfwMAavrXu1mV/lls/GABx9O3Rw4PnTtasxrvbMQoBYY92Q==",
|
||||
"_location": "/universal-user-agent",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "universal-user-agent@^2.0.3",
|
||||
"name": "universal-user-agent",
|
||||
"escapedName": "universal-user-agent",
|
||||
"rawSpec": "^2.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@octokit/graphql"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-2.1.0.tgz",
|
||||
"_shasum": "5abfbcc036a1ba490cb941f8fd68c46d3669e8e4",
|
||||
"_spec": "universal-user-agent@^2.0.3",
|
||||
"_where": "C:\\Users\\Administrator\\Documents\\setup-node\\node_modules\\@octokit\\graphql",
|
||||
"author": {
|
||||
"name": "Gregor Martynus",
|
||||
"url": "https://github.com/gr2m"
|
||||
},
|
||||
"browser": "browser.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/gr2m/universal-user-agent/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"os-name": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Get a user agent string in both browser and node",
|
||||
"devDependencies": {
|
||||
"chai": "^4.1.2",
|
||||
"coveralls": "^3.0.2",
|
||||
"cypress": "^3.1.0",
|
||||
"mocha": "^6.0.0",
|
||||
"nyc": "^14.0.0",
|
||||
"proxyquire": "^2.1.0",
|
||||
"semantic-release": "^15.9.15",
|
||||
"sinon": "^7.2.4",
|
||||
"sinon-chai": "^3.2.0",
|
||||
"standard": "^12.0.1",
|
||||
"test": "^0.6.0",
|
||||
"travis-deploy-once": "^5.0.7"
|
||||
},
|
||||
"homepage": "https://github.com/gr2m/universal-user-agent#readme",
|
||||
"keywords": [],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "universal-user-agent",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/gr2m/universal-user-agent.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "nyc report --reporter=html && open coverage/index.html",
|
||||
"coverage:upload": "nyc report --reporter=text-lcov | coveralls",
|
||||
"pretest": "standard",
|
||||
"semantic-release": "semantic-release",
|
||||
"test": "nyc mocha \"test/*-test.js\"",
|
||||
"test:browser": "cypress run --browser chrome",
|
||||
"travis-deploy-once": "travis-deploy-once"
|
||||
},
|
||||
"standard": {
|
||||
"globals": [
|
||||
"describe",
|
||||
"it",
|
||||
"beforeEach",
|
||||
"afterEach",
|
||||
"expect"
|
||||
]
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "2.1.0"
|
||||
}
|
57
node_modules/universal-user-agent/test/smoke-test.js
generated
vendored
Normal file
57
node_modules/universal-user-agent/test/smoke-test.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
// make tests run in both Node & Express
|
||||
if (!global.cy) {
|
||||
const chai = require('chai')
|
||||
const sinon = require('sinon')
|
||||
const sinonChai = require('sinon-chai')
|
||||
chai.use(sinonChai)
|
||||
global.expect = chai.expect
|
||||
|
||||
let sandbox
|
||||
beforeEach(() => {
|
||||
sandbox = sinon.createSandbox()
|
||||
global.cy = {
|
||||
stub: function () {
|
||||
return sandbox.stub.apply(sandbox, arguments)
|
||||
},
|
||||
log () {
|
||||
console.log.apply(console, arguments)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
sandbox.restore()
|
||||
})
|
||||
}
|
||||
|
||||
const getUserAgent = require('..')
|
||||
|
||||
describe('smoke', () => {
|
||||
it('works', () => {
|
||||
expect(getUserAgent()).to.be.a('string')
|
||||
expect(getUserAgent().length).to.be.above(10)
|
||||
})
|
||||
|
||||
if (!process.browser) { // test on node only
|
||||
const proxyquire = require('proxyquire').noCallThru()
|
||||
it('works around wmic error on Windows (#5)', () => {
|
||||
const getUserAgent = proxyquire('..', {
|
||||
'os-name': () => {
|
||||
throw new Error('Command failed: wmic os get Caption')
|
||||
}
|
||||
})
|
||||
|
||||
expect(getUserAgent()).to.equal('Windows <version undetectable>')
|
||||
})
|
||||
|
||||
it('does not swallow unexpected errors', () => {
|
||||
const getUserAgent = proxyquire('..', {
|
||||
'os-name': () => {
|
||||
throw new Error('oops')
|
||||
}
|
||||
})
|
||||
|
||||
expect(getUserAgent).to.throw('oops')
|
||||
})
|
||||
}
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue