feature: add fingerprint integration (#231)

# Why

to dogfood `@expo/fingerprint`, this pr tries to the fingerprint integration.
close [ENG-8599](https://linear.app/expo/issue/ENG-8599/integrate-expofingerprint-to-expo-github-action)

# How

this pr introduces two new actions, mainly designed for pull requests.

## fingerprint

the action will check the fingerprint from the pr head commit against base commit and just output the fingerprint diff. this could be used for something like [pr labeler](https://github.com/Kudo/eas-app/blob/main/.github/workflows/pr-labeler.yml).

## preview-build

the action will check the fingerprint from the pr head commit against base commit and create eas builds if necessary. [example workflow](https://github.com/Kudo/eas-app/blob/main/.github/workflows/pr-preview-eas-build.yml)
This commit is contained in:
Kudo Chien authored and GitHub committed 2023-09-21 00:39:56 +08:00
1 parent 7bc946c5f6
commit e6622e076d
30 files changed
+239810 -406

No files matched your search

+104
View File
@@ -20150,6 +20150,14 @@ module.exports = require("https");
/***/ }),
/***/ 8188:
/***/ ((module) => {
"use strict";
module.exports = require("module");
/***/ }),
/***/ 1808:
/***/ ((module) => {
@@ -20518,6 +20526,58 @@ async function easBuild(cmd) {
}
return JSON.parse(stdout);
}
/**
* Create an new EAS build using the user-provided command.
*/
async function createEasBuildFromRawCommandAsync(cwd, command, extraArgs = []) {
let stdout = '';
let cmd = command;
if (!cmd.includes('--json')) {
cmd += ' --json';
}
if (!cmd.includes('--non-interactive')) {
cmd += ' --non-interactive';
}
if (!cmd.includes('--no-wait')) {
cmd += ' --no-wait';
}
try {
({ stdout } = await getExecOutput((await which('eas', true)) + ` ${cmd}`, extraArgs, {
cwd,
}));
}
catch (error) {
throw new Error(`Could not run command eas build, reason:\n${errorMessage(error)}`);
}
return JSON.parse(stdout);
}
/**
* Cancel an EAS build.
*/
async function cancelEasBuildAsync(cwd, buildId) {
try {
await getExecOutput(await which('eas', true), ['build:cancel', buildId], { cwd });
}
catch (e) {
info(`Failed to cancel build ${buildId}: ${errorMessage(e)}`);
}
}
/**
* Query the EAS BuildInfo from given buildId.
*/
async function queryEasBuildInfoAsync(cwd, buildId) {
try {
const { stdout } = await getExecOutput(await which('eas', true), ['build:view', buildId, '--json'], {
cwd,
silent: true,
});
return JSON.parse(stdout);
}
catch (e) {
info(`Failed to query eas build ${buildId}: ${errorMessage(e)}`);
}
return null;
}
/**
* Try to resolve the project info, by running 'expo config --type prebuild'.
*/
@@ -20687,6 +20747,39 @@ function issueComment() {
},
];
}
/**
* Get the commit message for a specific commit hash.
*/
async function getGitCommandMessageAsync(options, gitCommitHash) {
const github = githubApi({ token: options.token });
const result = await github.rest.git.getCommit({
...context.repo,
commit_sha: gitCommitHash,
});
return result.data.message;
}
/**
* True if the current event is a push to the default branch.
*/
function isPushDefaultBranchContext() {
return context.eventName === 'push' && context.ref === `refs/heads/${context.payload?.repository?.default_branch}`;
}
/**
* Get the pull request information that associated with a specific commit hash.
*/
async function getPullRequestFromGitCommitShaAsync(options, gitCommitHash) {
const github = githubApi({ token: options.token });
const results = await github.rest.repos.listPullRequestsAssociatedWithCommit({
...context.repo,
commit_sha: gitCommitHash,
});
return results.data.map(pr => ({
id: pr.id,
prNumber: pr.number,
prHeadCommitSha: pr.head.sha,
mergeCommitSha: pr.merge_commit_sha,
}));
}
// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(2037);
@@ -20764,6 +20857,17 @@ function toolPath(name, version) {
assert(process.env['RUNNER_TOOL_CACHE'], 'Could not resolve the local tool cache, RUNNER_TOOL_CACHE not defined');
return path.join(process.env['RUNNER_TOOL_CACHE'], name, version, os.arch());
}
/**
* Add extra `searchPath` to the global search path for require()
*/
function addGlobalNodeSearchPath(searchPath) {
const nodePath = process.env['NODE_PATH'] || '';
const delimiter = process.platform === 'win32' ? ';' : ':';
const nodePaths = nodePath.split(delimiter);
nodePaths.push(searchPath);
process.env['NODE_PATH'] = nodePaths.join(delimiter);
(__nccwpck_require__(8188).Module._initPaths)();
}
;// CONCATENATED MODULE: ./src/actions/command.ts
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+104
View File
@@ -20150,6 +20150,14 @@ module.exports = require("https");
/***/ }),
/***/ 8188:
/***/ ((module) => {
"use strict";
module.exports = require("module");
/***/ }),
/***/ 1808:
/***/ ((module) => {
@@ -20519,6 +20527,58 @@ async function easBuild(cmd) {
}
return JSON.parse(stdout);
}
/**
* Create an new EAS build using the user-provided command.
*/
async function createEasBuildFromRawCommandAsync(cwd, command, extraArgs = []) {
let stdout = '';
let cmd = command;
if (!cmd.includes('--json')) {
cmd += ' --json';
}
if (!cmd.includes('--non-interactive')) {
cmd += ' --non-interactive';
}
if (!cmd.includes('--no-wait')) {
cmd += ' --no-wait';
}
try {
({ stdout } = await getExecOutput((await which('eas', true)) + ` ${cmd}`, extraArgs, {
cwd,
}));
}
catch (error) {
throw new Error(`Could not run command eas build, reason:\n${errorMessage(error)}`);
}
return JSON.parse(stdout);
}
/**
* Cancel an EAS build.
*/
async function cancelEasBuildAsync(cwd, buildId) {
try {
await getExecOutput(await which('eas', true), ['build:cancel', buildId], { cwd });
}
catch (e) {
info(`Failed to cancel build ${buildId}: ${errorMessage(e)}`);
}
}
/**
* Query the EAS BuildInfo from given buildId.
*/
async function queryEasBuildInfoAsync(cwd, buildId) {
try {
const { stdout } = await getExecOutput(await which('eas', true), ['build:view', buildId, '--json'], {
cwd,
silent: true,
});
return JSON.parse(stdout);
}
catch (e) {
info(`Failed to query eas build ${buildId}: ${errorMessage(e)}`);
}
return null;
}
/**
* Try to resolve the project info, by running 'expo config --type prebuild'.
*/
@@ -20688,6 +20748,39 @@ function issueComment() {
},
];
}
/**
* Get the commit message for a specific commit hash.
*/
async function getGitCommandMessageAsync(options, gitCommitHash) {
const github = githubApi({ token: options.token });
const result = await github.rest.git.getCommit({
...context.repo,
commit_sha: gitCommitHash,
});
return result.data.message;
}
/**
* True if the current event is a push to the default branch.
*/
function isPushDefaultBranchContext() {
return context.eventName === 'push' && context.ref === `refs/heads/${context.payload?.repository?.default_branch}`;
}
/**
* Get the pull request information that associated with a specific commit hash.
*/
async function getPullRequestFromGitCommitShaAsync(options, gitCommitHash) {
const github = githubApi({ token: options.token });
const results = await github.rest.repos.listPullRequestsAssociatedWithCommit({
...context.repo,
commit_sha: gitCommitHash,
});
return results.data.map(pr => ({
id: pr.id,
prNumber: pr.number,
prHeadCommitSha: pr.head.sha,
mergeCommitSha: pr.merge_commit_sha,
}));
}
// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(2037);
@@ -20765,6 +20858,17 @@ function toolPath(name, version) {
assert(process.env['RUNNER_TOOL_CACHE'], 'Could not resolve the local tool cache, RUNNER_TOOL_CACHE not defined');
return path.join(process.env['RUNNER_TOOL_CACHE'], name, version, os.arch());
}
/**
* Add extra `searchPath` to the global search path for require()
*/
function addGlobalNodeSearchPath(searchPath) {
const nodePath = process.env['NODE_PATH'] || '';
const delimiter = process.platform === 'win32' ? ';' : ':';
const nodePaths = nodePath.split(delimiter);
nodePaths.push(searchPath);
process.env['NODE_PATH'] = nodePaths.join(delimiter);
(__nccwpck_require__(8188).Module._initPaths)();
}
;// CONCATENATED MODULE: ./src/actions/preview-comment.ts
+395 -343
View File
@@ -15091,6 +15091,348 @@ function isPlainObject(o) {
exports.isPlainObject = isPlainObject;
/***/ }),
/***/ 7129:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
// A linked list to keep track of recently-used-ness
const Yallist = __nccwpck_require__(665)
const MAX = Symbol('max')
const LENGTH = Symbol('length')
const LENGTH_CALCULATOR = Symbol('lengthCalculator')
const ALLOW_STALE = Symbol('allowStale')
const MAX_AGE = Symbol('maxAge')
const DISPOSE = Symbol('dispose')
const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
const LRU_LIST = Symbol('lruList')
const CACHE = Symbol('cache')
const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
const naiveLength = () => 1
// lruList is a yallist where the head is the youngest
// item, and the tail is the oldest. the list contains the Hit
// objects as the entries.
// Each Hit object has a reference to its Yallist.Node. This
// never changes.
//
// cache is a Map (or PseudoMap) that matches the keys to
// the Yallist.Node object.
class LRUCache {
constructor (options) {
if (typeof options === 'number')
options = { max: options }
if (!options)
options = {}
if (options.max && (typeof options.max !== 'number' || options.max < 0))
throw new TypeError('max must be a non-negative number')
// Kind of weird to have a default max of Infinity, but oh well.
const max = this[MAX] = options.max || Infinity
const lc = options.length || naiveLength
this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
this[ALLOW_STALE] = options.stale || false
if (options.maxAge && typeof options.maxAge !== 'number')
throw new TypeError('maxAge must be a number')
this[MAX_AGE] = options.maxAge || 0
this[DISPOSE] = options.dispose
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
this.reset()
}
// resize the cache when the max changes.
set max (mL) {
if (typeof mL !== 'number' || mL < 0)
throw new TypeError('max must be a non-negative number')
this[MAX] = mL || Infinity
trim(this)
}
get max () {
return this[MAX]
}
set allowStale (allowStale) {
this[ALLOW_STALE] = !!allowStale
}
get allowStale () {
return this[ALLOW_STALE]
}
set maxAge (mA) {
if (typeof mA !== 'number')
throw new TypeError('maxAge must be a non-negative number')
this[MAX_AGE] = mA
trim(this)
}
get maxAge () {
return this[MAX_AGE]
}
// resize the cache when the lengthCalculator changes.
set lengthCalculator (lC) {
if (typeof lC !== 'function')
lC = naiveLength
if (lC !== this[LENGTH_CALCULATOR]) {
this[LENGTH_CALCULATOR] = lC
this[LENGTH] = 0
this[LRU_LIST].forEach(hit => {
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
this[LENGTH] += hit.length
})
}
trim(this)
}
get lengthCalculator () { return this[LENGTH_CALCULATOR] }
get length () { return this[LENGTH] }
get itemCount () { return this[LRU_LIST].length }
rforEach (fn, thisp) {
thisp = thisp || this
for (let walker = this[LRU_LIST].tail; walker !== null;) {
const prev = walker.prev
forEachStep(this, fn, walker, thisp)
walker = prev
}
}
forEach (fn, thisp) {
thisp = thisp || this
for (let walker = this[LRU_LIST].head; walker !== null;) {
const next = walker.next
forEachStep(this, fn, walker, thisp)
walker = next
}
}
keys () {
return this[LRU_LIST].toArray().map(k => k.key)
}
values () {
return this[LRU_LIST].toArray().map(k => k.value)
}
reset () {
if (this[DISPOSE] &&
this[LRU_LIST] &&
this[LRU_LIST].length) {
this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
}
this[CACHE] = new Map() // hash of items by key
this[LRU_LIST] = new Yallist() // list of items in order of use recency
this[LENGTH] = 0 // length of items in the list
}
dump () {
return this[LRU_LIST].map(hit =>
isStale(this, hit) ? false : {
k: hit.key,
v: hit.value,
e: hit.now + (hit.maxAge || 0)
}).toArray().filter(h => h)
}
dumpLru () {
return this[LRU_LIST]
}
set (key, value, maxAge) {
maxAge = maxAge || this[MAX_AGE]
if (maxAge && typeof maxAge !== 'number')
throw new TypeError('maxAge must be a number')
const now = maxAge ? Date.now() : 0
const len = this[LENGTH_CALCULATOR](value, key)
if (this[CACHE].has(key)) {
if (len > this[MAX]) {
del(this, this[CACHE].get(key))
return false
}
const node = this[CACHE].get(key)
const item = node.value
// dispose of the old one before overwriting
// split out into 2 ifs for better coverage tracking
if (this[DISPOSE]) {
if (!this[NO_DISPOSE_ON_SET])
this[DISPOSE](key, item.value)
}
item.now = now
item.maxAge = maxAge
item.value = value
this[LENGTH] += len - item.length
item.length = len
this.get(key)
trim(this)
return true
}
const hit = new Entry(key, value, len, now, maxAge)
// oversized objects fall out of cache automatically.
if (hit.length > this[MAX]) {
if (this[DISPOSE])
this[DISPOSE](key, value)
return false
}
this[LENGTH] += hit.length
this[LRU_LIST].unshift(hit)
this[CACHE].set(key, this[LRU_LIST].head)
trim(this)
return true
}
has (key) {
if (!this[CACHE].has(key)) return false
const hit = this[CACHE].get(key).value
return !isStale(this, hit)
}
get (key) {
return get(this, key, true)
}
peek (key) {
return get(this, key, false)
}
pop () {
const node = this[LRU_LIST].tail
if (!node)
return null
del(this, node)
return node.value
}
del (key) {
del(this, this[CACHE].get(key))
}
load (arr) {
// reset the cache
this.reset()
const now = Date.now()
// A previous serialized cache has the most recent items first
for (let l = arr.length - 1; l >= 0; l--) {
const hit = arr[l]
const expiresAt = hit.e || 0
if (expiresAt === 0)
// the item was created without expiration in a non aged cache
this.set(hit.k, hit.v)
else {
const maxAge = expiresAt - now
// dont add already expired items
if (maxAge > 0) {
this.set(hit.k, hit.v, maxAge)
}
}
}
}
prune () {
this[CACHE].forEach((value, key) => get(this, key, false))
}
}
const get = (self, key, doUse) => {
const node = self[CACHE].get(key)
if (node) {
const hit = node.value
if (isStale(self, hit)) {
del(self, node)
if (!self[ALLOW_STALE])
return undefined
} else {
if (doUse) {
if (self[UPDATE_AGE_ON_GET])
node.value.now = Date.now()
self[LRU_LIST].unshiftNode(node)
}
}
return hit.value
}
}
const isStale = (self, hit) => {
if (!hit || (!hit.maxAge && !self[MAX_AGE]))
return false
const diff = Date.now() - hit.now
return hit.maxAge ? diff > hit.maxAge
: self[MAX_AGE] && (diff > self[MAX_AGE])
}
const trim = self => {
if (self[LENGTH] > self[MAX]) {
for (let walker = self[LRU_LIST].tail;
self[LENGTH] > self[MAX] && walker !== null;) {
// We know that we're about to delete this one, and also
// what the next least recently used key will be, so just
// go ahead and set it now.
const prev = walker.prev
del(self, walker)
walker = prev
}
}
}
const del = (self, node) => {
if (node) {
const hit = node.value
if (self[DISPOSE])
self[DISPOSE](hit.key, hit.value)
self[LENGTH] -= hit.length
self[CACHE].delete(hit.key)
self[LRU_LIST].removeNode(node)
}
}
class Entry {
constructor (key, value, length, now, maxAge) {
this.key = key
this.value = value
this.length = length
this.now = now
this.maxAge = maxAge || 0
}
}
const forEachStep = (self, fn, node, thisp) => {
let hit = node.value
if (isStale(self, hit)) {
del(self, node)
if (!self[ALLOW_STALE])
hit = undefined
}
if (hit)
fn.call(thisp, hit.value, hit.key, self)
}
module.exports = LRUCache
/***/ }),
/***/ 467:
@@ -17272,7 +17614,7 @@ class Range {
}
module.exports = Range
const LRU = __nccwpck_require__(1196)
const LRU = __nccwpck_require__(7129)
const cache = new LRU({ max: 1000 })
const parseOptions = __nccwpck_require__(785)
@@ -18693,348 +19035,6 @@ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
/***/ }),
/***/ 1196:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
// A linked list to keep track of recently-used-ness
const Yallist = __nccwpck_require__(665)
const MAX = Symbol('max')
const LENGTH = Symbol('length')
const LENGTH_CALCULATOR = Symbol('lengthCalculator')
const ALLOW_STALE = Symbol('allowStale')
const MAX_AGE = Symbol('maxAge')
const DISPOSE = Symbol('dispose')
const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
const LRU_LIST = Symbol('lruList')
const CACHE = Symbol('cache')
const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
const naiveLength = () => 1
// lruList is a yallist where the head is the youngest
// item, and the tail is the oldest. the list contains the Hit
// objects as the entries.
// Each Hit object has a reference to its Yallist.Node. This
// never changes.
//
// cache is a Map (or PseudoMap) that matches the keys to
// the Yallist.Node object.
class LRUCache {
constructor (options) {
if (typeof options === 'number')
options = { max: options }
if (!options)
options = {}
if (options.max && (typeof options.max !== 'number' || options.max < 0))
throw new TypeError('max must be a non-negative number')
// Kind of weird to have a default max of Infinity, but oh well.
const max = this[MAX] = options.max || Infinity
const lc = options.length || naiveLength
this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
this[ALLOW_STALE] = options.stale || false
if (options.maxAge && typeof options.maxAge !== 'number')
throw new TypeError('maxAge must be a number')
this[MAX_AGE] = options.maxAge || 0
this[DISPOSE] = options.dispose
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
this.reset()
}
// resize the cache when the max changes.
set max (mL) {
if (typeof mL !== 'number' || mL < 0)
throw new TypeError('max must be a non-negative number')
this[MAX] = mL || Infinity
trim(this)
}
get max () {
return this[MAX]
}
set allowStale (allowStale) {
this[ALLOW_STALE] = !!allowStale
}
get allowStale () {
return this[ALLOW_STALE]
}
set maxAge (mA) {
if (typeof mA !== 'number')
throw new TypeError('maxAge must be a non-negative number')
this[MAX_AGE] = mA
trim(this)
}
get maxAge () {
return this[MAX_AGE]
}
// resize the cache when the lengthCalculator changes.
set lengthCalculator (lC) {
if (typeof lC !== 'function')
lC = naiveLength
if (lC !== this[LENGTH_CALCULATOR]) {
this[LENGTH_CALCULATOR] = lC
this[LENGTH] = 0
this[LRU_LIST].forEach(hit => {
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
this[LENGTH] += hit.length
})
}
trim(this)
}
get lengthCalculator () { return this[LENGTH_CALCULATOR] }
get length () { return this[LENGTH] }
get itemCount () { return this[LRU_LIST].length }
rforEach (fn, thisp) {
thisp = thisp || this
for (let walker = this[LRU_LIST].tail; walker !== null;) {
const prev = walker.prev
forEachStep(this, fn, walker, thisp)
walker = prev
}
}
forEach (fn, thisp) {
thisp = thisp || this
for (let walker = this[LRU_LIST].head; walker !== null;) {
const next = walker.next
forEachStep(this, fn, walker, thisp)
walker = next
}
}
keys () {
return this[LRU_LIST].toArray().map(k => k.key)
}
values () {
return this[LRU_LIST].toArray().map(k => k.value)
}
reset () {
if (this[DISPOSE] &&
this[LRU_LIST] &&
this[LRU_LIST].length) {
this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
}
this[CACHE] = new Map() // hash of items by key
this[LRU_LIST] = new Yallist() // list of items in order of use recency
this[LENGTH] = 0 // length of items in the list
}
dump () {
return this[LRU_LIST].map(hit =>
isStale(this, hit) ? false : {
k: hit.key,
v: hit.value,
e: hit.now + (hit.maxAge || 0)
}).toArray().filter(h => h)
}
dumpLru () {
return this[LRU_LIST]
}
set (key, value, maxAge) {
maxAge = maxAge || this[MAX_AGE]
if (maxAge && typeof maxAge !== 'number')
throw new TypeError('maxAge must be a number')
const now = maxAge ? Date.now() : 0
const len = this[LENGTH_CALCULATOR](value, key)
if (this[CACHE].has(key)) {
if (len > this[MAX]) {
del(this, this[CACHE].get(key))
return false
}
const node = this[CACHE].get(key)
const item = node.value
// dispose of the old one before overwriting
// split out into 2 ifs for better coverage tracking
if (this[DISPOSE]) {
if (!this[NO_DISPOSE_ON_SET])
this[DISPOSE](key, item.value)
}
item.now = now
item.maxAge = maxAge
item.value = value
this[LENGTH] += len - item.length
item.length = len
this.get(key)
trim(this)
return true
}
const hit = new Entry(key, value, len, now, maxAge)
// oversized objects fall out of cache automatically.
if (hit.length > this[MAX]) {
if (this[DISPOSE])
this[DISPOSE](key, value)
return false
}
this[LENGTH] += hit.length
this[LRU_LIST].unshift(hit)
this[CACHE].set(key, this[LRU_LIST].head)
trim(this)
return true
}
has (key) {
if (!this[CACHE].has(key)) return false
const hit = this[CACHE].get(key).value
return !isStale(this, hit)
}
get (key) {
return get(this, key, true)
}
peek (key) {
return get(this, key, false)
}
pop () {
const node = this[LRU_LIST].tail
if (!node)
return null
del(this, node)
return node.value
}
del (key) {
del(this, this[CACHE].get(key))
}
load (arr) {
// reset the cache
this.reset()
const now = Date.now()
// A previous serialized cache has the most recent items first
for (let l = arr.length - 1; l >= 0; l--) {
const hit = arr[l]
const expiresAt = hit.e || 0
if (expiresAt === 0)
// the item was created without expiration in a non aged cache
this.set(hit.k, hit.v)
else {
const maxAge = expiresAt - now
// dont add already expired items
if (maxAge > 0) {
this.set(hit.k, hit.v, maxAge)
}
}
}
}
prune () {
this[CACHE].forEach((value, key) => get(this, key, false))
}
}
const get = (self, key, doUse) => {
const node = self[CACHE].get(key)
if (node) {
const hit = node.value
if (isStale(self, hit)) {
del(self, node)
if (!self[ALLOW_STALE])
return undefined
} else {
if (doUse) {
if (self[UPDATE_AGE_ON_GET])
node.value.now = Date.now()
self[LRU_LIST].unshiftNode(node)
}
}
return hit.value
}
}
const isStale = (self, hit) => {
if (!hit || (!hit.maxAge && !self[MAX_AGE]))
return false
const diff = Date.now() - hit.now
return hit.maxAge ? diff > hit.maxAge
: self[MAX_AGE] && (diff > self[MAX_AGE])
}
const trim = self => {
if (self[LENGTH] > self[MAX]) {
for (let walker = self[LRU_LIST].tail;
self[LENGTH] > self[MAX] && walker !== null;) {
// We know that we're about to delete this one, and also
// what the next least recently used key will be, so just
// go ahead and set it now.
const prev = walker.prev
del(self, walker)
walker = prev
}
}
}
const del = (self, node) => {
if (node) {
const hit = node.value
if (self[DISPOSE])
self[DISPOSE](hit.key, hit.value)
self[LENGTH] -= hit.length
self[CACHE].delete(hit.key)
self[LRU_LIST].removeNode(node)
}
}
class Entry {
constructor (key, value, length, now, maxAge) {
this.key = key
this.value = value
this.length = length
this.now = now
this.maxAge = maxAge || 0
}
}
const forEachStep = (self, fn, node, thisp) => {
let hit = node.value
if (isStale(self, hit)) {
del(self, node)
if (!self[ALLOW_STALE])
hit = undefined
}
if (hit)
fn.call(thisp, hit.value, hit.key, self)
}
module.exports = LRUCache
/***/ }),
/***/ 9380:
@@ -23297,6 +23297,14 @@ module.exports = require("https");
/***/ }),
/***/ 8188:
/***/ ((module) => {
"use strict";
module.exports = require("module");
/***/ }),
/***/ 1808:
/***/ ((module) => {
@@ -23748,6 +23756,39 @@ function issueComment() {
},
];
}
/**
* Get the commit message for a specific commit hash.
*/
async function getGitCommandMessageAsync(options, gitCommitHash) {
const github = githubApi({ token: options.token });
const result = await github.rest.git.getCommit({
...context.repo,
commit_sha: gitCommitHash,
});
return result.data.message;
}
/**
* True if the current event is a push to the default branch.
*/
function isPushDefaultBranchContext() {
return context.eventName === 'push' && context.ref === `refs/heads/${context.payload?.repository?.default_branch}`;
}
/**
* Get the pull request information that associated with a specific commit hash.
*/
async function getPullRequestFromGitCommitShaAsync(options, gitCommitHash) {
const github = githubApi({ token: options.token });
const results = await github.rest.repos.listPullRequestsAssociatedWithCommit({
...context.repo,
commit_sha: gitCommitHash,
});
return results.data.map(pr => ({
id: pr.id,
prNumber: pr.number,
prHeadCommitSha: pr.head.sha,
mergeCommitSha: pr.merge_commit_sha,
}));
}
;// CONCATENATED MODULE: ./src/project.ts
@@ -23847,6 +23888,17 @@ function toolPath(name, version) {
assert(process.env['RUNNER_TOOL_CACHE'], 'Could not resolve the local tool cache, RUNNER_TOOL_CACHE not defined');
return path.join(process.env['RUNNER_TOOL_CACHE'], name, version, os.arch());
}
/**
* Add extra `searchPath` to the global search path for require()
*/
function addGlobalNodeSearchPath(searchPath) {
const nodePath = process.env['NODE_PATH'] || '';
const delimiter = process.platform === 'win32' ? ';' : ':';
const nodePaths = nodePath.split(delimiter);
nodePaths.push(searchPath);
process.env['NODE_PATH'] = nodePaths.join(delimiter);
(__nccwpck_require__(8188).Module._initPaths)();
}
;// CONCATENATED MODULE: ./src/actions/preview.ts
+3386 -24
View File
File diff suppressed because it is too large. Load diff
+482
View File
@@ -34,6 +34,18 @@ The above copyright notice and this permission notice shall be included in all c
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.
@actions/github
MIT
The MIT License (MIT)
Copyright 2019 GitHub
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.
@actions/glob
MIT
The MIT License (MIT)
@@ -345,6 +357,178 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@octokit/auth-token
MIT
The MIT License
Copyright (c) 2019 Octokit contributors
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.
@octokit/core
MIT
The MIT License
Copyright (c) 2019 Octokit contributors
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.
@octokit/endpoint
MIT
The MIT License
Copyright (c) 2018 Octokit contributors
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.
@octokit/graphql
MIT
The MIT License
Copyright (c) 2018 Octokit contributors
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.
@octokit/plugin-paginate-rest
MIT
MIT License Copyright (c) 2019 Octokit contributors
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 (including the next paragraph) 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.
@octokit/plugin-rest-endpoint-methods
MIT
MIT License Copyright (c) 2019 Octokit contributors
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 (including the next paragraph) 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.
@octokit/request
MIT
The MIT License
Copyright (c) 2018 Octokit contributors
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.
@octokit/request-error
MIT
The MIT License
Copyright (c) 2019 Octokit contributors
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.
@opentelemetry/api
Apache-2.0
Apache License
@@ -600,6 +784,211 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
before-after-hook
Apache-2.0
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2018 Gregor Martynus and other contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
brace-expansion
MIT
MIT License
@@ -693,6 +1082,25 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
deprecation
ISC
The ISC License
Copyright (c) Gregor Martynus and contributors
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.
encoding
MIT
Copyright (c) 2012-2014 Andris Reinman
@@ -761,6 +1169,31 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
is-plain-object
MIT
The MIT License (MIT)
Copyright (c) 2014-2017, Jon Schlinkert.
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.
mime-db
MIT
@@ -859,6 +1292,25 @@ SOFTWARE.
once
ISC
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
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.
psl
MIT
The MIT License (MIT)
@@ -1020,6 +1472,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
universal-user-agent
ISC
# [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.
universalify
MIT
(The MIT License)
@@ -1098,6 +1561,25 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
wrappy
ISC
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
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.
xml2js
MIT
Copyright 2010, 2011, 2012, 2013. All rights reserved.
+39
View File
@@ -0,0 +1,39 @@
---
name: Expo GitHub Action - Fingerprint
author: Expo
description: Check project fingerprint
branding:
icon: smartphone
color: gray-dark
runs:
using: node16
main: ../build/fingerprint/index.js
post: ../build/fingerprint-post/index.js
post-if: success()
inputs:
packager:
description: The package manager used to install the fingerprint tools
default: yarn
github-token:
description: GitHub token to use when commenting on PR
required: false
default: ${{ github.token }}
working-directory:
description: The relative directory of your Expo app
required: false
default: ${{ github.workspace }}
fingerprint-version:
description: Fingerprint version to install
required: false
default: latest
fingerprint-installation-cache:
description: If fingerprint should be cached to speed up installation
default: true
fingerprint-db-cache-key:
description: A cache key to use for saving the fingerprint database
required: false
default: fingerprint-db
outputs:
fingerprint-diff:
description: The diff between the current and the previous fingerprint
+8
View File
@@ -2,6 +2,13 @@ const ncc = require('@vercel/ncc');
const fs = require('fs');
const path = require('path');
// For some entries, we need to specify externals for ncc to leave their require() as-it.
const EXTERNAL_REQUIRES = {
fingerprint: ['@expo/fingerprint', 'module', 'sqlite3'],
'fingerprint-post': ['@expo/fingerprint', 'module', 'sqlite3'],
'preview-build': ['@expo/fingerprint', 'module', 'sqlite3'],
};
build();
async function build() {
@@ -26,6 +33,7 @@ async function build() {
async function compile(entry) {
const { code, map, assets } = await ncc(entry, {
externals: EXTERNAL_REQUIRES[path.parse(entry).name] ?? [],
cache: false,
license: 'license.txt',
quiet: true,
+5 -1
View File
@@ -27,16 +27,19 @@
"@actions/github": "^5.1.1",
"@actions/io": "^1.1.2",
"@actions/tool-cache": "^2.0.1",
"semver": "^7.3.8"
"semver": "^7.3.8",
"uuid": "^8.3.2"
},
"devDependencies": {
"@expo/config": "^7.0.3",
"@expo/fingerprint": "^0.1.0",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@tsconfig/node16": "^1.0.3",
"@types/jest": "^29.2.5",
"@types/node": "^16.18.11",
"@types/uuid": "^9.0.3",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"@vercel/ncc": "^0.36.0",
@@ -46,6 +49,7 @@
"jest": "^29.3.1",
"prettier": "^2.8.1",
"semantic-release": "^19.0.5",
"sqlite3": "^5.1.6",
"ts-jest": "^29.0.3",
"typescript": "^4.9.4"
},
+68
View File
@@ -0,0 +1,68 @@
---
name: Expo GitHub Action - Preview EAS Build for Pull Requests
author: Expo
description: Create Expo previews with EAS Build
branding:
icon: smartphone
color: gray-dark
runs:
using: node16
main: ../build/preview-build/index.js
inputs:
command:
description: EAS CLI command to run when creating builds
required: true
comment:
description: If the action should summarize the EAS Build information as comment on a pull request
required: false
default: true
comment-id:
description: unique id template to prevent duplicate comments
working-directory:
description: The relative directory of your Expo app
required: false
default: ${{ github.workspace }}
packager:
description: The package manager used to install the fingerprint tools
default: yarn
github-token:
description: GitHub token to use when commenting on PR
required: false
default: ${{ github.token }}
fingerprint-version:
description: Fingerprint version to install
required: false
default: latest
fingerprint-installation-cache:
description: If fingerprint should be cached to speed up installation
default: true
fingerprint-db-cache-key:
description: A cache key to use for saving the fingerprint database
required: false
default: fingerprint-db
eas-build-message:
description: A short message describing the build
outputs:
projectId:
description: The resolved EAS project ID
commentId:
description: The unique comment ID to prevent duplicate comments
comment:
description: The comment with information about the build
gitCommitHash:
description: Git commit hash that was found when creating this build
androidBuildId:
description: EAS Build ID
androidLink:
description: Absolute URL to platform-independent build on expo.dev
androidAppVersion:
description: Version of the app
iosBuildId:
description: EAS Build ID
iosLink:
description: Absolute URL to platform-independent build on expo.dev
iosAppVersion:
description: iOS build number
+24
View File
@@ -0,0 +1,24 @@
import { info } from '@actions/core';
import assert from 'assert';
import { deleteCacheAsync } from '../cacher';
import { collectFingerprintActionInput, saveDbToCacheAsync } from '../fingerprint';
import { isPushDefaultBranchContext } from '../github';
import { executeAction } from '../worker';
executeAction(runAction);
export async function runAction(input = collectFingerprintActionInput()) {
if (!isPushDefaultBranchContext()) {
return;
}
try {
const ref = process.env.GITHUB_REF;
assert(ref != null, 'GITHUB_REF is not defined');
await deleteCacheAsync(input.githubToken, input.fingerprintDbCacheKey, ref);
} catch (e) {
info(`Failed to delete the cache: ${e}`);
}
await saveDbToCacheAsync(input.fingerprintDbCacheKey);
}
+20
View File
@@ -0,0 +1,20 @@
import { setOutput } from '@actions/core';
import {
createFingerprintOutputAsync,
collectFingerprintActionInput,
createFingerprintDbManagerAsync,
} from '../fingerprint';
import { executeAction } from '../worker';
executeAction(runAction);
export async function runAction(input = collectFingerprintActionInput()) {
const dbManager = await createFingerprintDbManagerAsync(input.packager, input.fingerprintDbCacheKey);
const { currentFingerprint, diff } = await createFingerprintOutputAsync(dbManager, input);
await dbManager.upsertFingerprintByGitCommitHashAsync(input.currentGitCommitHash, {
fingerprint: currentFingerprint,
});
setOutput('fingerprint-diff', diff);
}
+399
View File
@@ -0,0 +1,399 @@
import { getBooleanInput, getInput, setOutput, group, setFailed, info } from '@actions/core';
import { context } from '@actions/github';
import type { ExpoConfig } from '@expo/config';
import type { Fingerprint, FingerprintSource } from '@expo/fingerprint';
import assert from 'assert';
import { validate as isValidUUID } from 'uuid';
import { deleteCacheAsync } from '../cacher';
import {
createEasBuildFromRawCommandAsync,
BuildInfo,
getBuildLogsUrl,
appPlatformEmojis,
cancelEasBuildAsync,
queryEasBuildInfoAsync,
} from '../expo';
import {
FingerprintDbManager,
collectFingerprintActionInput,
createFingerprintDbManagerAsync,
createFingerprintOutputAsync,
saveDbToCacheAsync,
} from '../fingerprint';
import {
createIssueComment,
fetchIssueComment,
getGitCommandMessageAsync,
getPullRequestFromGitCommitShaAsync,
hasPullContext,
isPushDefaultBranchContext,
pullContext,
} from '../github';
import { loadProjectConfig } from '../project';
import { template } from '../utils';
import { executeAction } from '../worker';
export const MESSAGE_ID = 'projectId:previewBuild:{projectId}';
export function collectPreviewBuildActionInput() {
return {
...collectFingerprintActionInput(),
command: getInput('command'),
shouldComment: !getInput('comment') || getBooleanInput('comment'),
commentId: getInput('comment-id') || MESSAGE_ID,
easBuildMessage: getInput('eas-build-message'),
};
}
executeAction(previewAction);
export async function previewAction(input = collectPreviewBuildActionInput()) {
const config = await loadProjectConfig(input.workingDirectory);
if (!config.extra?.eas?.projectId) {
return setFailed(
'Missing "extra.eas.projectId" in app.json or app.config.js. Please run `eas build:configure` first.'
);
}
if (!hasPullContext()) {
handleNonPullRequest(config, input);
return;
}
const dbManager = await createFingerprintDbManagerAsync(input.packager, input.fingerprintDbCacheKey);
const { currentFingerprint, diff } = await createFingerprintOutputAsync(dbManager, input);
if (diff.length === 0) {
info('Fingerprint is compatible, no new builds are required.');
await maybeUpdateFingerprintDbAsync({
dbManager,
githubToken: input.githubToken,
fingerprintDbCacheKey: input.fingerprintDbCacheKey,
gitCommitHash: input.currentGitCommitHash,
manyBuilds: [{ fingerprint: currentFingerprint }],
});
await maybeCancelPreviousBuildsAsync(config, input);
const variables = getVariables(config, []);
const messageId = template(input.commentId, variables);
const latestEasEntity = await dbManager.getLatestEasEntityFromFingerprintAsync(currentFingerprint.hash);
const latestEasBuildInfo = latestEasEntity?.easBuildId
? await queryEasBuildInfoAsync(input.workingDirectory, latestEasEntity.easBuildId)
: null;
const messageBody = createMessageBodyFingerprintCompatible(latestEasBuildInfo);
await maybeCreateCommentAsync(input, messageId, messageBody);
setOutputs(variables, messageId, messageBody);
return;
}
info('Fingerprint is changed, creating new builds...');
info(`Fingerprint diff: ${JSON.stringify(diff, null, 2)}`);
await maybeCancelPreviousBuildsAsync(config, input);
const command = sanitizeCommand(input.command);
const buildMessage =
input.easBuildMessage ||
(await getGitCommandMessageAsync({ token: input.githubToken }, input.currentGitCommitHash));
const args = ['--message', buildMessage];
const builds = await group(`Run eas ${command}"`, () =>
createEasBuildFromRawCommandAsync(input.workingDirectory, command, args)
);
await maybeUpdateFingerprintDbAsync({
dbManager,
githubToken: input.githubToken,
fingerprintDbCacheKey: input.fingerprintDbCacheKey,
gitCommitHash: input.currentGitCommitHash,
manyBuilds: builds.map(build => ({
easBuildId: build.id,
fingerprint: currentFingerprint,
})),
});
const variables = getVariables(config, builds);
const messageId = template(input.commentId, variables);
const messageBody = createMessageBodyInBuilding(builds, diff, input);
await maybeCreateCommentAsync(input, messageId, messageBody);
setOutputs(variables, messageId, messageBody);
}
/**
* Validate and sanitize the command that creates the update.
* It also ensures that the command starts with `eas ...` to make sure we can run it.
*/
function sanitizeCommand(input: string): string {
let command = input.trim();
if (!command.startsWith('eas')) {
throw new Error(`The command must start with "eas", received "${command}"`);
} else {
command = command.replace(/^eas/, '').trim();
}
return command;
}
async function maybeCancelPreviousBuildsAsync(
config: ExpoConfig,
input: ReturnType<typeof collectPreviewBuildActionInput>
) {
const variables = getVariables(config, []);
const messageId = template(input.commentId, variables);
const comment = await fetchIssueComment({
...pullContext(),
token: input.githubToken,
id: messageId,
});
if (!comment?.body) {
return [];
}
const easBuildIds = parseCommentForEasMetadata(comment.body);
for (const buildId of easBuildIds) {
info(`Canceling previous build: ${buildId}`);
await cancelEasBuildAsync(input.workingDirectory, buildId);
}
}
//#region Comments
async function maybeCreateCommentAsync(
input: ReturnType<typeof collectPreviewBuildActionInput>,
messageId: string,
messageBody: string
) {
if (!input.shouldComment) {
info(`Skipped comment: 'comment' is disabled`);
} else if (!hasPullContext()) {
info(`Skipped comment: action was not ran from a pull request`);
} else {
await createIssueComment({
...pullContext(),
token: input.githubToken,
id: messageId,
body: messageBody,
});
}
}
function setOutputs(variables: ReturnType<typeof getVariables>, messageId: string, messageBody: string) {
for (const [name, value] of Object.entries(variables)) {
setOutput(name, value);
}
setOutput('commentId', messageId);
setOutput('comment', messageBody);
}
/**
* Generate useful variables for the message body, and as step outputs.
*/
export function getVariables(config: ExpoConfig, builds: BuildInfo[]) {
const projectId: string = config.extra?.eas?.projectId;
const android = builds.find(build => build.platform === 'ANDROID');
const ios = builds.find(build => build.platform === 'IOS');
const gitCommitHash = android?.gitCommitHash || ios?.gitCommitHash || '';
return {
projectId,
gitCommitHash,
androidBuildId: android?.id || '',
androidLink: android != null ? getBuildLogsUrl(android) : '',
androidAppVersion: android?.appVersion || '',
iosBuildId: ios?.id || '',
iosLink: ios != null ? getBuildLogsUrl(ios) : '',
iosAppVersion: ios?.appVersion || '',
};
}
function createDetails({
summary,
details,
delim = '\n',
}: {
summary: string;
details: string;
delim?: string;
}): string {
return `<details><summary>${summary}</summary>${delim.repeat(2)}${details}${delim}</details>`;
}
function createMessageBodyInBuilding(
builds: BuildInfo[],
fingerprintDiff: FingerprintSource[],
input: ReturnType<typeof collectPreviewBuildActionInput>
) {
const tableRows: string[] = [];
for (const build of builds) {
let name;
if (build.platform === 'ANDROID') {
name = `${appPlatformEmojis.ANDROID} Android build`;
} else if (build.platform === 'IOS') {
name = `${appPlatformEmojis.IOS} iOS build`;
} else {
name = 'Unknown build';
}
const buildPageURL = getBuildLogsUrl(build);
const details = createDetails({
summary: 'Details',
details: [
`Distribution: \`${build.distribution}\``,
`Build profile: \`${build.buildProfile}\``,
`SDK version: \`${build.sdkVersion}\``,
`App version: \`${build.appVersion}\``,
].join('<br>'),
delim: '',
});
tableRows.push(`| ${name} | [View build page](${buildPageURL}) | ${details} |`);
}
return [
createCommentForEasMetadata(builds),
'',
`Fingerprint is changed, new EAS Build(s) are now in pipeline.`,
'',
`Build with commit ${input.currentGitCommitHash}`,
'',
'| Name | Build | Details |',
'| :-- | :-- | :-- |',
...tableRows,
'',
createDetails({
summary: 'Fingerprint diff',
details: ['```json', JSON.stringify(fingerprintDiff, null, 2), '```'].join('\n'),
}),
'',
`> Learn more about [𝝠 Expo Github Action](https://github.com/expo/expo-github-action/tree/main/preview-build#example-workflows)`,
].join('\n');
}
function createMessageBodyFingerprintCompatible(latestEasBuildInfo: BuildInfo | null) {
const easBuildMessage =
latestEasBuildInfo != null
? `Latest compatible build on EAS found. You can download the build from the [EAS build page](${getBuildLogsUrl(
latestEasBuildInfo
)}).`
: '';
return [
`Fingerprint is compatible, no new builds are required.`,
easBuildMessage,
'',
`> Learn more about [𝝠 Expo Github Action](https://github.com/expo/expo-github-action/tree/main/preview-build#example-workflows)`,
].join('\n');
}
function createCommentForEasMetadata(builds: BuildInfo[]) {
if (builds.length === 0) {
return '';
}
const easBuildIds = JSON.stringify(builds.map(build => build.id));
return `<!-- EAS_BUILD_IDS=${easBuildIds} -->`;
}
function parseCommentForEasMetadata(comment: string): string[] {
const match = comment.match(/<!-- EAS_BUILD_IDS=(.*) -->/);
if (match == null) {
return [];
}
let metadata;
try {
metadata = JSON.parse(match[1]);
} catch {}
if (Array.isArray(metadata)) {
return metadata
.map(value => (typeof value === 'string' && isValidUUID(value) ? value : null))
.filter((value): value is string => !!value);
}
return [];
}
//#endregion
async function maybeUpdateFingerprintDbAsync(params: {
dbManager: FingerprintDbManager;
githubToken: string;
fingerprintDbCacheKey: string;
gitCommitHash: string;
manyBuilds: {
easBuildId?: string;
fingerprint: Fingerprint;
}[];
}) {
if (!isPushDefaultBranchContext()) {
return;
}
for (const build of params.manyBuilds) {
await params.dbManager.upsertFingerprintByGitCommitHashAsync(params.gitCommitHash, {
easBuildId: build.easBuildId,
fingerprint: build.fingerprint,
});
}
try {
const ref = process.env.GITHUB_REF;
assert(ref != null, 'GITHUB_REF is not defined');
await deleteCacheAsync(params.githubToken, params.fingerprintDbCacheKey, ref);
} catch (e) {
info(`Failed to delete the cache: ${e}`);
}
await saveDbToCacheAsync(params.fingerprintDbCacheKey);
}
//#region Non pull request context
async function handleNonPullRequest(config: ExpoConfig, input: ReturnType<typeof collectPreviewBuildActionInput>) {
info('Non pull request context, skipping comment.');
if (!isPushDefaultBranchContext()) {
return;
}
info('Updating fingerprint database for the default branch push event.');
const dbManager = await createFingerprintDbManagerAsync(input.packager, input.fingerprintDbCacheKey);
const { currentFingerprint } = await createFingerprintOutputAsync(dbManager, input);
const associatedPRs = await getPullRequestFromGitCommitShaAsync(
{ token: input.githubToken },
input.currentGitCommitHash
);
const easBuildIds = (
await Promise.all(associatedPRs.map(pr => queryEasBuildIdsFromPrAsync(pr.prNumber, config, input)))
).flat();
let manyBuilds: { easBuildId?: string; fingerprint: Fingerprint }[];
if (easBuildIds.length > 0) {
manyBuilds = easBuildIds.map(easBuildId => ({
easBuildId,
fingerprint: currentFingerprint,
}));
info(`Found EAS build IDs in associated PRs: ${easBuildIds.join(', ')}`);
} else {
manyBuilds = [{ fingerprint: currentFingerprint }];
info('No EAS build IDs found in associated PRs, creating a fingerprint entry without EAS build ID.');
}
await maybeUpdateFingerprintDbAsync({
dbManager,
githubToken: input.githubToken,
fingerprintDbCacheKey: input.fingerprintDbCacheKey,
gitCommitHash: input.currentGitCommitHash,
manyBuilds,
});
const variables = getVariables(config, []);
setOutputs(variables, '', '');
}
async function queryEasBuildIdsFromPrAsync(
prNumber: number,
config: ExpoConfig,
input: ReturnType<typeof collectPreviewBuildActionInput>
): Promise<string[]> {
const variables = getVariables(config, []);
const messageId = template(input.commentId, variables);
const comment = await fetchIssueComment({
...context.repo,
number: prNumber,
token: input.githubToken,
id: messageId,
});
if (!comment?.body) {
return [];
}
return parseCommentForEasMetadata(comment.body);
}
//#endregion
+1 -1
View File
@@ -58,7 +58,7 @@ export async function setupAction(input = setupInput()) {
}
async function installCli(name: string, version: string, packager: string, useCache = true) {
let cliPath = findTool(name, version) || undefined;
let cliPath = findTool(name, version) || null;
if (!cliPath && useCache) {
cliPath = await restoreFromCache(name, version, packager);
+47 -19
View File
@@ -1,7 +1,9 @@
import { saveCache, restoreCache, ReserveCacheError, isFeatureAvailable } from '@actions/cache';
import { warning } from '@actions/core';
import { context } from '@actions/github';
import os from 'os';
import { githubApi } from './github';
import { toolPath } from './worker';
/**
@@ -20,41 +22,67 @@ export function cacheKey(name: string, version: string, manager: string): string
}
/**
* Restore a tool from the remote cache.
* This will install the tool back into the local tool cache.
* Restore a directory from the remote cache.
*/
export async function restoreFromCache(name: string, version: string, manager: string) {
const dir = toolPath(name, version)!;
export async function restoreCacheAsync(cachePath: string, cacheKey: string): Promise<string | null> {
if (!cacheIsAvailable()) {
warning(`Skipped restoring from remote cache, not available.`);
return undefined;
return null;
}
try {
if (await restoreCache([dir], cacheKey(name, version, manager))) {
return dir;
if (await restoreCache([cachePath], cacheKey)) {
return cachePath;
}
} catch (error) {
handleCacheError(error);
}
return null;
}
/**
* Save a directory to the remote cache.
*/
export async function saveCacheAsync(cachePath: string, cacheKey: string): Promise<void> {
if (!cacheIsAvailable()) {
warning(`Skipped saving to remote cache, not available.`);
return;
}
try {
await saveCache([cachePath], cacheKey);
} catch (error) {
handleCacheError(error);
}
}
/**
* Delete a cache key from the remote cache.
* Note that is not using the official API from @actions/cache but using the GitHub API directly.
*/
export async function deleteCacheAsync(githubToken: string, cacheKey: string, ref: string): Promise<void> {
const github = githubApi({ token: githubToken });
await github.rest.actions.deleteActionsCacheByKey({
...context.repo,
key: cacheKey,
ref,
});
}
/**
* Restore a tool from the remote cache.
* This will install the tool back into the local tool cache.
*/
export function restoreFromCache(name: string, version: string, manager: string) {
return restoreCacheAsync(toolPath(name, version), cacheKey(name, version, manager));
}
/**
* Save a tool to the remote cache.
* This will fetch the tool from the local tool cache.
*/
export async function saveToCache(name: string, version: string, manager: string) {
if (!cacheIsAvailable()) {
warning(`Skipped saving to remote cache, not available.`);
return undefined;
}
try {
await saveCache([toolPath(name, version)], cacheKey(name, version, manager));
} catch (error) {
handleCacheError(error);
}
export function saveToCache(name: string, version: string, manager: string) {
return saveCacheAsync(toolPath(name, version), cacheKey(name, version, manager));
}
/**
+59
View File
@@ -140,6 +140,65 @@ export async function easBuild(cmd: Command): Promise<BuildInfo[]> {
return JSON.parse(stdout);
}
/**
* Create an new EAS build using the user-provided command.
*/
export async function createEasBuildFromRawCommandAsync(
cwd: string,
command: string,
extraArgs: string[] = []
): Promise<BuildInfo[]> {
let stdout = '';
let cmd = command;
if (!cmd.includes('--json')) {
cmd += ' --json';
}
if (!cmd.includes('--non-interactive')) {
cmd += ' --non-interactive';
}
if (!cmd.includes('--no-wait')) {
cmd += ' --no-wait';
}
try {
({ stdout } = await getExecOutput((await which('eas', true)) + ` ${cmd}`, extraArgs, {
cwd,
}));
} catch (error) {
throw new Error(`Could not run command eas build, reason:\n${errorMessage(error)}`);
}
return JSON.parse(stdout);
}
/**
* Cancel an EAS build.
*/
export async function cancelEasBuildAsync(cwd: string, buildId: string): Promise<void> {
try {
await getExecOutput(await which('eas', true), ['build:cancel', buildId], { cwd });
} catch (e) {
info(`Failed to cancel build ${buildId}: ${errorMessage(e)}`);
}
}
/**
* Query the EAS BuildInfo from given buildId.
*/
export async function queryEasBuildInfoAsync(cwd: string, buildId: string): Promise<BuildInfo | null> {
try {
const { stdout } = await getExecOutput(await which('eas', true), ['build:view', buildId, '--json'], {
cwd,
silent: true,
});
return JSON.parse(stdout);
} catch (e) {
info(`Failed to query eas build ${buildId}: ${errorMessage(e)}`);
}
return null;
}
/**
* Try to resolve the project info, by running 'expo config --type prebuild'.
*/
+197
View File
@@ -0,0 +1,197 @@
import type { Fingerprint as FingerprintType, FingerprintSource } from '@expo/fingerprint';
import { openDatabaseAsync, Database } from '../sqlite';
export type FingerprintDbEntity = Camelize<RawFingerprintDbEntity> & {
fingerprint: FingerprintType;
};
export class FingerprintDbManager {
constructor(private dbPath: string) {}
public async initAsync(): Promise<Database> {
const db = await openDatabaseAsync(this.dbPath);
await db.runAsync(
`CREATE TABLE IF NOT EXISTS ${FingerprintDbManager.TABLE_NAME} (${FingerprintDbManager.SCHEMA.join(', ')})`
);
for (const index of FingerprintDbManager.INDEXES) {
await db.runAsync(index);
}
for (const extraStatement of FingerprintDbManager.EXTRA_CREATE_DB_STATEMENTS) {
await db.runAsync(extraStatement);
}
await db.runAsync(`PRAGMA fingerprint_schema_version = ${FingerprintDbManager.SCHEMA_VERSION}`);
this.db = db;
return db;
}
public async upsertFingerprintByGitCommitHashAsync(
gitCommitHash: string,
params: {
easBuildId?: string;
fingerprint: FingerprintType;
}
): Promise<void> {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
const easBuildId = params.easBuildId ?? '';
const fingerprintString = JSON.stringify(params.fingerprint);
await this.db.runAsync(
`INSERT INTO ${FingerprintDbManager.TABLE_NAME} (git_commit_hash, eas_build_id, fingerprint_hash, fingerprint) VALUES (?, ?, ?, json(?)) \
ON CONFLICT(git_commit_hash) DO UPDATE SET eas_build_id = ?, fingerprint_hash = ?, fingerprint = json(?)`,
gitCommitHash,
easBuildId,
params.fingerprint.hash,
fingerprintString,
easBuildId,
params.fingerprint.hash,
fingerprintString
);
}
public async queryEasBuildIdsFromFingerprintAsync(fingerprintHash: string): Promise<string[]> {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
const rows = await this.db.allAsync<{ eas_build_id: string }>(
`SELECT eas_build_id FROM ${FingerprintDbManager.TABLE_NAME} WHERE fingerprint_hash = ?`,
fingerprintHash
);
return rows.map(row => row['eas_build_id']);
}
/**
* Get the latest entity from the fingerprint hash where the eas_build_id is not null.
*/
public async getLatestEasEntityFromFingerprintAsync(fingerprintHash: string): Promise<FingerprintDbEntity | null> {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
const row = await this.db.getAsync<RawFingerprintDbEntity>(
`SELECT * FROM ${FingerprintDbManager.TABLE_NAME}
WHERE eas_build_id IS NOT NULL AND eas_build_id != "" AND fingerprint_hash = ?
ORDER BY updated_at DESC LIMIT 1`,
fingerprintHash
);
return row ? FingerprintDbManager.serialize(row) : null;
}
public async getEntityFromGitCommitHashAsync(gitCommitHash: string): Promise<FingerprintDbEntity | null> {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
const row = await this.db.getAsync<RawFingerprintDbEntity>(
`SELECT * FROM ${FingerprintDbManager.TABLE_NAME} WHERE git_commit_hash = ?`,
gitCommitHash
);
return row ? FingerprintDbManager.serialize(row) : null;
}
public async getFirstEntityFromFingerprintHashAsync(fingerprintHash: string): Promise<FingerprintDbEntity | null> {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
const row = await this.db.getAsync<RawFingerprintDbEntity>(
`SELECT * FROM ${FingerprintDbManager.TABLE_NAME} WHERE fingerprint_hash = ?`,
fingerprintHash
);
return row ? FingerprintDbManager.serialize(row) : null;
}
public async queryEntitiesFromFingerprintHashAsync(fingerprintHash: string): Promise<FingerprintDbEntity[]> {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
const rows = await this.db.allAsync<RawFingerprintDbEntity>(
`SELECT * FROM ${FingerprintDbManager.TABLE_NAME} WHERE fingerprint_hash = ?`,
fingerprintHash
);
return rows.map(row => FingerprintDbManager.serialize(row));
}
public async getFingerprintSourcesAsync(fingerprintHash: string): Promise<FingerprintSource[] | null> {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
const row = await this.db.getAsync<{ sources: string }>(
`SELECT json_extract(fingerprint, '$.sources') as sources FROM ${FingerprintDbManager.TABLE_NAME} WHERE fingerprint_hash = ?`,
fingerprintHash
);
const result = row?.['sources'];
if (!result) {
return null;
}
return JSON.parse(result);
}
public async closeAsync(): Promise<void> {
this.db?.closeAsync();
}
//#region private
private static readonly SCHEMA_VERSION = 0;
private static readonly TABLE_NAME = 'fingerprint';
private static readonly SCHEMA = [
'id INTEGER PRIMARY KEY AUTOINCREMENT',
'eas_build_id TEXT',
'git_commit_hash TEXT NOT NULL',
'fingerprint_hash TEXT NOT NULL',
'fingerprint TEXT NOT NULL',
"created_at TEXT NOT NULL DEFAULT (DATETIME('now', 'utc'))",
"updated_at TEXT NOT NULL DEFAULT (DATETIME('now', 'utc'))",
];
private static readonly INDEXES = [
`CREATE UNIQUE INDEX IF NOT EXISTS idx_git_commit_hash ON ${this.TABLE_NAME} (git_commit_hash)`,
`CREATE INDEX IF NOT EXISTS idx_fingerprint_hash ON ${this.TABLE_NAME} (fingerprint_hash)`,
];
private static readonly EXTRA_CREATE_DB_STATEMENTS = [
`CREATE TRIGGER IF NOT EXISTS update_fingerprint_updated_at AFTER UPDATE ON ${this.TABLE_NAME}
BEGIN
UPDATE ${this.TABLE_NAME} SET updated_at = DATETIME('now', 'utc') WHERE id = NEW.id;
END`,
];
private db: Database | null = null;
private static serialize(rawEntity: RawFingerprintDbEntity): FingerprintDbEntity {
return {
id: rawEntity.id,
easBuildId: rawEntity.eas_build_id,
gitCommitHash: rawEntity.git_commit_hash,
fingerprintHash: rawEntity.fingerprint_hash,
fingerprint: JSON.parse(rawEntity.fingerprint),
createdAt: rawEntity.created_at,
updatedAt: rawEntity.updated_at,
};
}
//#endregion
}
interface RawFingerprintDbEntity {
id: number;
eas_build_id: string | null;
git_commit_hash: string;
fingerprint_hash: string;
fingerprint: string;
created_at: string;
updated_at: string;
}
//#region TypeScript utilities
// https://stackoverflow.com/a/63715429
type CamelizeString<T extends PropertyKey, C extends string = ''> = T extends string
? string extends T
? string
: T extends `${infer F}_${infer R}`
? CamelizeString<Capitalize<R>, `${C}${F}`>
: `${C}${T}`
: T;
type Camelize<T> = { [K in keyof T as CamelizeString<K>]: T[K] };
//#endregion
+152
View File
@@ -0,0 +1,152 @@
import { getBooleanInput, getInput, group, info } from '@actions/core';
import { context as githubContext } from '@actions/github';
import { mkdirP } from '@actions/io';
import type * as Fingerprint from '@expo/fingerprint';
import assert from 'assert';
import fs from 'fs';
import path from 'path';
import { restoreCacheAsync, restoreFromCache, saveCacheAsync, saveToCache } from '../cacher';
import { installPackage, resolvePackage } from '../packager';
import { installSQLiteAsync } from '../sqlite';
import { addGlobalNodeSearchPath, findTool, installToolFromPackage } from '../worker';
import { FingerprintDbEntity, FingerprintDbManager } from './FingerprintDbManager';
export * from './FingerprintDbManager';
export interface FingerprintOutput {
currentFingerprint: Fingerprint.Fingerprint;
previousFingerprint: Fingerprint.Fingerprint | null;
diff: Fingerprint.FingerprintSource[];
}
/**
* Shared logic to create a fingerprint diff for fingerprint actions
*/
export async function createFingerprintOutputAsync(
dbManager: FingerprintDbManager,
input: ReturnType<typeof collectFingerprintActionInput>
): Promise<FingerprintOutput> {
await installFingerprintAsync(input.fingerprintVersion, input.packager, input.fingerprintInstallationCache);
const fingerprint = require('@expo/fingerprint') as typeof import('@expo/fingerprint');
const currentFingerprint = await fingerprint.createFingerprintAsync(input.workingDirectory);
let previousFingerprint: FingerprintDbEntity | null = null;
if (input.previousGitCommitHash) {
previousFingerprint = await dbManager.getEntityFromGitCommitHashAsync(input.previousGitCommitHash);
}
const diff =
previousFingerprint != null
? await fingerprint.diffFingerprints(previousFingerprint.fingerprint, currentFingerprint)
: await fingerprint.diffFingerprints({ sources: [], hash: '' }, currentFingerprint);
return {
currentFingerprint,
previousFingerprint: previousFingerprint?.fingerprint ?? null,
diff,
};
}
/**
* Create a FingerprintDbManager instance
*/
export async function createFingerprintDbManagerAsync(
packager: string,
cacheKey: string
): Promise<FingerprintDbManager> {
await installSQLiteAsync(packager);
const dbPath = await getDbPathAsync();
const cacheHit = (await restoreDbFromCacheAsync(cacheKey)) != null;
if (cacheHit) {
info(`Restored fingerprint database from cache - cacheKey[${cacheKey}]`);
} else {
info(`Missing fingerprint database from cache - will create a new database - cacheKey[${cacheKey}]`);
}
const dbManager = new FingerprintDbManager(dbPath);
await dbManager.initAsync();
return dbManager;
}
/**
* Common inputs for fingerprint actions
*/
export function collectFingerprintActionInput() {
return {
packager: getInput('packager') || 'yarn',
githubToken: getInput('github-token'),
workingDirectory: getInput('working-directory'),
fingerprintVersion: getInput('fingerprint-version') || 'latest',
fingerprintInstallationCache:
!getInput('fingerprint-installation-cache') || getBooleanInput('fingerprint-installation-cache'),
fingerprintDbCacheKey: getInput('fingerprint-db-cache-key'),
previousGitCommitHash:
githubContext.eventName === 'pull_request'
? githubContext.payload.pull_request?.base?.sha
: githubContext.payload.before,
currentGitCommitHash:
githubContext.eventName === 'pull_request' ? githubContext.payload.pull_request?.head?.sha : githubContext.sha,
};
}
/**
* Install @expo/fingerprint based on given input
*/
export async function installFingerprintAsync(
fingerprintVersion: string,
packager: string,
useCache: boolean = true
): Promise<string> {
const packageName = '@expo/fingerprint';
const version = await resolvePackage(packageName, fingerprintVersion);
const message = useCache
? `Installing ${packageName} (${version}) from cache or with ${packager}`
: `Installing ${packageName} (${version}) with ${packager}`;
return await group(message, async () => {
let libRoot = findTool(packageName, version) || null;
if (!libRoot && useCache) {
libRoot = await restoreFromCache(packageName, version, packager);
}
if (!libRoot) {
libRoot = await installPackage(packageName, version, packager);
if (useCache) {
await saveToCache(packageName, version, packager);
}
}
installToolFromPackage(libRoot);
addGlobalNodeSearchPath(path.join(libRoot, 'node_modules'));
return libRoot;
});
}
/**
* Restore database from the remote cache.
* This will install the tool back into the local tool cache.
*/
export async function restoreDbFromCacheAsync(cacheKey: string) {
return restoreCacheAsync(path.dirname(await getDbPathAsync()), cacheKey);
}
/**
* Save database to the remote cache.
* This will fetch from the local tool cache.
*/
export async function saveDbToCacheAsync(cacheKey: string) {
info(`Saving fingerprint database to cache: ${cacheKey}`);
return saveCacheAsync(path.dirname(await getDbPathAsync()), cacheKey);
}
/**
* Get the path to the fingerprint database
*/
async function getDbPathAsync(): Promise<string> {
assert(process.env['RUNNER_TOOL_CACHE'], 'Could not resolve the local tool cache, RUNNER_TOOL_CACHE not defined');
const result = path.join(process.env['RUNNER_TOOL_CACHE'], 'fingerprint-storage', 'fingerprint.db');
const dir = path.dirname(result);
if (!(await fs.promises.stat(dir).catch(() => null))) {
await mkdirP(dir);
}
return result;
}
+36
View File
@@ -141,3 +141,39 @@ export function issueComment() {
},
] as const;
}
/**
* Get the commit message for a specific commit hash.
*/
export async function getGitCommandMessageAsync(options: AuthContext, gitCommitHash: string): Promise<string> {
const github = githubApi({ token: options.token });
const result = await github.rest.git.getCommit({
...context.repo,
commit_sha: gitCommitHash,
});
return result.data.message;
}
/**
* True if the current event is a push to the default branch.
*/
export function isPushDefaultBranchContext() {
return context.eventName === 'push' && context.ref === `refs/heads/${context.payload?.repository?.default_branch}`;
}
/**
* Get the pull request information that associated with a specific commit hash.
*/
export async function getPullRequestFromGitCommitShaAsync(options: AuthContext, gitCommitHash: string) {
const github = githubApi({ token: options.token });
const results = await github.rest.repos.listPullRequestsAssociatedWithCommit({
...context.repo,
commit_sha: gitCommitHash,
});
return results.data.map(pr => ({
id: pr.id,
prNumber: pr.number,
prHeadCommitSha: pr.head.sha,
mergeCommitSha: pr.merge_commit_sha,
}));
}
+72
View File
@@ -0,0 +1,72 @@
import { group } from '@actions/core';
import assert from 'assert';
import path from 'path';
import type sqlite3Types from 'sqlite3';
import { promisify } from 'util';
import { restoreFromCache, saveToCache } from './cacher';
import { installPackage, resolvePackage } from './packager';
import { addGlobalNodeSearchPath, findTool } from './worker';
/**
* A database object with async methods.
*/
export interface Database extends sqlite3Types.Database {
closeAsync: () => Promise<void>;
runAsync: (sql: string, ...params: any[]) => Promise<sqlite3Types.RunResult>;
execAsync: (sql: string) => Promise<void>;
prepareAsync: (sql: string, ...params: any[]) => Promise<sqlite3Types.Statement>;
getAsync: <T>(sql: string, ...params: any[]) => Promise<T>;
allAsync: <T>(sql: string, ...params: any[]) => Promise<T[]>;
}
/**
* Open a database and return a promise that resolves to a database object.
*/
export function openDatabaseAsync(filename: string): Promise<Database> {
return new Promise<sqlite3Types.Database>((resolve, reject) => {
const sqlite3 = require('sqlite3') as typeof import('sqlite3');
const db = new sqlite3.Database(filename, err => {
if (err) {
reject(err);
} else {
resolve(db);
}
});
}).then(db => {
return {
...db,
closeAsync: promisify(db.close.bind(db)),
runAsync: promisify(db.run.bind(db)),
execAsync: promisify(db.exec.bind(db)),
prepareAsync: promisify(db.prepare.bind(db)),
getAsync: promisify(db.get.bind(db)),
allAsync: promisify(db.all.bind(db)),
} as Database;
});
}
/**
* Install the sqlite3
*/
export async function installSQLiteAsync(packager: string): Promise<string> {
const sqliteVersion = require('../package.json').devDependencies.sqlite3;
assert(sqliteVersion);
const packageName = 'sqlite3';
const version = await resolvePackage(packageName, sqliteVersion);
const message = `Installing ${packageName} (${version}) from cache or with ${packager}`;
return await group(message, async () => {
let libRoot = findTool(packageName, version) || null;
if (!libRoot) {
libRoot = await restoreFromCache(packageName, version, packager);
}
if (!libRoot) {
libRoot = await installPackage(packageName, version, packager);
await saveToCache(packageName, version, packager);
}
addGlobalNodeSearchPath(path.join(libRoot, 'node_modules'));
return libRoot;
});
}
+12
View File
@@ -74,3 +74,15 @@ export function toolPath(name: string, version: string): string {
assert(process.env['RUNNER_TOOL_CACHE'], 'Could not resolve the local tool cache, RUNNER_TOOL_CACHE not defined');
return path.join(process.env['RUNNER_TOOL_CACHE'], name, version, os.arch());
}
/**
* Add extra `searchPath` to the global search path for require()
*/
export function addGlobalNodeSearchPath(searchPath: string) {
const nodePath = process.env['NODE_PATH'] || '';
const delimiter = process.platform === 'win32' ? ';' : ':';
const nodePaths = nodePath.split(delimiter);
nodePaths.push(searchPath);
process.env['NODE_PATH'] = nodePaths.join(delimiter);
require('module').Module._initPaths();
}
+2 -2
View File
@@ -34,7 +34,7 @@ describe(restoreFromCache, () => {
it('skips when cache is unavailable', async () => {
jest.mocked(cache.isFeatureAvailable).mockReturnValue(false);
jest.mocked(cache.restoreCache).mockRejectedValue(new Error('Cache service url not found'));
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).resolves.toBeUndefined();
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).resolves.toBeNull();
});
it('throws when cache has unexpected error', async () => {
@@ -52,7 +52,7 @@ describe(restoreFromCache, () => {
it('returns nothing when cache is empty', async () => {
jest.mocked(cache.isFeatureAvailable).mockReturnValue(true);
jest.mocked(cache.restoreCache).mockResolvedValue(undefined);
await expect(restoreFromCache('eas-cli', '0.46.2', 'npm')).resolves.toBeUndefined();
await expect(restoreFromCache('eas-cli', '0.46.2', 'npm')).resolves.toBeNull();
});
});
@@ -0,0 +1,174 @@
import type { FingerprintSource } from '@expo/fingerprint';
import { FingerprintDbManager } from '../../src/fingerprint/FingerprintDbManager';
describe(FingerprintDbManager, () => {
let fingerprintDbManager: FingerprintDbManager;
beforeEach(async () => {
fingerprintDbManager = new FingerprintDbManager(':memory:');
await fingerprintDbManager.initAsync();
});
afterEach(async () => {
await fingerprintDbManager.closeAsync();
});
it('queryEasBuildIdsFromFingerprintAsync', async () => {
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash', {
easBuildId: 'id1',
fingerprint: { sources: [], hash: 'hash1' },
});
expect(await fingerprintDbManager.queryEasBuildIdsFromFingerprintAsync('nonExistedId')).toEqual([]);
expect(await fingerprintDbManager.queryEasBuildIdsFromFingerprintAsync('hash1')).toEqual(['id1']);
});
it('getFingerprintSourcesAsync', async () => {
const sources: FingerprintSource[] = [
{
type: 'file',
filePath: './assets/icon.png',
reasons: ['expoConfigExternalFile'],
hash: '3f71f5a8458c06b83424cc33e1f2481f601199ea',
},
{
type: 'dir',
filePath: 'node_modules/expo',
reasons: ['expoAutolinkingIos', 'expoAutolinkingAndroid'],
hash: 'ae5d1bd2395e8766c1a1394ce948bf6003b4fd25',
},
{
type: 'contents',
id: 'packageJson:scripts',
contents: '{"start":"expo start","android":"expo run:android","ios":"expo run:ios","web":"expo start --web"}',
reasons: ['packageJson:scripts'],
hash: '119dec73c92445762a48c9455d9f34a643be8cf0',
},
];
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash', {
easBuildId: 'id1',
fingerprint: { sources, hash: 'hash1' },
});
expect(await fingerprintDbManager.getFingerprintSourcesAsync('nonExistedId')).toBe(null);
expect(await fingerprintDbManager.getFingerprintSourcesAsync('hash1')).toEqual(sources);
});
it('getEntityFromGitCommitHashAsync', async () => {
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash', {
easBuildId: 'id1',
fingerprint: { sources: [], hash: 'hash1' },
});
expect(await fingerprintDbManager.getEntityFromGitCommitHashAsync('nonExistedHash')).toBe(null);
const result = await fingerprintDbManager.getEntityFromGitCommitHashAsync('gitHash');
expect(result?.easBuildId).toEqual('id1');
expect(result?.gitCommitHash).toEqual('gitHash');
expect(result?.fingerprintHash).toEqual('hash1');
expect(result?.fingerprint).toEqual({ sources: [], hash: 'hash1' });
});
it('getFirstEntityFromFingerprintHashAsync', async () => {
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash1', {
fingerprint: {
sources: [],
hash: 'hash1',
},
});
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash2', {
easBuildId: 'id1',
fingerprint: { sources: [], hash: 'hash1' },
});
const result = await fingerprintDbManager.getFirstEntityFromFingerprintHashAsync('hash1');
expect(result?.gitCommitHash).toBe('gitHash1');
});
it('queryEntitiesFromFingerprintHashAsync', async () => {
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash1', {
fingerprint: {
sources: [],
hash: 'hash1',
},
});
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash2', {
easBuildId: 'id1',
fingerprint: { sources: [], hash: 'hash1' },
});
const results = await fingerprintDbManager.queryEntitiesFromFingerprintHashAsync('hash1');
expect(results.length).toBe(2);
expect(results[0].gitCommitHash).toBe('gitHash1');
expect(results[1].gitCommitHash).toBe('gitHash2');
});
it('upsertFingerprintByGitCommitHashAsync should update existing data', async () => {
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash', {
easBuildId: '',
fingerprint: { sources: [], hash: 'hash1' },
});
let result = await fingerprintDbManager.getEntityFromGitCommitHashAsync('gitHash');
expect(result?.fingerprintHash).toEqual('hash1');
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash', {
easBuildId: 'easBuildId',
fingerprint: { sources: [], hash: 'hash2' },
});
result = await fingerprintDbManager.getEntityFromGitCommitHashAsync('gitHash');
expect(result?.easBuildId).toEqual('easBuildId');
expect(result?.fingerprintHash).toEqual('hash2');
expect(result?.fingerprint).toEqual({ sources: [], hash: 'hash2' });
});
it('createdAt value should be auto generated', async () => {
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash', {
easBuildId: '',
fingerprint: { sources: [], hash: 'hash1' },
});
const result = await fingerprintDbManager.getEntityFromGitCommitHashAsync('gitHash');
expect(result?.createdAt).not.toBe(null);
});
it('updatedAt value should be auto updated', async () => {
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash', {
easBuildId: '',
fingerprint: { sources: [], hash: 'hash1' },
});
let result = await fingerprintDbManager.getEntityFromGitCommitHashAsync('gitHash');
expect(result?.updatedAt).not.toBe(null);
const previousUpdatedAt = result?.updatedAt;
await delayAsync(1000);
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash', {
easBuildId: 'buildId',
fingerprint: { sources: [], hash: 'hash2' },
});
result = await fingerprintDbManager.getEntityFromGitCommitHashAsync('gitHash');
expect(result?.updatedAt).not.toEqual(previousUpdatedAt);
});
it('getLatestEasEntityFromFingerprintAsync should return the latest entity', async () => {
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash2', {
easBuildId: '',
fingerprint: { sources: [], hash: 'hash1' },
});
await delayAsync(1000);
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash1', {
easBuildId: 'buildId',
fingerprint: { sources: [], hash: 'hash1' },
});
await delayAsync(1000);
await fingerprintDbManager.upsertFingerprintByGitCommitHashAsync('gitHash3', {
easBuildId: '',
fingerprint: { sources: [], hash: 'hash1' },
});
const result = await fingerprintDbManager.getLatestEasEntityFromFingerprintAsync('hash1');
expect(result?.gitCommitHash).toEqual('gitHash1');
});
});
async function delayAsync(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}
+36
View File
@@ -0,0 +1,36 @@
import { openDatabaseAsync, Database } from '../src/sqlite';
describe(openDatabaseAsync, () => {
let db: Database;
beforeAll(async () => {
db = await openDatabaseAsync(':memory:');
});
afterAll(async () => {
await db.closeAsync();
});
it('should be able to create a table', async () => {
await db.runAsync('CREATE TABLE lorem (info TEXT)');
await db.runAsync('INSERT INTO lorem VALUES (?)', 'ipsum');
const results = await db.allAsync<{ info: string }>('SELECT * FROM lorem');
expect(results).toEqual([{ info: 'ipsum' }]);
await db.runAsync('DROP TABLE lorem');
});
it('should return first row result from `getAsync`', async () => {
await db.runAsync('CREATE TABLE lorem (info TEXT)');
await db.runAsync('INSERT INTO lorem VALUES (?), (?), (?)', '1', '2', '3');
const results = await db.getAsync<{ info: string }>('SELECT * FROM lorem');
expect(results).toEqual({ info: '1' });
await db.runAsync('DROP TABLE lorem');
});
it('should support array results from `allAsync`', async () => {
await db.runAsync('CREATE TABLE lorem (info TEXT)');
await db.runAsync('INSERT INTO lorem VALUES (?), (?), (?)', '1', '2', '3');
const results = await db.allAsync<{ info: string }>('SELECT * FROM lorem');
expect(results).toEqual([{ info: '1' }, { info: '2' }, { info: '3' }]);
await db.runAsync('DROP TABLE lorem');
});
});
+274 -16
View File
@@ -862,6 +862,19 @@
slugify "^1.3.4"
sucrase "^3.20.0"
"@expo/fingerprint@^0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@expo/fingerprint/-/fingerprint-0.1.0.tgz#5b0fd75eac77cb087ea944bdc699023f56e11d7f"
integrity sha512-5OmPYCvTK0Pzn10R4uqgxYBPynYrK0mPLAtIj/ejRq0iExazK4LOzYpFN4K0iO/rzmrRdYNl1+4HiXZQtkbc+g==
dependencies:
"@expo/spawn-async" "^1.5.0"
chalk "^4.1.2"
debug "^4.3.4"
find-up "^5.0.0"
minimatch "^3.0.4"
p-limit "^3.1.0"
resolve-from "^5.0.0"
"@expo/[email protected]":
version "8.2.36"
resolved "https://registry.yarnpkg.com/@expo/json-file/-/json-file-8.2.36.tgz#62a505cb7f30a34d097386476794680a3f7385ff"
@@ -885,7 +898,14 @@
resolved "https://registry.yarnpkg.com/@expo/sdk-runtime-versions/-/sdk-runtime-versions-1.0.0.tgz#d7ebd21b19f1c6b0395e50d78da4416941c57f7c"
integrity sha512-Doz2bfiPndXYFPMRwPyGa1k5QaKDVpY806UJj570epIiMzWaYyCtobasyfC++qfIXVb5Ocy7r3tP9d62hAQ7IQ==
"@gar/promisify@^1.1.3":
"@expo/spawn-async@^1.5.0":
version "1.7.2"
resolved "https://registry.yarnpkg.com/@expo/spawn-async/-/spawn-async-1.7.2.tgz#fcfe66c3e387245e72154b1a7eae8cada6a47f58"
integrity sha512-QdWi16+CHB9JYP7gma19OVVg0BFkvU8zNj9GjWorYI8Iv8FUxjOCcYRuAmX4s/h91e4e7BPsskc8cSrZYho9Ew==
dependencies:
cross-spawn "^7.0.3"
"@gar/promisify@^1.0.1", "@gar/promisify@^1.1.3":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==
@@ -1162,6 +1182,21 @@
"@jridgewell/resolve-uri" "3.1.0"
"@jridgewell/sourcemap-codec" "1.4.14"
"@mapbox/node-pre-gyp@^1.0.0":
version "1.0.11"
resolved "https://registry.yarnpkg.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz#417db42b7f5323d79e93b34a6d7a2a12c0df43fa"
integrity sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==
dependencies:
detect-libc "^2.0.0"
https-proxy-agent "^5.0.0"
make-dir "^3.1.0"
node-fetch "^2.6.7"
nopt "^5.0.0"
npmlog "^5.0.1"
rimraf "^3.0.2"
semver "^7.3.5"
tar "^6.1.11"
"@nodelib/[email protected]":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
@@ -1260,6 +1295,14 @@
dependencies:
ansi-styles "^4.3.0"
"@npmcli/fs@^1.0.0":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-1.1.1.tgz#72f719fe935e687c56a4faecf3c03d06ba593257"
integrity sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ==
dependencies:
"@gar/promisify" "^1.0.1"
semver "^7.3.5"
"@npmcli/fs@^2.1.0", "@npmcli/fs@^2.1.1":
version "2.1.2"
resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-2.1.2.tgz#a9e2541a4a2fec2e69c29b35e6060973da79b865"
@@ -1311,6 +1354,14 @@
pacote "^13.0.3"
semver "^7.3.5"
"@npmcli/move-file@^1.0.1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@npmcli/move-file/-/move-file-1.1.2.tgz#1a82c3e372f7cae9253eb66d72543d6b8685c674"
integrity sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==
dependencies:
mkdirp "^1.0.4"
rimraf "^3.0.2"
"@npmcli/move-file@^2.0.0":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@npmcli/move-file/-/move-file-2.0.1.tgz#26f6bdc379d87f75e55739bab89db525b06100e4"
@@ -1661,6 +1712,11 @@
dependencies:
"@sinonjs/commons" "^1.7.0"
"@tootallnate/once@1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==
"@tootallnate/once@2":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf"
@@ -1808,6 +1864,11 @@
dependencies:
"@types/node" "*"
"@types/uuid@^9.0.3":
version "9.0.3"
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.3.tgz#6cdd939b4316b4f81625de9f06028d848c4a1533"
integrity sha512-taHQQH/3ZyI3zP8M/puluDEIEvtQHVYcC6y3N8ijFtAd28+Ey/G4sg1u2gB01S8MwybLOKAp9/yCMu/uR5l3Ug==
"@types/yargs-parser@*":
version "20.2.0"
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.0.tgz#dd3e6699ba3237f0348cd085e4698780204842f9"
@@ -1921,7 +1982,7 @@ JSONStream@^1.0.4:
jsonparse "^1.2.0"
through ">=2.2.7 <3"
abbrev@^1.0.0, abbrev@~1.1.1:
abbrev@1, abbrev@^1.0.0, abbrev@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==
@@ -1950,6 +2011,13 @@ agent-base@6, agent-base@^6.0.2:
dependencies:
debug "4"
agentkeepalive@^4.1.3:
version "4.5.0"
resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923"
integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==
dependencies:
humanize-ms "^1.2.1"
agentkeepalive@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.2.1.tgz#a7975cbb9f83b367f06c90cc51ff28fe7d499717"
@@ -2043,6 +2111,14 @@ archy@~1.0.0:
resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40"
integrity sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=
are-we-there-yet@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz#372e0e7bd279d8e94c653aaa1f67200884bf3e1c"
integrity sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==
dependencies:
delegates "^1.0.0"
readable-stream "^3.6.0"
are-we-there-yet@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz#679df222b278c64f2cdba1175cdc00b0d96164bd"
@@ -2330,6 +2406,30 @@ builtins@^5.0.0:
dependencies:
semver "^7.0.0"
cacache@^15.2.0:
version "15.3.0"
resolved "https://registry.yarnpkg.com/cacache/-/cacache-15.3.0.tgz#dc85380fb2f556fe3dda4c719bfa0ec875a7f1eb"
integrity sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==
dependencies:
"@npmcli/fs" "^1.0.0"
"@npmcli/move-file" "^1.0.1"
chownr "^2.0.0"
fs-minipass "^2.0.0"
glob "^7.1.4"
infer-owner "^1.0.4"
lru-cache "^6.0.0"
minipass "^3.1.1"
minipass-collect "^1.0.2"
minipass-flush "^1.0.5"
minipass-pipeline "^1.2.2"
mkdirp "^1.0.3"
p-map "^4.0.0"
promise-inflight "^1.0.1"
rimraf "^3.0.2"
ssri "^8.0.1"
tar "^6.0.2"
unique-filename "^1.1.1"
cacache@^16.0.0, cacache@^16.1.0, cacache@^16.1.3:
version "16.1.3"
resolved "https://registry.yarnpkg.com/cacache/-/cacache-16.1.3.tgz#a02b9f34ecfaf9a78c9f4bc16fceb94d5d67a38e"
@@ -2547,7 +2647,7 @@ color-name@~1.1.4:
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
color-support@^1.1.3:
color-support@^1.1.2, color-support@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2"
integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==
@@ -2590,7 +2690,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
console-control-strings@^1.1.0:
console-control-strings@^1.0.0, console-control-strings@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"
integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==
@@ -2814,6 +2914,11 @@ deprecation@^2.0.0, deprecation@^2.3.1:
resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919"
integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==
detect-libc@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.2.tgz#8ccf2ba9315350e1241b88d0ac3b0e1fbd99605d"
integrity sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==
detect-newline@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651"
@@ -2892,7 +2997,7 @@ emoji-regex@^8.0.0:
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
encoding@^0.1.13:
encoding@^0.1.12, encoding@^0.1.13:
version "0.1.13"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9"
integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==
@@ -3547,6 +3652,21 @@ functions-have-names@^1.2.2:
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834"
integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==
gauge@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/gauge/-/gauge-3.0.2.tgz#03bf4441c044383908bcfa0656ad91803259b395"
integrity sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==
dependencies:
aproba "^1.0.3 || ^2.0.0"
color-support "^1.1.2"
console-control-strings "^1.0.0"
has-unicode "^2.0.1"
object-assign "^4.1.1"
signal-exit "^3.0.0"
string-width "^4.2.3"
strip-ansi "^6.0.1"
wide-align "^1.1.2"
gauge@^4.0.3:
version "4.0.4"
resolved "https://registry.yarnpkg.com/gauge/-/gauge-4.0.4.tgz#52ff0652f2bbf607a989793d53b751bef2328dce"
@@ -3845,6 +3965,15 @@ http-cache-semantics@^4.1.0:
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"
integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==
http-proxy-agent@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a"
integrity sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==
dependencies:
"@tootallnate/once" "1"
agent-base "6"
debug "4"
http-proxy-agent@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43"
@@ -4995,7 +5124,7 @@ lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1:
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.14.1.tgz#8da8d2f5f59827edb388e63e459ac23d6d408fea"
integrity sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==
make-dir@^3.0.0:
make-dir@^3.0.0, make-dir@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==
@@ -5029,6 +5158,28 @@ make-fetch-happen@^10.0.3, make-fetch-happen@^10.0.6, make-fetch-happen@^10.2.0:
socks-proxy-agent "^7.0.0"
ssri "^9.0.0"
make-fetch-happen@^9.1.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz#53085a09e7971433e6765f7971bf63f4e05cb968"
integrity sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==
dependencies:
agentkeepalive "^4.1.3"
cacache "^15.2.0"
http-cache-semantics "^4.1.0"
http-proxy-agent "^4.0.1"
https-proxy-agent "^5.0.0"
is-lambda "^1.0.1"
lru-cache "^6.0.0"
minipass "^3.1.3"
minipass-collect "^1.0.2"
minipass-fetch "^1.3.2"
minipass-flush "^1.0.5"
minipass-pipeline "^1.2.4"
negotiator "^0.6.2"
promise-retry "^2.0.1"
socks-proxy-agent "^6.0.0"
ssri "^8.0.0"
[email protected]:
version "1.0.12"
resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a"
@@ -5160,6 +5311,17 @@ minipass-collect@^1.0.2:
dependencies:
minipass "^3.0.0"
minipass-fetch@^1.3.2:
version "1.4.1"
resolved "https://registry.yarnpkg.com/minipass-fetch/-/minipass-fetch-1.4.1.tgz#d75e0091daac1b0ffd7e9d41629faff7d0c1f1b6"
integrity sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==
dependencies:
minipass "^3.1.0"
minipass-sized "^1.0.3"
minizlib "^2.0.0"
optionalDependencies:
encoding "^0.1.12"
minipass-fetch@^2.0.3:
version "2.1.2"
resolved "https://registry.yarnpkg.com/minipass-fetch/-/minipass-fetch-2.1.2.tgz#95560b50c472d81a3bc76f20ede80eaed76d8add"
@@ -5186,7 +5348,7 @@ minipass-json-stream@^1.0.1:
jsonparse "^1.3.1"
minipass "^3.0.0"
minipass-pipeline@^1.2.4:
minipass-pipeline@^1.2.2, minipass-pipeline@^1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz#68472f79711c084657c067c5c6ad93cddea8214c"
integrity sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==
@@ -5207,7 +5369,7 @@ minipass@^3.0.0, minipass@^3.1.1:
dependencies:
yallist "^4.0.0"
minipass@^3.1.6:
minipass@^3.1.0, minipass@^3.1.3, minipass@^3.1.6:
version "3.3.6"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.6.tgz#7bba384db3a1520d18c9c0e5251c3444e95dd94a"
integrity sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==
@@ -5221,7 +5383,12 @@ minipass@^4.0.0:
dependencies:
yallist "^4.0.0"
minizlib@^2.1.1, minizlib@^2.1.2:
minipass@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d"
integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==
minizlib@^2.0.0, minizlib@^2.1.1, minizlib@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931"
integrity sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==
@@ -5287,7 +5454,7 @@ natural-compare@^1.4.0:
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=
negotiator@^0.6.3:
negotiator@^0.6.2, negotiator@^0.6.3:
version "0.6.3"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd"
integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==
@@ -5302,6 +5469,11 @@ nerf-dart@^1.0.0:
resolved "https://registry.yarnpkg.com/nerf-dart/-/nerf-dart-1.0.0.tgz#e6dab7febf5ad816ea81cf5c629c5a0ebde72c1a"
integrity sha1-5tq3/r9a2Bbqgc9cYpxaDr3nLBo=
node-addon-api@^4.2.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.3.0.tgz#52a1a0b475193e0928e98e0426a0d1254782b77f"
integrity sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==
node-emoji@^1.11.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.11.0.tgz#69a0150e6946e2f115e9d7ea4df7971e2628301c"
@@ -5316,6 +5488,22 @@ node-fetch@^2.6.1, node-fetch@^2.6.7:
dependencies:
whatwg-url "^5.0.0"
[email protected]:
version "8.4.1"
resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-8.4.1.tgz#3d49308fc31f768180957d6b5746845fbd429937"
integrity sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w==
dependencies:
env-paths "^2.2.0"
glob "^7.1.4"
graceful-fs "^4.2.6"
make-fetch-happen "^9.1.0"
nopt "^5.0.0"
npmlog "^6.0.0"
rimraf "^3.0.2"
semver "^7.3.5"
tar "^6.1.2"
which "^2.0.2"
node-gyp@^9.0.0, node-gyp@^9.1.0:
version "9.3.1"
resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-9.3.1.tgz#1e19f5f290afcc9c46973d68700cbd21a96192e4"
@@ -5347,6 +5535,13 @@ node-releases@^2.0.6:
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.8.tgz#0f349cdc8fcfa39a92ac0be9bc48b7706292b9ae"
integrity sha512-dFSmB8fFHEH/s81Xi+Y/15DQY6VHW81nXRj86EMSL3lmuTmK1e+aT4wrFCkTbm+gSwkw4KpX+rT/pMM2c1mF+A==
nopt@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88"
integrity sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==
dependencies:
abbrev "1"
nopt@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-6.0.0.tgz#245801d8ebf409c6df22ab9d95b65e1309cdb16d"
@@ -5574,6 +5769,16 @@ npm@^8.3.0:
which "^2.0.2"
write-file-atomic "^4.0.1"
npmlog@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-5.0.1.tgz#f06678e80e29419ad67ab964e0fa69959c1eb8b0"
integrity sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==
dependencies:
are-we-there-yet "^2.0.0"
console-control-strings "^1.1.0"
gauge "^3.0.0"
set-blocking "^2.0.0"
npmlog@^6.0.0, npmlog@^6.0.2:
version "6.0.2"
resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-6.0.2.tgz#c8166017a42f2dea92d6453168dd865186a70830"
@@ -6424,16 +6629,16 @@ side-channel@^1.0.4:
get-intrinsic "^1.0.2"
object-inspect "^1.9.0"
signal-exit@^3.0.0, signal-exit@^3.0.7:
version "3.0.7"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
signal-exit@^3.0.2, signal-exit@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
signal-exit@^3.0.7:
version "3.0.7"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
signale@^1.2.1:
version "1.4.0"
resolved "https://registry.yarnpkg.com/signale/-/signale-1.4.0.tgz#c4be58302fb0262ac00fc3d886a7c113759042f1"
@@ -6472,6 +6677,15 @@ smart-buffer@^4.2.0:
resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae"
integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==
socks-proxy-agent@^6.0.0:
version "6.2.1"
resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-6.2.1.tgz#2687a31f9d7185e38d530bef1944fe1f1496d6ce"
integrity sha512-a6KW9G+6B3nWZ1yB8G7pJwL3ggLy1uTzKAgCb7ttblwqdz9fMGJUuTy3uFzEP48FAs9FLILlmzDlE2JJhVQaXQ==
dependencies:
agent-base "^6.0.2"
debug "^4.3.3"
socks "^2.6.2"
socks-proxy-agent@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz#dc069ecf34436621acb41e3efa66ca1b5fed15b6"
@@ -6564,6 +6778,24 @@ sprintf-js@~1.0.2:
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
sqlite3@^5.1.6:
version "5.1.6"
resolved "https://registry.yarnpkg.com/sqlite3/-/sqlite3-5.1.6.tgz#1d4fbc90fe4fbd51e952e0a90fd8f6c2b9098e97"
integrity sha512-olYkWoKFVNSSSQNvxVUfjiVbz3YtBwTJj+mfV5zpHmqW3sELx2Cf4QCdirMelhM5Zh+KDVaKgQHqCxrqiWHybw==
dependencies:
"@mapbox/node-pre-gyp" "^1.0.0"
node-addon-api "^4.2.0"
tar "^6.1.11"
optionalDependencies:
node-gyp "8.x"
ssri@^8.0.0, ssri@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-8.0.1.tgz#638e4e439e2ffbd2cd289776d5ca457c4f51a2af"
integrity sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==
dependencies:
minipass "^3.1.1"
ssri@^9.0.0, ssri@^9.0.1:
version "9.0.1"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-9.0.1.tgz#544d4c357a8d7b71a19700074b6883fcb4eae057"
@@ -6771,6 +7003,18 @@ supports-preserve-symlinks-flag@^1.0.0:
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
tar@^6.0.2:
version "6.2.0"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.0.tgz#b14ce49a79cb1cd23bc9b016302dea5474493f73"
integrity sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==
dependencies:
chownr "^2.0.0"
fs-minipass "^2.0.0"
minipass "^5.0.0"
minizlib "^2.1.1"
mkdirp "^1.0.3"
yallist "^4.0.0"
tar@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.0.tgz#d1724e9bcc04b977b18d5c573b333a2207229a83"
@@ -7052,6 +7296,13 @@ unbox-primitive@^1.0.2:
has-symbols "^1.0.3"
which-boxed-primitive "^1.0.2"
unique-filename@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230"
integrity sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==
dependencies:
unique-slug "^2.0.0"
unique-filename@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-2.0.1.tgz#e785f8675a9a7589e0ac77e0b5c34d2eaeac6da2"
@@ -7059,6 +7310,13 @@ unique-filename@^2.0.0:
dependencies:
unique-slug "^3.0.0"
unique-slug@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.2.tgz#baabce91083fc64e945b0f3ad613e264f7cd4e6c"
integrity sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==
dependencies:
imurmurhash "^0.1.4"
unique-slug@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-3.0.0.tgz#6d347cf57c8a7a7a6044aabd0e2d74e4d76dc7c9"
@@ -7202,7 +7460,7 @@ which@^2.0.1, which@^2.0.2:
dependencies:
isexe "^2.0.0"
wide-align@^1.1.5:
wide-align@^1.1.2, wide-align@^1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.5.tgz#df1d4c206854369ecf3c9a4898f1b23fbd9d15d3"
integrity sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==