Skip to content

Commit e65cba2

Browse files
authored
fix: add type commonjs to package.json (#1544)
* fix: add type commonjs to package.json * fix json linting
1 parent 8e36dc9 commit e65cba2

File tree

2 files changed

+88
-87
lines changed

2 files changed

+88
-87
lines changed

dist/index.js

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -80421,92 +80421,6 @@ function wrappy (fn, cb) {
8042180421
}
8042280422

8042380423

80424-
/***/ }),
80425-
80426-
/***/ 9922:
80427-
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
80428-
80429-
const got = __nccwpck_require__(3061)
80430-
const debug = __nccwpck_require__(8237)('@cypress/github-action')
80431-
80432-
/**
80433-
* A small utility for checking when an URL responds, kind of
80434-
* a poor man's https://www.npmjs.com/package/wait-on. This version
80435-
* is implemented using https://github.com/sindresorhus/got
80436-
*/
80437-
const ping = (url, timeout) => {
80438-
if (!timeout) {
80439-
throw new Error('Expected timeout in ms')
80440-
}
80441-
80442-
// make copy of the error codes that "got" retries on
80443-
const errorCodes = [...got.defaults.options.retry.errorCodes]
80444-
errorCodes.push('ESOCKETTIMEDOUT')
80445-
80446-
// we expect the server to respond within a time limit
80447-
// and if it does not - retry up to total "timeout" duration
80448-
const individualPingTimeout = Math.min(timeout, 30000)
80449-
80450-
// add to the timeout max individual ping timeout
80451-
// to avoid long-waiting ping from "rolling" over the end
80452-
// and preventing pinging the last time
80453-
timeout += individualPingTimeout
80454-
const limit = Math.ceil(timeout / individualPingTimeout)
80455-
80456-
debug(`total ping timeout ${timeout}`)
80457-
debug(`individual ping timeout ${individualPingTimeout}ms`)
80458-
debug(`retries limit ${limit}`)
80459-
80460-
const start = +new Date()
80461-
return got(url, {
80462-
headers: {
80463-
Accept: 'text/html, application/json, text/plain, */*'
80464-
},
80465-
timeout: individualPingTimeout,
80466-
errorCodes,
80467-
retry: {
80468-
limit,
80469-
calculateDelay({ error, attemptCount }) {
80470-
if (error) {
80471-
debug(`got error ${JSON.stringify(error)}`)
80472-
}
80473-
const now = +new Date()
80474-
const elapsed = now - start
80475-
debug(
80476-
`${elapsed}ms ${error.method} ${error.host} ${error.code} attempt ${attemptCount}`
80477-
)
80478-
if (elapsed > timeout) {
80479-
console.error(
80480-
'%s timed out on retry %d of %d, elapsed %dms, limit %dms',
80481-
url,
80482-
attemptCount,
80483-
limit,
80484-
elapsed,
80485-
timeout
80486-
)
80487-
return 0
80488-
}
80489-
80490-
// if the error code is ECONNREFUSED use shorter timeout
80491-
// because the server is probably starting
80492-
if (error.code === 'ECONNREFUSED') {
80493-
return 1000
80494-
}
80495-
80496-
// default "long" timeout
80497-
return individualPingTimeout
80498-
}
80499-
}
80500-
}).then(() => {
80501-
const now = +new Date()
80502-
const elapsed = now - start
80503-
debug(`pinging ${url} has finished ok after ${elapsed}ms`)
80504-
})
80505-
}
80506-
80507-
module.exports = { ping }
80508-
80509-
8051080424
/***/ }),
8051180425

8051280426
/***/ 9491:
@@ -91897,6 +91811,92 @@ module.exports.As = safeParse
9189791811
__webpack_unused_export__ = defaultContentType
9189891812

9189991813

91814+
/***/ }),
91815+
91816+
/***/ 2851:
91817+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
91818+
91819+
const got = __nccwpck_require__(3061)
91820+
const debug = __nccwpck_require__(8237)('@cypress/github-action')
91821+
91822+
/**
91823+
* A small utility for checking when an URL responds, kind of
91824+
* a poor man's https://www.npmjs.com/package/wait-on. This version
91825+
* is implemented using https://github.com/sindresorhus/got
91826+
*/
91827+
const ping = (url, timeout) => {
91828+
if (!timeout) {
91829+
throw new Error('Expected timeout in ms')
91830+
}
91831+
91832+
// make copy of the error codes that "got" retries on
91833+
const errorCodes = [...got.defaults.options.retry.errorCodes]
91834+
errorCodes.push('ESOCKETTIMEDOUT')
91835+
91836+
// we expect the server to respond within a time limit
91837+
// and if it does not - retry up to total "timeout" duration
91838+
const individualPingTimeout = Math.min(timeout, 30000)
91839+
91840+
// add to the timeout max individual ping timeout
91841+
// to avoid long-waiting ping from "rolling" over the end
91842+
// and preventing pinging the last time
91843+
timeout += individualPingTimeout
91844+
const limit = Math.ceil(timeout / individualPingTimeout)
91845+
91846+
debug(`total ping timeout ${timeout}`)
91847+
debug(`individual ping timeout ${individualPingTimeout}ms`)
91848+
debug(`retries limit ${limit}`)
91849+
91850+
const start = +new Date()
91851+
return got(url, {
91852+
headers: {
91853+
Accept: 'text/html, application/json, text/plain, */*'
91854+
},
91855+
timeout: individualPingTimeout,
91856+
errorCodes,
91857+
retry: {
91858+
limit,
91859+
calculateDelay({ error, attemptCount }) {
91860+
if (error) {
91861+
debug(`got error ${JSON.stringify(error)}`)
91862+
}
91863+
const now = +new Date()
91864+
const elapsed = now - start
91865+
debug(
91866+
`${elapsed}ms ${error.method} ${error.host} ${error.code} attempt ${attemptCount}`
91867+
)
91868+
if (elapsed > timeout) {
91869+
console.error(
91870+
'%s timed out on retry %d of %d, elapsed %dms, limit %dms',
91871+
url,
91872+
attemptCount,
91873+
limit,
91874+
elapsed,
91875+
timeout
91876+
)
91877+
return 0
91878+
}
91879+
91880+
// if the error code is ECONNREFUSED use shorter timeout
91881+
// because the server is probably starting
91882+
if (error.code === 'ECONNREFUSED') {
91883+
return 1000
91884+
}
91885+
91886+
// default "long" timeout
91887+
return individualPingTimeout
91888+
}
91889+
}
91890+
}).then(() => {
91891+
const now = +new Date()
91892+
const elapsed = now - start
91893+
debug(`pinging ${url} has finished ok after ${elapsed}ms`)
91894+
})
91895+
}
91896+
91897+
module.exports = { ping }
91898+
91899+
9190091900
/***/ }),
9190191901

9190291902
/***/ 8570:
@@ -93275,7 +93275,7 @@ const quote = __nccwpck_require__(5427)
9327593275
const cliParser = __nccwpck_require__(8604)()
9327693276
const findYarnWorkspaceRoot = __nccwpck_require__(6748)
9327793277
const debug = __nccwpck_require__(8237)('@cypress/github-action')
93278-
const { ping } = __nccwpck_require__(9922)
93278+
const { ping } = __nccwpck_require__(2851)
9327993279
const { SUMMARY_ENV_VAR } = __nccwpck_require__(1327)
9328093280

9328193281
/**

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
],
3434
"author": "Cypress-io",
3535
"license": "MIT",
36+
"type": "commonjs",
3637
"bugs": {
3738
"url": "https://github.com/cypress-io/github-action/issues"
3839
},

0 commit comments

Comments
 (0)