diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 00000000..716eeeac
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,28 @@
+module.exports = {
+ root: true,
+ extends: ['universe/node'],
+ ignorePatterns: ['build/**', 'node_modules/**'],
+ rules: {
+ 'prettier/prettier': 'error',
+ 'sort-imports': [
+ 'warn',
+ {
+ ignoreDeclarationSort: true,
+ },
+ ],
+ curly: 'warn',
+ },
+ overrides: [
+ {
+ files: ['*.ts', '*.tsx', '*.d.ts'],
+ extends: ['universe/shared/typescript-analysis'],
+ excludedFiles: ['**/tests/**'],
+ parserOptions: {
+ project: './tsconfig.json',
+ },
+ rules: {
+ '@typescript-eslint/prefer-nullish-coalescing': ['warn', { ignorePrimitives: true }],
+ },
+ },
+ ],
+};
diff --git a/build/command/index.js b/build/command/index.js
index be6fc805..295dc5fb 100644
--- a/build/command/index.js
+++ b/build/command/index.js
@@ -38898,7 +38898,8 @@ function projectAppType(dir) {
catch (error) {
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
}
- if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
+ if (packageJson?.dependencies?.['expo-dev-client'] ||
+ packageJson?.devDependencies?.['expo-dev-client']) {
return 'dev-build';
}
return 'expo-go';
diff --git a/build/continuous-deploy-fingerprint/index.js b/build/continuous-deploy-fingerprint/index.js
index 8398b729..fdcff6b4 100644
--- a/build/continuous-deploy-fingerprint/index.js
+++ b/build/continuous-deploy-fingerprint/index.js
@@ -41909,7 +41909,7 @@ async function assertEasVersion(versionRange) {
throw new Error(`Could not verify the EAS CLI version, reason:\nCommand failed 'eas --version'`);
}
const version = stdout.match(/eas-cli\/([^\s]+)/i);
- if (!version || !version[1]) {
+ if (!version?.[1]) {
throw new Error(`Could not verify the EAS CLI version, reason:\nUnexpected output received.`);
}
if (!semver_1.default.satisfies(version[1], versionRange)) {
@@ -42167,7 +42167,8 @@ function projectAppType(dir) {
catch (error) {
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
}
- if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
+ if (packageJson?.dependencies?.['expo-dev-client'] ||
+ packageJson?.devDependencies?.['expo-dev-client']) {
return 'dev-build';
}
return 'expo-go';
@@ -44555,7 +44556,10 @@ async function continuousDeployFingerprintAction(input = collectContinuousDeploy
cwd: input.workingDirectory,
platform: 'android',
});
- const iosFingerprintHash = await getFingerprintHashForPlatformAsync({ cwd: input.workingDirectory, platform: 'ios' });
+ const iosFingerprintHash = await getFingerprintHashForPlatformAsync({
+ cwd: input.workingDirectory,
+ platform: 'ios',
+ });
(0, core_1.info)(`Android fingerprint: ${androidFingerprintHash}`);
(0, core_1.info)(`iOS fingerprint: ${iosFingerprintHash}`);
(0, core_1.info)('Looking for builds with matching runtime version (fingerprint)...');
@@ -44686,7 +44690,12 @@ async function getBuildInfoWithFingerprintAsync({ cwd, platform, profile, finger
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
const buildsThatAreValid = builds.filter(build => {
- const isValidStatus = [expo_1.BuildStatus.New, expo_1.BuildStatus.InQueue, expo_1.BuildStatus.InProgress, expo_1.BuildStatus.Finished].includes(build.status);
+ const isValidStatus = [
+ expo_1.BuildStatus.New,
+ expo_1.BuildStatus.InQueue,
+ expo_1.BuildStatus.InProgress,
+ expo_1.BuildStatus.Finished,
+ ].includes(build.status);
// if the build is expired or will expire within the next day,
const isValidExpiry = excludeExpiredBuilds ? new Date(build.expirationDate) < tomorrow : true;
return isValidStatus && isValidExpiry;
@@ -44697,7 +44706,17 @@ async function createEASBuildAsync({ cwd, profile, platform, }) {
let stdout;
try {
const extraArgs = (0, core_1.isDebug)() ? ['--build-logger-level', 'debug'] : [];
- const execOutput = await (0, exec_1.getExecOutput)(await (0, io_1.which)('eas', true), ['build', '--profile', profile, '--platform', platform, '--non-interactive', '--json', '--no-wait', ...extraArgs], {
+ const execOutput = await (0, exec_1.getExecOutput)(await (0, io_1.which)('eas', true), [
+ 'build',
+ '--profile',
+ profile,
+ '--platform',
+ platform,
+ '--non-interactive',
+ '--json',
+ '--no-wait',
+ ...extraArgs,
+ ], {
cwd,
silent: !(0, core_1.isDebug)(),
});
@@ -44708,7 +44727,7 @@ async function createEASBuildAsync({ cwd, profile, platform, }) {
}
return JSON.parse(stdout)[0];
}
-async function publishEASUpdatesAsync({ cwd, branch }) {
+async function publishEASUpdatesAsync({ cwd, branch, }) {
let stdout;
try {
const execOutput = await (0, exec_1.getExecOutput)(await (0, io_1.which)('eas', true), ['update', '--auto', '--branch', branch, '--non-interactive', '--json'], {
@@ -44730,7 +44749,9 @@ function createSummaryForUpdatesAndBuilds({ config, projectId, updates, buildRun
const androidUpdate = updates.find(update => update.platform === 'android');
const iosUpdate = updates.find(update => update.platform === 'ios');
const getBuildLink = (build) => build ? `[Build Permalink](${(0, expo_1.getBuildLogsUrl)(build)})` : 'n/a';
- const getUpdateLink = (update) => update ? `[Update Permalink](${(0, eas_1.getUpdateGroupWebsite)({ projectId, updateGroupId: update.group })})` : 'n/a';
+ const getUpdateLink = (update) => update
+ ? `[Update Permalink](${(0, eas_1.getUpdateGroupWebsite)({ projectId, updateGroupId: update.group })})`
+ : 'n/a';
const getUpdateQRURL = (update) => update ? (0, eas_1.getUpdateGroupQr)({ projectId, updateGroupId: update.group, appSlug, qrTarget }) : null;
const getBuildDetails = (buildRunInfo) => getBuildLink(buildRunInfo.buildInfo) +
'
' +
@@ -44763,7 +44784,9 @@ function createSummaryForUpdatesAndBuilds({ config, projectId, updates, buildRun
const androidQr = androidQRURL
? ``
: null;
- const iosQr = iosQRURL ? `` : null;
+ const iosQr = iosQRURL
+ ? ``
+ : null;
const platformName = `Platform${updates.length === 1 ? '' : 's'}`;
const platformValue = updates
.map(update => update.platform)
diff --git a/build/fingerprint-post/index.js b/build/fingerprint-post/index.js
index da05fed9..33b599fa 100644
--- a/build/fingerprint-post/index.js
+++ b/build/fingerprint-post/index.js
@@ -89164,14 +89164,17 @@ function collectFingerprintActionInput() {
githubToken: (0, core_1.getInput)('github-token'),
workingDirectory: (0, core_1.getInput)('working-directory'),
fingerprintVersion: (0, core_1.getInput)('fingerprint-version') || 'latest',
- fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') || (0, core_1.getBooleanInput)('fingerprint-installation-cache'),
+ fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') ||
+ (0, core_1.getBooleanInput)('fingerprint-installation-cache'),
fingerprintDbCacheKey: (0, core_1.getInput)('fingerprint-db-cache-key'),
previousGitCommitHash: (0, core_1.getInput)('previous-git-commit') ||
(github_1.context.eventName === 'pull_request'
? github_1.context.payload.pull_request?.base?.sha
: github_1.context.payload.before),
currentGitCommitHash: (0, core_1.getInput)('current-git-commit') ||
- (github_1.context.eventName === 'pull_request' ? github_1.context.payload.pull_request?.head?.sha : github_1.context.sha),
+ (github_1.context.eventName === 'pull_request'
+ ? github_1.context.payload.pull_request?.head?.sha
+ : github_1.context.sha),
savingDbBranch: (0, core_1.getInput)('saving-db-branch') || undefined,
};
}
@@ -89419,7 +89422,9 @@ const worker_1 = __nccwpck_require__(8912);
async function resolvePackage(name, range) {
let stdout = '';
try {
- ({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], { silent: true }));
+ ({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], {
+ silent: true,
+ }));
}
catch (error) {
throw new Error(`Could not resolve ${name}@${range}`, { cause: error });
diff --git a/build/fingerprint/index.js b/build/fingerprint/index.js
index 9f64229a..52b07d8c 100644
--- a/build/fingerprint/index.js
+++ b/build/fingerprint/index.js
@@ -89125,14 +89125,17 @@ function collectFingerprintActionInput() {
githubToken: (0, core_1.getInput)('github-token'),
workingDirectory: (0, core_1.getInput)('working-directory'),
fingerprintVersion: (0, core_1.getInput)('fingerprint-version') || 'latest',
- fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') || (0, core_1.getBooleanInput)('fingerprint-installation-cache'),
+ fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') ||
+ (0, core_1.getBooleanInput)('fingerprint-installation-cache'),
fingerprintDbCacheKey: (0, core_1.getInput)('fingerprint-db-cache-key'),
previousGitCommitHash: (0, core_1.getInput)('previous-git-commit') ||
(github_1.context.eventName === 'pull_request'
? github_1.context.payload.pull_request?.base?.sha
: github_1.context.payload.before),
currentGitCommitHash: (0, core_1.getInput)('current-git-commit') ||
- (github_1.context.eventName === 'pull_request' ? github_1.context.payload.pull_request?.head?.sha : github_1.context.sha),
+ (github_1.context.eventName === 'pull_request'
+ ? github_1.context.payload.pull_request?.head?.sha
+ : github_1.context.sha),
savingDbBranch: (0, core_1.getInput)('saving-db-branch') || undefined,
};
}
@@ -89380,7 +89383,9 @@ const worker_1 = __nccwpck_require__(8912);
async function resolvePackage(name, range) {
let stdout = '';
try {
- ({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], { silent: true }));
+ ({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], {
+ silent: true,
+ }));
}
catch (error) {
throw new Error(`Could not resolve ${name}@${range}`, { cause: error });
diff --git a/build/preview-build/index.js b/build/preview-build/index.js
index 240ffcd3..e7a9d523 100644
--- a/build/preview-build/index.js
+++ b/build/preview-build/index.js
@@ -89498,7 +89498,8 @@ function projectAppType(dir) {
catch (error) {
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
}
- if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
+ if (packageJson?.dependencies?.['expo-dev-client'] ||
+ packageJson?.devDependencies?.['expo-dev-client']) {
return 'dev-build';
}
return 'expo-go';
@@ -89771,14 +89772,17 @@ function collectFingerprintActionInput() {
githubToken: (0, core_1.getInput)('github-token'),
workingDirectory: (0, core_1.getInput)('working-directory'),
fingerprintVersion: (0, core_1.getInput)('fingerprint-version') || 'latest',
- fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') || (0, core_1.getBooleanInput)('fingerprint-installation-cache'),
+ fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') ||
+ (0, core_1.getBooleanInput)('fingerprint-installation-cache'),
fingerprintDbCacheKey: (0, core_1.getInput)('fingerprint-db-cache-key'),
previousGitCommitHash: (0, core_1.getInput)('previous-git-commit') ||
(github_1.context.eventName === 'pull_request'
? github_1.context.payload.pull_request?.base?.sha
: github_1.context.payload.before),
currentGitCommitHash: (0, core_1.getInput)('current-git-commit') ||
- (github_1.context.eventName === 'pull_request' ? github_1.context.payload.pull_request?.head?.sha : github_1.context.sha),
+ (github_1.context.eventName === 'pull_request'
+ ? github_1.context.payload.pull_request?.head?.sha
+ : github_1.context.sha),
savingDbBranch: (0, core_1.getInput)('saving-db-branch') || undefined,
};
}
@@ -90026,7 +90030,9 @@ const worker_1 = __nccwpck_require__(8912);
async function resolvePackage(name, range) {
let stdout = '';
try {
- ({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], { silent: true }));
+ ({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], {
+ silent: true,
+ }));
}
catch (error) {
throw new Error(`Could not resolve ${name}@${range}`, { cause: error });
diff --git a/build/preview-comment/index.js b/build/preview-comment/index.js
index 7aa61d10..12ddeca2 100644
--- a/build/preview-comment/index.js
+++ b/build/preview-comment/index.js
@@ -38842,7 +38842,8 @@ function projectAppType(dir) {
catch (error) {
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
}
- if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
+ if (packageJson?.dependencies?.['expo-dev-client'] ||
+ packageJson?.devDependencies?.['expo-dev-client']) {
return 'dev-build';
}
return 'expo-go';
diff --git a/build/preview/index.js b/build/preview/index.js
index 810f45f1..1c8dbe05 100644
--- a/build/preview/index.js
+++ b/build/preview/index.js
@@ -41961,7 +41961,9 @@ function getVariables(config, updates, options) {
androidManifestPermalink: android?.manifestPermalink || '',
androidMessage: android?.message || '',
androidRuntimeVersion: android?.runtimeVersion || '',
- androidQR: android ? (0, eas_1.getUpdateGroupQr)({ projectId, updateGroupId: android.group, appSlug, qrTarget }) : '',
+ androidQR: android
+ ? (0, eas_1.getUpdateGroupQr)({ projectId, updateGroupId: android.group, appSlug, qrTarget })
+ : '',
androidLink: android ? (0, eas_1.getUpdateGroupWebsite)({ projectId, updateGroupId: android.group }) : '',
// iOS update
iosId: ios?.id || '',
@@ -41994,7 +41996,9 @@ function createSummaryHeader(updates, vars) {
.sort((a, b) => a.localeCompare(b))
.map(platform => `**${platform}**`)
.join(', ');
- const appSchemes = vars.projectScheme ? `- Scheme → **${JSON.parse(vars.projectSchemes).join('**, **')}**` : '';
+ const appSchemes = vars.projectScheme
+ ? `- Scheme → **${JSON.parse(vars.projectSchemes).join('**, **')}**`
+ : '';
return `🚀 Expo preview is ready!
- Project → **${vars.projectSlug}**
@@ -42117,7 +42121,7 @@ async function assertEasVersion(versionRange) {
throw new Error(`Could not verify the EAS CLI version, reason:\nCommand failed 'eas --version'`);
}
const version = stdout.match(/eas-cli\/([^\s]+)/i);
- if (!version || !version[1]) {
+ if (!version?.[1]) {
throw new Error(`Could not verify the EAS CLI version, reason:\nUnexpected output received.`);
}
if (!semver_1.default.satisfies(version[1], versionRange)) {
@@ -42375,7 +42379,8 @@ function projectAppType(dir) {
catch (error) {
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
}
- if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
+ if (packageJson?.dependencies?.['expo-dev-client'] ||
+ packageJson?.devDependencies?.['expo-dev-client']) {
return 'dev-build';
}
return 'expo-go';
diff --git a/build/setup/index.js b/build/setup/index.js
index f3cd921f..e9cc4af5 100644
--- a/build/setup/index.js
+++ b/build/setup/index.js
@@ -89119,7 +89119,8 @@ function projectAppType(dir) {
catch (error) {
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
}
- if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
+ if (packageJson?.dependencies?.['expo-dev-client'] ||
+ packageJson?.devDependencies?.['expo-dev-client']) {
return 'dev-build';
}
return 'expo-go';
@@ -89362,7 +89363,9 @@ const worker_1 = __nccwpck_require__(8912);
async function resolvePackage(name, range) {
let stdout = '';
try {
- ({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], { silent: true }));
+ ({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], {
+ silent: true,
+ }));
}
catch (error) {
throw new Error(`Could not resolve ${name}@${range}`, { cause: error });
diff --git a/bun.lockb b/bun.lockb
index 71221f0c..5941da45 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/ncc.js b/ncc.js
index f9acb926..31192e1e 100644
--- a/ncc.js
+++ b/ncc.js
@@ -27,7 +27,10 @@ async function prebuild() {
await fs.promises.rm(buildDir, { force: true, recursive: true });
await fs.promises.rm(modulesDir, { force: true, recursive: true });
- await spawn('bun', ['install', '--frozen-lockfile'], { stdio: 'inherit', env: { ...process.env, CI: true } });
+ await spawn('bun', ['install', '--frozen-lockfile'], {
+ stdio: 'inherit',
+ env: { ...process.env, CI: true },
+ });
console.log();
}
diff --git a/package.json b/package.json
index 3e0687c4..0bfa09f7 100644
--- a/package.json
+++ b/package.json
@@ -40,11 +40,12 @@
"@tsconfig/node20": "^20.1.2",
"@types/jest": "^29.2.5",
"@types/node": "^16.18.11",
+ "@types/semver": "^7.5.8",
"@types/uuid": "^9.0.3",
"@vercel/ncc": "^0.36.0",
"conventional-changelog-conventionalcommits": "^5.0.0",
"eslint": "^8.54.0",
- "eslint-config-universe": "^12.0.0",
+ "eslint-config-universe": "^13.0.0",
"getenv": "^1.0.0",
"jest": "^29.3.1",
"jest-snapshot-prettier": "npm:prettier@^2.8.8",
@@ -57,15 +58,8 @@
"trustedDependencies": [
"sqlite3"
],
- "eslintConfig": {
- "extends": "universe/node",
- "ignorePatterns": [
- "build/**",
- "node_modules/**"
- ]
- },
"prettier": {
- "printWidth": 120,
+ "printWidth": 100,
"tabWidth": 2,
"singleQuote": true,
"bracketSameLine": true,
diff --git a/src/actions/command.ts b/src/actions/command.ts
index f30b9c9c..cdb15207 100644
--- a/src/actions/command.ts
+++ b/src/actions/command.ts
@@ -1,16 +1,16 @@
import { getInput, info, setFailed } from '@actions/core';
import {
+ BuildInfo,
appPlatformDisplayNames,
appPlatformEmojis,
- BuildInfo,
easBuild,
getBuildLogsUrl,
parseCommand,
projectInfo,
projectOwner,
} from '../expo';
-import { createIssueComment, createReaction, issueComment, Reaction } from '../github';
+import { Reaction, createIssueComment, createReaction, issueComment } from '../github';
import { template } from '../utils';
import { executeAction } from '../worker';
diff --git a/src/actions/continuous-deploy-fingerprint.ts b/src/actions/continuous-deploy-fingerprint.ts
index 35b70a04..157a4888 100644
--- a/src/actions/continuous-deploy-fingerprint.ts
+++ b/src/actions/continuous-deploy-fingerprint.ts
@@ -23,7 +23,9 @@ export function collectContinuousDeployFingerprintInput() {
executeAction(continuousDeployFingerprintAction);
-export async function continuousDeployFingerprintAction(input = collectContinuousDeployFingerprintInput()) {
+export async function continuousDeployFingerprintAction(
+ input = collectContinuousDeployFingerprintInput()
+) {
const isInPullRequest = hasPullContext();
const config = await loadProjectConfig(input.workingDirectory);
@@ -36,7 +38,10 @@ export async function continuousDeployFingerprintAction(input = collectContinuou
cwd: input.workingDirectory,
platform: 'android',
});
- const iosFingerprintHash = await getFingerprintHashForPlatformAsync({ cwd: input.workingDirectory, platform: 'ios' });
+ const iosFingerprintHash = await getFingerprintHashForPlatformAsync({
+ cwd: input.workingDirectory,
+ platform: 'ios',
+ });
info(`Android fingerprint: ${androidFingerprintHash}`);
info(`iOS fingerprint: ${iosFingerprintHash}`);
@@ -201,9 +206,12 @@ async function getBuildInfoWithFingerprintAsync({
tomorrow.setDate(tomorrow.getDate() + 1);
const buildsThatAreValid = (builds as BuildInfo[]).filter(build => {
- const isValidStatus = [BuildStatus.New, BuildStatus.InQueue, BuildStatus.InProgress, BuildStatus.Finished].includes(
- build.status
- );
+ const isValidStatus = [
+ BuildStatus.New,
+ BuildStatus.InQueue,
+ BuildStatus.InProgress,
+ BuildStatus.Finished,
+ ].includes(build.status);
// if the build is expired or will expire within the next day,
const isValidExpiry = excludeExpiredBuilds ? new Date(build.expirationDate) < tomorrow : true;
return isValidStatus && isValidExpiry;
@@ -226,7 +234,17 @@ async function createEASBuildAsync({
const extraArgs = isDebug() ? ['--build-logger-level', 'debug'] : [];
const execOutput = await getExecOutput(
await which('eas', true),
- ['build', '--profile', profile, '--platform', platform, '--non-interactive', '--json', '--no-wait', ...extraArgs],
+ [
+ 'build',
+ '--profile',
+ profile,
+ '--platform',
+ platform,
+ '--non-interactive',
+ '--json',
+ '--no-wait',
+ ...extraArgs,
+ ],
{
cwd,
silent: !isDebug(),
@@ -240,7 +258,13 @@ async function createEASBuildAsync({
return JSON.parse(stdout)[0];
}
-async function publishEASUpdatesAsync({ cwd, branch }: { cwd: string; branch: string }): Promise {
+async function publishEASUpdatesAsync({
+ cwd,
+ branch,
+}: {
+ cwd: string;
+ branch: string;
+}): Promise {
let stdout: string;
try {
const execOutput = await getExecOutput(
@@ -284,7 +308,9 @@ function createSummaryForUpdatesAndBuilds({
const getBuildLink = (build: BuildInfo | undefined) =>
build ? `[Build Permalink](${getBuildLogsUrl(build)})` : 'n/a';
const getUpdateLink = (update: EasUpdate | undefined) =>
- update ? `[Update Permalink](${getUpdateGroupWebsite({ projectId, updateGroupId: update.group })})` : 'n/a';
+ update
+ ? `[Update Permalink](${getUpdateGroupWebsite({ projectId, updateGroupId: update.group })})`
+ : 'n/a';
const getUpdateQRURL = (update: EasUpdate | undefined) =>
update ? getUpdateGroupQr({ projectId, updateGroupId: update.group, appSlug, qrTarget }) : null;
const getBuildDetails = (buildRunInfo: BuildRunInfo) =>
@@ -323,7 +349,9 @@ function createSummaryForUpdatesAndBuilds({
? ``
: null;
- const iosQr = iosQRURL ? `` : null;
+ const iosQr = iosQRURL
+ ? ``
+ : null;
const platformName = `Platform${updates.length === 1 ? '' : 's'}`;
const platformValue = updates
@@ -340,7 +368,9 @@ function createSummaryForUpdatesAndBuilds({
- ${platformName} → ${platformValue}
${schemesMessage}
- | ${appPlatformEmojis[AppPlatform.Android]} Android | ${appPlatformEmojis[AppPlatform.Ios]} iOS
+ | ${appPlatformEmojis[AppPlatform.Android]} Android | ${
+ appPlatformEmojis[AppPlatform.Ios]
+ } iOS
--- | --- | ---
Fingerprint | ${androidBuildRunInfo.buildInfo.runtimeVersion ?? 'n/a'} | ${
iosBuildRunInfo.buildInfo.runtimeVersion ?? 'n/a'
diff --git a/src/actions/fingerprint.ts b/src/actions/fingerprint.ts
index b5a90552..f97cf5d9 100644
--- a/src/actions/fingerprint.ts
+++ b/src/actions/fingerprint.ts
@@ -1,17 +1,23 @@
import { setOutput } from '@actions/core';
import {
- createFingerprintOutputAsync,
collectFingerprintActionInput,
createFingerprintDbManagerAsync,
+ createFingerprintOutputAsync,
} from '../fingerprint';
import { executeAction } from '../worker';
executeAction(runAction);
export async function runAction(input = collectFingerprintActionInput()) {
- const dbManager = await createFingerprintDbManagerAsync(input.packager, input.fingerprintDbCacheKey);
- const { currentFingerprint, previousFingerprint, diff } = await createFingerprintOutputAsync(dbManager, input);
+ const dbManager = await createFingerprintDbManagerAsync(
+ input.packager,
+ input.fingerprintDbCacheKey
+ );
+ const { currentFingerprint, previousFingerprint, diff } = await createFingerprintOutputAsync(
+ dbManager,
+ input
+ );
await dbManager.upsertFingerprintByGitCommitHashAsync(input.currentGitCommitHash, {
fingerprint: currentFingerprint,
});
diff --git a/src/actions/preview-build.ts b/src/actions/preview-build.ts
index e5c5728a..008546c5 100644
--- a/src/actions/preview-build.ts
+++ b/src/actions/preview-build.ts
@@ -1,4 +1,4 @@
-import { getBooleanInput, getInput, setOutput, group, setFailed, info } from '@actions/core';
+import { getBooleanInput, getInput, group, info, setFailed, setOutput } from '@actions/core';
import { context } from '@actions/github';
import type { ExpoConfig } from '@expo/config';
import type { Fingerprint, FingerprintSource } from '@expo/fingerprint';
@@ -8,11 +8,11 @@ import { validate as isValidUUID } from 'uuid';
import { deleteCacheAsync } from '../cacher';
import { createDetails } from '../comment';
import {
- createEasBuildFromRawCommandAsync,
BuildInfo,
- getBuildLogsUrl,
appPlatformEmojis,
cancelEasBuildAsync,
+ createEasBuildFromRawCommandAsync,
+ getBuildLogsUrl,
queryEasBuildInfoAsync,
} from '../expo';
import {
@@ -63,7 +63,10 @@ export async function previewAction(input = collectPreviewBuildActionInput()) {
return;
}
- const dbManager = await createFingerprintDbManagerAsync(input.packager, input.fingerprintDbCacheKey);
+ 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.');
@@ -78,7 +81,9 @@ export async function previewAction(input = collectPreviewBuildActionInput()) {
await maybeCancelPreviousBuildsAsync(config, input);
const variables = getVariables(config, []);
const messageId = template(input.commentId, variables);
- const latestEasEntity = await dbManager.getLatestEasEntityFromFingerprintAsync(currentFingerprint.hash);
+ const latestEasEntity = await dbManager.getLatestEasEntityFromFingerprintAsync(
+ currentFingerprint.hash
+ );
const latestEasBuildInfo = latestEasEntity?.easBuildId
? await queryEasBuildInfoAsync(input.workingDirectory, latestEasEntity.easBuildId)
: null;
@@ -175,7 +180,11 @@ async function maybeCreateCommentAsync(
}
}
-function setOutputs(variables: ReturnType, messageId: string, messageBody: string) {
+function setOutputs(
+ variables: ReturnType,
+ messageId: string,
+ messageBody: string
+) {
for (const [name, value] of Object.entries(variables)) {
setOutput(name, value);
}
@@ -333,7 +342,10 @@ async function maybeUpdateFingerprintDbAsync(params: {
//#region Non pull request context
-async function handleNonPullRequest(config: ExpoConfig, input: ReturnType) {
+async function handleNonPullRequest(
+ config: ExpoConfig,
+ input: ReturnType
+) {
info('Non pull request context, skipping comment.');
const targetBranch = input.savingDbBranch ?? getRepoDefaultBranch();
assert(targetBranch);
@@ -342,14 +354,19 @@ async function handleNonPullRequest(config: ExpoConfig, input: ReturnType queryEasBuildIdsFromPrAsync(pr.prNumber, config, input)))
+ await Promise.all(
+ associatedPRs.map(pr => queryEasBuildIdsFromPrAsync(pr.prNumber, config, input))
+ )
).flat();
let manyBuilds: { easBuildId?: string; fingerprint: Fingerprint }[];
@@ -361,7 +378,9 @@ async function handleNonPullRequest(config: ExpoConfig, input: ReturnType createUpdate(input.workingDirectory, command));
+ const updates = await group(`Run eas ${command}"`, () =>
+ createUpdate(input.workingDirectory, command)
+ );
const update = updates.find(update => !!update);
if (!update) {
@@ -103,7 +111,11 @@ function sanitizeCommand(input: string): string {
/**
* Generate useful variables for the message body, and as step outputs.
*/
-export function getVariables(config: ExpoConfig, updates: EasUpdate[], options: ReturnType) {
+export function getVariables(
+ config: ExpoConfig,
+ updates: EasUpdate[],
+ options: ReturnType
+) {
const projectId: string = config.extra?.eas?.projectId;
const android = updates.find(update => update.platform === 'android');
const ios = updates.find(update => update.platform === 'ios');
@@ -137,7 +149,9 @@ export function getVariables(config: ExpoConfig, updates: EasUpdate[], options:
androidManifestPermalink: android?.manifestPermalink || '',
androidMessage: android?.message || '',
androidRuntimeVersion: android?.runtimeVersion || '',
- androidQR: android ? getUpdateGroupQr({ projectId, updateGroupId: android.group, appSlug, qrTarget }) : '',
+ androidQR: android
+ ? getUpdateGroupQr({ projectId, updateGroupId: android.group, appSlug, qrTarget })
+ : '',
androidLink: android ? getUpdateGroupWebsite({ projectId, updateGroupId: android.group }) : '',
// iOS update
iosId: ios?.id || '',
@@ -172,7 +186,9 @@ function createSummaryHeader(updates: EasUpdate[], vars: ReturnType `**${platform}**`)
.join(', ');
- const appSchemes = vars.projectScheme ? `- Scheme → **${JSON.parse(vars.projectSchemes).join('**, **')}**` : '';
+ const appSchemes = vars.projectScheme
+ ? `- Scheme → **${JSON.parse(vars.projectSchemes).join('**, **')}**`
+ : '';
return `🚀 Expo preview is ready!
diff --git a/src/cacher.ts b/src/cacher.ts
index cac7dc1b..45d11426 100644
--- a/src/cacher.ts
+++ b/src/cacher.ts
@@ -1,4 +1,4 @@
-import { saveCache, restoreCache, ReserveCacheError, isFeatureAvailable } from '@actions/cache';
+import { ReserveCacheError, isFeatureAvailable, restoreCache, saveCache } from '@actions/cache';
import { warning } from '@actions/core';
import { context } from '@actions/github';
import os from 'os';
@@ -24,7 +24,10 @@ export function cacheKey(name: string, version: string, manager: string): string
/**
* Restore a directory from the remote cache.
*/
-export async function restoreCacheAsync(cachePath: string, cacheKey: string): Promise {
+export async function restoreCacheAsync(
+ cachePath: string,
+ cacheKey: string
+): Promise {
if (!cacheIsAvailable()) {
warning(`Skipped restoring from remote cache, not available.`);
return null;
@@ -60,7 +63,11 @@ export async function saveCacheAsync(cachePath: string, cacheKey: string): Promi
* 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 {
+export async function deleteCacheAsync(
+ githubToken: string,
+ cacheKey: string,
+ ref: string
+): Promise {
const github = githubApi({ token: githubToken });
await github.rest.actions.deleteActionsCacheByKey({
...context.repo,
diff --git a/src/comment.ts b/src/comment.ts
index 9e966b80..cbd5bd00 100644
--- a/src/comment.ts
+++ b/src/comment.ts
@@ -3,7 +3,10 @@ import { ExpoConfig } from '@expo/config';
import { projectAppType } from './expo';
-export function getQrTarget(input: { qrTarget?: 'expo-go' | 'dev-build' | 'dev-client'; workingDirectory: string }) {
+export function getQrTarget(input: {
+ qrTarget?: 'expo-go' | 'dev-build' | 'dev-client';
+ workingDirectory: string;
+}) {
if (!input.qrTarget) {
const appType = projectAppType(input.workingDirectory);
debug(`Using inferred QR code target: "${appType}"`);
@@ -22,7 +25,9 @@ export function getQrTarget(input: { qrTarget?: 'expo-go' | 'dev-build' | 'dev-c
return 'expo-go';
default:
- throw new Error(`Invalid QR code target: "${input.qrTarget}", expected "expo-go" or "dev-build"`);
+ throw new Error(
+ `Invalid QR code target: "${input.qrTarget}", expected "expo-go" or "dev-build"`
+ );
}
}
diff --git a/src/eas.ts b/src/eas.ts
index 9edae149..a0cfadb4 100644
--- a/src/eas.ts
+++ b/src/eas.ts
@@ -32,11 +32,13 @@ export async function assertEasVersion(versionRange: string) {
try {
({ stdout } = await getExecOutput(await which('eas', true), ['--version']));
} catch {
- throw new Error(`Could not verify the EAS CLI version, reason:\nCommand failed 'eas --version'`);
+ throw new Error(
+ `Could not verify the EAS CLI version, reason:\nCommand failed 'eas --version'`
+ );
}
const version = stdout.match(/eas-cli\/([^\s]+)/i);
- if (!version || !version[1]) {
+ if (!version?.[1]) {
throw new Error(`Could not verify the EAS CLI version, reason:\nUnexpected output received.`);
}
diff --git a/src/expo.ts b/src/expo.ts
index d8405bda..c9b365b4 100644
--- a/src/expo.ts
+++ b/src/expo.ts
@@ -1,4 +1,4 @@
-import { info, exportVariable } from '@actions/core';
+import { exportVariable, info } from '@actions/core';
import { exec, getExecOutput } from '@actions/exec';
import { which } from '@actions/io';
import { ok as assert } from 'assert';
@@ -128,9 +128,13 @@ export async function runCommand(cmd: Command) {
let stderr = '';
try {
- ({ stderr, stdout } = await getExecOutput(await which(cmd.cli), cmd.args.concat('--non-interactive'), {
- silent: false,
- }));
+ ({ stderr, stdout } = await getExecOutput(
+ await which(cmd.cli),
+ cmd.args.concat('--non-interactive'),
+ {
+ silent: false,
+ }
+ ));
} catch (error: unknown) {
throw new Error(`Could not run command ${cmd.args.join(' ')}`, { cause: error });
}
@@ -199,12 +203,19 @@ export async function cancelEasBuildAsync(cwd: string, buildId: string): Promise
/**
* Query the EAS BuildInfo from given buildId.
*/
-export async function queryEasBuildInfoAsync(cwd: string, buildId: string): Promise {
+export async function queryEasBuildInfoAsync(
+ cwd: string,
+ buildId: string
+): Promise {
try {
- const { stdout } = await getExecOutput(await which('eas', true), ['build:view', buildId, '--json'], {
- cwd,
- silent: true,
- });
+ const { stdout } = await getExecOutput(
+ await which('eas', true),
+ ['build:view', buildId, '--json'],
+ {
+ cwd,
+ silent: true,
+ }
+ );
return JSON.parse(stdout);
} catch (error: unknown) {
info(`Failed to query eas build ${buildId}: ${String(error)}`);
@@ -219,10 +230,14 @@ export async function projectInfo(dir: string): Promise {
let stdout = '';
try {
- ({ stdout } = await getExecOutput(await which('expo', true), ['config', '--json', '--type', 'prebuild'], {
- cwd: dir,
- silent: true,
- }));
+ ({ stdout } = await getExecOutput(
+ await which('expo', true),
+ ['config', '--json', '--type', 'prebuild'],
+ {
+ cwd: dir,
+ silent: true,
+ }
+ ));
} catch (error: unknown) {
throw new Error(`Could not fetch the project info from ${dir}`, { cause: error });
}
@@ -247,7 +262,10 @@ export function projectAppType(dir: string): 'expo-go' | 'dev-build' {
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
}
- if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
+ if (
+ packageJson?.dependencies?.['expo-dev-client'] ||
+ packageJson?.devDependencies?.['expo-dev-client']
+ ) {
return 'dev-build';
}
diff --git a/src/fingerprint/FingerprintDbManager.ts b/src/fingerprint/FingerprintDbManager.ts
index 347a509e..09c412e1 100644
--- a/src/fingerprint/FingerprintDbManager.ts
+++ b/src/fingerprint/FingerprintDbManager.ts
@@ -1,6 +1,6 @@
-import type { Fingerprint as FingerprintType, FingerprintSource } from '@expo/fingerprint';
+import type { FingerprintSource, Fingerprint as FingerprintType } from '@expo/fingerprint';
-import { openDatabaseAsync, Database } from '../sqlite';
+import { Database, openDatabaseAsync } from '../sqlite';
export type FingerprintDbEntity = Camelize & {
fingerprint: FingerprintType;
@@ -12,7 +12,9 @@ export class FingerprintDbManager {
public async initAsync(): Promise {
const db = await openDatabaseAsync(this.dbPath);
await db.runAsync(
- `CREATE TABLE IF NOT EXISTS ${FingerprintDbManager.TABLE_NAME} (${FingerprintDbManager.SCHEMA.join(', ')})`
+ `CREATE TABLE IF NOT EXISTS ${
+ FingerprintDbManager.TABLE_NAME
+ } (${FingerprintDbManager.SCHEMA.join(', ')})`
);
for (const index of FingerprintDbManager.INDEXES) {
await db.runAsync(index);
@@ -64,7 +66,9 @@ export class FingerprintDbManager {
/**
* Get the latest entity from the fingerprint hash where the eas_build_id is not null.
*/
- public async getLatestEasEntityFromFingerprintAsync(fingerprintHash: string): Promise {
+ public async getLatestEasEntityFromFingerprintAsync(
+ fingerprintHash: string
+ ): Promise {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
@@ -77,7 +81,9 @@ export class FingerprintDbManager {
return row ? FingerprintDbManager.serialize(row) : null;
}
- public async getEntityFromGitCommitHashAsync(gitCommitHash: string): Promise {
+ public async getEntityFromGitCommitHashAsync(
+ gitCommitHash: string
+ ): Promise {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
@@ -88,7 +94,9 @@ export class FingerprintDbManager {
return row ? FingerprintDbManager.serialize(row) : null;
}
- public async getFirstEntityFromFingerprintHashAsync(fingerprintHash: string): Promise {
+ public async getFirstEntityFromFingerprintHashAsync(
+ fingerprintHash: string
+ ): Promise {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
@@ -99,7 +107,9 @@ export class FingerprintDbManager {
return row ? FingerprintDbManager.serialize(row) : null;
}
- public async queryEntitiesFromFingerprintHashAsync(fingerprintHash: string): Promise {
+ public async queryEntitiesFromFingerprintHashAsync(
+ fingerprintHash: string
+ ): Promise {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
@@ -110,7 +120,9 @@ export class FingerprintDbManager {
return rows.map(row => FingerprintDbManager.serialize(row));
}
- public async getFingerprintSourcesAsync(fingerprintHash: string): Promise {
+ public async getFingerprintSourcesAsync(
+ fingerprintHash: string
+ ): Promise {
if (!this.db) {
throw new Error('Database not initialized. Call initAsync() first.');
}
diff --git a/src/fingerprint/index.ts b/src/fingerprint/index.ts
index b5767d77..98e3396b 100644
--- a/src/fingerprint/index.ts
+++ b/src/fingerprint/index.ts
@@ -27,13 +27,19 @@ export async function createFingerprintOutputAsync(
dbManager: FingerprintDbManager,
input: ReturnType
): Promise {
- await installFingerprintAsync(input.fingerprintVersion, input.packager, input.fingerprintInstallationCache);
+ 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);
+ previousFingerprint = await dbManager.getEntityFromGitCommitHashAsync(
+ input.previousGitCommitHash
+ );
}
const diff =
@@ -61,7 +67,9 @@ export async function createFingerprintDbManagerAsync(
if (cacheHit) {
info(`Restored fingerprint database from cache - cacheKey[${cacheKey}]`);
} else {
- info(`Missing fingerprint database from cache - will create a new database - cacheKey[${cacheKey}]`);
+ info(
+ `Missing fingerprint database from cache - will create a new database - cacheKey[${cacheKey}]`
+ );
}
const dbManager = new FingerprintDbManager(dbPath);
await dbManager.initAsync();
@@ -78,7 +86,8 @@ export function collectFingerprintActionInput() {
workingDirectory: getInput('working-directory'),
fingerprintVersion: getInput('fingerprint-version') || 'latest',
fingerprintInstallationCache:
- !getInput('fingerprint-installation-cache') || getBooleanInput('fingerprint-installation-cache'),
+ !getInput('fingerprint-installation-cache') ||
+ getBooleanInput('fingerprint-installation-cache'),
fingerprintDbCacheKey: getInput('fingerprint-db-cache-key'),
previousGitCommitHash:
getInput('previous-git-commit') ||
@@ -87,7 +96,9 @@ export function collectFingerprintActionInput() {
: githubContext.payload.before),
currentGitCommitHash:
getInput('current-git-commit') ||
- (githubContext.eventName === 'pull_request' ? githubContext.payload.pull_request?.head?.sha : githubContext.sha),
+ (githubContext.eventName === 'pull_request'
+ ? githubContext.payload.pull_request?.head?.sha
+ : githubContext.sha),
savingDbBranch: getInput('saving-db-branch') || undefined,
};
}
@@ -145,8 +156,15 @@ export async function saveDbToCacheAsync(cacheKey: string) {
* Get the path to the fingerprint database
*/
async function getDbPathAsync(): Promise {
- 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');
+ 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);
diff --git a/src/github.ts b/src/github.ts
index 321db33f..c06ef0ca 100644
--- a/src/github.ts
+++ b/src/github.ts
@@ -1,4 +1,4 @@
-import { getOctokit, context } from '@actions/github';
+import { context, getOctokit } from '@actions/github';
import { ok as assert } from 'assert';
type IssueContext = (typeof context)['issue'];
@@ -77,7 +77,10 @@ export async function createIssueComment(options: AuthContext & IssueContext & C
*/
export function githubApi(options: AuthContext = {}): ReturnType {
const token = process.env['GITHUB_TOKEN'] || options.token;
- assert(token, `This step requires 'github-token' or a GITHUB_TOKEN environment variable to create comments`);
+ assert(
+ token,
+ `This step requires 'github-token' or a GITHUB_TOKEN environment variable to create comments`
+ );
return getOctokit(token);
}
@@ -145,7 +148,10 @@ export function issueComment() {
/**
* Get the commit message for a specific commit hash.
*/
-export async function getGitCommandMessageAsync(options: AuthContext, gitCommitHash: string): Promise {
+export async function getGitCommandMessageAsync(
+ options: AuthContext,
+ gitCommitHash: string
+): Promise {
const github = githubApi({ token: options.token });
const result = await github.rest.git.getCommit({
...context.repo,
@@ -173,7 +179,10 @@ export function isPushBranchContext(targetBranch: string) {
/**
* Get the pull request information that associated with a specific commit hash.
*/
-export async function getPullRequestFromGitCommitShaAsync(options: AuthContext, gitCommitHash: string) {
+export async function getPullRequestFromGitCommitShaAsync(
+ options: AuthContext,
+ gitCommitHash: string
+) {
const github = githubApi({ token: options.token });
const results = await github.rest.repos.listPullRequestsAssociatedWithCommit({
...context.repo,
diff --git a/src/packager.ts b/src/packager.ts
index 737426e0..623c9713 100644
--- a/src/packager.ts
+++ b/src/packager.ts
@@ -12,7 +12,9 @@ export async function resolvePackage(name: string, range: string): Promise {
await exec('sudo sysctl -p');
info('Patched system watchers for the `ENOSPC` error.');
} catch (error) {
- warning(`Looks like we can't patch watchers/inotify limits, you might encouter the 'ENOSPC' error.`);
- warning('For more info: https://github.com/expo/expo-github-action/issues/20, encountered error:');
+ warning(
+ `Looks like we can't patch watchers/inotify limits, you might encouter the 'ENOSPC' error.`
+ );
+ warning(
+ 'For more info: https://github.com/expo/expo-github-action/issues/20, encountered error:'
+ );
warning(String(error));
}
}
@@ -69,7 +73,10 @@ export function tempPath(name: string, version: string): string {
* @see https://github.com/actions/toolkit/blob/daf8bb00606d37ee2431d9b1596b88513dcf9c59/packages/tool-cache/src/tool-cache.ts#L747-L749
*/
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');
+ 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());
}
diff --git a/tests/actions/preview-comment.test.ts b/tests/actions/preview-comment.test.ts
index 808209c1..8cd89a63 100644
--- a/tests/actions/preview-comment.test.ts
+++ b/tests/actions/preview-comment.test.ts
@@ -1,6 +1,11 @@
import * as core from '@actions/core';
-import { commentInput, commentAction, DEFAULT_ID, DEFAULT_MESSAGE } from '../../src/actions/preview-comment';
+import {
+ DEFAULT_ID,
+ DEFAULT_MESSAGE,
+ commentAction,
+ commentInput,
+} from '../../src/actions/preview-comment';
import * as expo from '../../src/expo';
import * as github from '../../src/github';
import { mockInput } from '../utils';
@@ -76,7 +81,9 @@ describe(commentAction, () => {
});
it('resolves project owner info by manifest owner', async () => {
- jest.mocked(expo.projectInfo).mockResolvedValue({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' });
+ jest
+ .mocked(expo.projectInfo)
+ .mockResolvedValue({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' });
await commentAction({ ...input });
expect(core.setOutput).toBeCalledWith('projectOwner', 'fakeowner');
expect(expo.projectOwner).not.toBeCalled();
@@ -122,9 +129,14 @@ describe(commentAction, () => {
});
it('sets projectQR', async () => {
- jest.mocked(expo.projectQR).mockReturnValue('https://qr.expo.dev/expo-go?owner=fakeuser&slug=fakeslug');
+ jest
+ .mocked(expo.projectQR)
+ .mockReturnValue('https://qr.expo.dev/expo-go?owner=fakeuser&slug=fakeslug');
await commentAction({ ...input });
- expect(core.setOutput).toBeCalledWith('projectQR', 'https://qr.expo.dev/expo-go?owner=fakeuser&slug=fakeslug');
+ expect(core.setOutput).toBeCalledWith(
+ 'projectQR',
+ 'https://qr.expo.dev/expo-go?owner=fakeuser&slug=fakeslug'
+ );
});
it('sets message', async () => {
diff --git a/tests/actions/preview.test.ts b/tests/actions/preview.test.ts
index 28e5c86c..4911b9ac 100644
--- a/tests/actions/preview.test.ts
+++ b/tests/actions/preview.test.ts
@@ -41,13 +41,20 @@ const fakeUpdatesSingle: EasUpdate[] = [
},
];
-const fakeUpdatesMultiple = fakeUpdatesSingle.map(update => ({ ...update, group: `fake-group-${update.id}` }));
+const fakeUpdatesMultiple = fakeUpdatesSingle.map(update => ({
+ ...update,
+ group: `fake-group-${update.id}`,
+}));
describe(createSummary, () => {
describe('single update group', () => {
it('returns expected message for both platforms', () => {
- expect(createSummary(fakeUpdatesSingle, getVariables(fakeExpoConfig, fakeUpdatesSingle, fakeOptions)))
- .toMatchInlineSnapshot(`
+ expect(
+ createSummary(
+ fakeUpdatesSingle,
+ getVariables(fakeExpoConfig, fakeUpdatesSingle, fakeOptions)
+ )
+ ).toMatchInlineSnapshot(`
"🚀 Expo preview is ready!
- Project → **fake-project**
@@ -63,8 +70,12 @@ describe(createSummary, () => {
it('returns expected message for both platforms with custom app scheme', () => {
const customSchemeConfig = { ...fakeExpoConfig, scheme: ['ega', 'expogithubaction'] };
- expect(createSummary(fakeUpdatesSingle, getVariables(customSchemeConfig, fakeUpdatesSingle, fakeOptions)))
- .toMatchInlineSnapshot(`
+ expect(
+ createSummary(
+ fakeUpdatesSingle,
+ getVariables(customSchemeConfig, fakeUpdatesSingle, fakeOptions)
+ )
+ ).toMatchInlineSnapshot(`
"🚀 Expo preview is ready!
- Project → **fake-project**
@@ -81,7 +92,8 @@ describe(createSummary, () => {
it('returns expected message for android only', () => {
const fakeUpdate = fakeUpdatesSingle.filter(update => update.platform === 'android');
- expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions))).toMatchInlineSnapshot(`
+ expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions)))
+ .toMatchInlineSnapshot(`
"🚀 Expo preview is ready!
- Project → **fake-project**
@@ -97,7 +109,8 @@ describe(createSummary, () => {
it('returns expected message for ios only', () => {
const fakeUpdate = fakeUpdatesSingle.filter(update => update.platform === 'ios');
- expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions))).toMatchInlineSnapshot(`
+ expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions)))
+ .toMatchInlineSnapshot(`
"🚀 Expo preview is ready!
- Project → **fake-project**
@@ -114,8 +127,12 @@ describe(createSummary, () => {
describe('mutliple update groups', () => {
it('returns expected message for both platforms', () => {
- expect(createSummary(fakeUpdatesMultiple, getVariables(fakeExpoConfig, fakeUpdatesMultiple, fakeOptions)))
- .toMatchInlineSnapshot(`
+ expect(
+ createSummary(
+ fakeUpdatesMultiple,
+ getVariables(fakeExpoConfig, fakeUpdatesMultiple, fakeOptions)
+ )
+ ).toMatchInlineSnapshot(`
"🚀 Expo preview is ready!
- Project → **fake-project**
@@ -131,7 +148,8 @@ describe(createSummary, () => {
it('returns expected message for android only', () => {
const fakeUpdate = fakeUpdatesSingle.filter(update => update.platform === 'android');
- expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions))).toMatchInlineSnapshot(`
+ expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions)))
+ .toMatchInlineSnapshot(`
"🚀 Expo preview is ready!
- Project → **fake-project**
@@ -147,7 +165,8 @@ describe(createSummary, () => {
it('returns expected message for ios only', () => {
const fakeUpdate = fakeUpdatesSingle.filter(update => update.platform === 'ios');
- expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions))).toMatchInlineSnapshot(`
+ expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions)))
+ .toMatchInlineSnapshot(`
"🚀 Expo preview is ready!
- Project → **fake-project**
@@ -163,8 +182,12 @@ describe(createSummary, () => {
it('returns Expo Go compatible QR code when forced', () => {
const customOptions: typeof fakeOptions = { ...fakeOptions, qrTarget: 'expo-go' };
- expect(createSummary(fakeUpdatesMultiple, getVariables(fakeExpoConfig, fakeUpdatesMultiple, customOptions)))
- .toMatchInlineSnapshot(`
+ expect(
+ createSummary(
+ fakeUpdatesMultiple,
+ getVariables(fakeExpoConfig, fakeUpdatesMultiple, customOptions)
+ )
+ ).toMatchInlineSnapshot(`
"🚀 Expo preview is ready!
- Project → **fake-project**
diff --git a/tests/actions/setup.test.ts b/tests/actions/setup.test.ts
index bb336385..9d7338dc 100644
--- a/tests/actions/setup.test.ts
+++ b/tests/actions/setup.test.ts
@@ -1,6 +1,6 @@
import * as core from '@actions/core';
-import { setupInput, setupAction } from '../../src/actions/setup';
+import { setupAction, setupInput } from '../../src/actions/setup';
import * as cacher from '../../src/cacher';
import * as expo from '../../src/expo';
import * as packager from '../../src/packager';
@@ -89,7 +89,12 @@ describe(setupAction, () => {
});
it('authenticates token with eas-cli by default', async () => {
- await setupAction({ ...input, expoVersion: 'latest', easVersion: 'latest', token: 'faketoken' });
+ await setupAction({
+ ...input,
+ expoVersion: 'latest',
+ easVersion: 'latest',
+ token: 'faketoken',
+ });
expect(expo.authenticate).toBeCalledWith('faketoken', 'eas');
});
diff --git a/tests/cacher.test.ts b/tests/cacher.test.ts
index 42d2784c..21386b9d 100644
--- a/tests/cacher.test.ts
+++ b/tests/cacher.test.ts
@@ -40,13 +40,17 @@ describe(restoreFromCache, () => {
it('throws when cache has unexpected error', async () => {
jest.mocked(cache.isFeatureAvailable).mockReturnValue(true);
jest.mocked(cache.restoreCache).mockRejectedValue(new Error('Node registry is down'));
- await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).rejects.toThrow('Node registry is down');
+ await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).rejects.toThrow(
+ 'Node registry is down'
+ );
});
it('returns expo-cli path from cache when available', async () => {
jest.mocked(cache.isFeatureAvailable).mockReturnValue(true);
jest.mocked(cache.restoreCache).mockResolvedValue('fake/path');
- await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).resolves.toBe(toolPath('expo-cli', '5.0.3'));
+ await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).resolves.toBe(
+ toolPath('expo-cli', '5.0.3')
+ );
});
it('returns nothing when cache is empty', async () => {
diff --git a/tests/comment.test.ts b/tests/comment.test.ts
index 7f9fe93b..e9168e48 100644
--- a/tests/comment.test.ts
+++ b/tests/comment.test.ts
@@ -49,9 +49,8 @@ describe(getSchemesInOrderFromConfig, () => {
});
it('returns schemes in order when defined as array', () => {
- expect(getSchemesInOrderFromConfig({ scheme: ['ega', 'expogithubaction'] } as ExpoConfig)).toEqual([
- 'expogithubaction',
- 'ega',
- ]);
+ expect(
+ getSchemesInOrderFromConfig({ scheme: ['ega', 'expogithubaction'] } as ExpoConfig)
+ ).toEqual(['expogithubaction', 'ega']);
});
});
diff --git a/tests/eas.test.ts b/tests/eas.test.ts
index 491feeea..a7053327 100644
--- a/tests/eas.test.ts
+++ b/tests/eas.test.ts
@@ -20,7 +20,9 @@ describe(getUpdateGroupQr, () => {
updateGroupId: 'updateGroupId',
appSlug: 'appslug',
})
- ).toBe('https://qr.expo.dev/eas-update?appScheme=appslug&projectId=projectId&groupId=updateGroupId');
+ ).toBe(
+ 'https://qr.expo.dev/eas-update?appScheme=appslug&projectId=projectId&groupId=updateGroupId'
+ );
});
it('returns url for dev-build, with `_` in appSlug', () => {
@@ -31,6 +33,8 @@ describe(getUpdateGroupQr, () => {
updateGroupId: 'updateGroupId',
appSlug: 'hello_world',
})
- ).toBe('https://qr.expo.dev/eas-update?appScheme=helloworld&projectId=projectId&groupId=updateGroupId');
+ ).toBe(
+ 'https://qr.expo.dev/eas-update?appScheme=helloworld&projectId=projectId&groupId=updateGroupId'
+ );
});
});
diff --git a/tests/expo.test.ts b/tests/expo.test.ts
index a8c81e27..8e62e3d7 100644
--- a/tests/expo.test.ts
+++ b/tests/expo.test.ts
@@ -2,7 +2,7 @@ import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as io from '@actions/io';
-import { authenticate, projectQR, projectLink, projectDeepLink, parseCommand } from '../src/expo';
+import { authenticate, parseCommand, projectDeepLink, projectLink, projectQR } from '../src/expo';
jest.mock('@actions/core');
jest.mock('@actions/exec');
@@ -63,9 +63,9 @@ describe(projectQR, () => {
});
it('returns url with owner, slug, and release channel', () => {
- expect(projectQR({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')).toBe(
- 'https://qr.expo.dev/expo-go?owner=fakeowner&slug=fakeslug&releaseChannel=fakechannel'
- );
+ expect(
+ projectQR({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')
+ ).toBe('https://qr.expo.dev/expo-go?owner=fakeowner&slug=fakeslug&releaseChannel=fakechannel');
});
});
@@ -81,9 +81,9 @@ describe(projectLink, () => {
});
it('returns url with owner, slug, and release channel', () => {
- expect(projectLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')).toBe(
- 'https://expo.dev/@fakeowner/fakeslug?release-channel=fakechannel'
- );
+ expect(
+ projectLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')
+ ).toBe('https://expo.dev/@fakeowner/fakeslug?release-channel=fakechannel');
});
});
@@ -99,8 +99,8 @@ describe(projectDeepLink, () => {
});
it('returns url with owner, slug, and release channel', () => {
- expect(projectDeepLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')).toBe(
- 'exp://exp.host/@fakeowner/fakeslug?release-channel=fakechannel'
- );
+ expect(
+ projectDeepLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')
+ ).toBe('exp://exp.host/@fakeowner/fakeslug?release-channel=fakechannel');
});
});
diff --git a/tests/fingerprint/FingerprintDbManager.test.ts b/tests/fingerprint/FingerprintDbManager.test.ts
index 2de993fd..5ff5ac64 100644
--- a/tests/fingerprint/FingerprintDbManager.test.ts
+++ b/tests/fingerprint/FingerprintDbManager.test.ts
@@ -19,8 +19,12 @@ describe(FingerprintDbManager, () => {
easBuildId: 'id1',
fingerprint: { sources: [], hash: 'hash1' },
});
- expect(await fingerprintDbManager.queryEasBuildIdsFromFingerprintAsync('nonExistedId')).toEqual([]);
- expect(await fingerprintDbManager.queryEasBuildIdsFromFingerprintAsync('hash1')).toEqual(['id1']);
+ expect(await fingerprintDbManager.queryEasBuildIdsFromFingerprintAsync('nonExistedId')).toEqual(
+ []
+ );
+ expect(await fingerprintDbManager.queryEasBuildIdsFromFingerprintAsync('hash1')).toEqual([
+ 'id1',
+ ]);
});
it('getFingerprintSourcesAsync', async () => {
@@ -40,7 +44,8 @@ describe(FingerprintDbManager, () => {
{
type: 'contents',
id: 'packageJson:scripts',
- contents: '{"start":"expo start","android":"expo run:android","ios":"expo run:ios","web":"expo start --web"}',
+ contents:
+ '{"start":"expo start","android":"expo run:android","ios":"expo run:ios","web":"expo start --web"}',
reasons: ['packageJson:scripts'],
hash: '119dec73c92445762a48c9455d9f34a643be8cf0',
},
diff --git a/tests/github.test.ts b/tests/github.test.ts
index 1c64b599..1a5eec68 100644
--- a/tests/github.test.ts
+++ b/tests/github.test.ts
@@ -1,6 +1,6 @@
import * as github from '@actions/github';
-import { setEnv, resetEnv } from './utils';
+import { resetEnv, setEnv } from './utils';
import { githubApi, pullContext } from '../src/github';
jest.mock('@actions/github');
diff --git a/tests/packager.test.ts b/tests/packager.test.ts
index c7024e30..dbac5494 100644
--- a/tests/packager.test.ts
+++ b/tests/packager.test.ts
@@ -18,9 +18,9 @@ describe(resolvePackage, () => {
});
it('rejects donotpublishthispackageoryouwillbefired with proper error', async () => {
- await expect(resolvePackage('donotpublishthispackageoryouwillbefired', 'latest')).rejects.toThrow(
- 'Could not resolve'
- );
+ await expect(
+ resolvePackage('donotpublishthispackageoryouwillbefired', 'latest')
+ ).rejects.toThrow('Could not resolve');
});
it('rejects expo-cli@9999999 with proper error', async () => {
diff --git a/tests/sqlite.test.ts b/tests/sqlite.test.ts
index f24558cf..8aa956d7 100644
--- a/tests/sqlite.test.ts
+++ b/tests/sqlite.test.ts
@@ -1,4 +1,4 @@
-import { openDatabaseAsync, Database } from '../src/sqlite';
+import { Database, openDatabaseAsync } from '../src/sqlite';
describe(openDatabaseAsync, () => {
let db: Database;
diff --git a/tests/worker.test.ts b/tests/worker.test.ts
index dc928c22..f066f079 100644
--- a/tests/worker.test.ts
+++ b/tests/worker.test.ts
@@ -3,8 +3,14 @@ import * as exec from '@actions/exec';
import os from 'os';
import path from 'path';
-import { resetEnv, setEnv, setPlatform, resetPlatform } from './utils';
-import { tempPath, toolPath, installToolFromPackage, patchWatchers, executeAction } from '../src/worker';
+import { resetEnv, resetPlatform, setEnv, setPlatform } from './utils';
+import {
+ executeAction,
+ installToolFromPackage,
+ patchWatchers,
+ tempPath,
+ toolPath,
+} from '../src/worker';
jest.mock('@actions/core');
jest.mock('@actions/exec');
@@ -19,7 +25,9 @@ describe(tempPath, () => {
it('returns path with name, version, and arch type', () => {
setEnv('RUNNER_TEMP', 'fake/temp');
- expect(tempPath('expo-cli', '5.0.3')).toBe(path.join('fake', 'temp', 'expo-cli', '5.0.3', os.arch()));
+ expect(tempPath('expo-cli', '5.0.3')).toBe(
+ path.join('fake', 'temp', 'expo-cli', '5.0.3', os.arch())
+ );
});
});
@@ -33,7 +41,9 @@ describe(toolPath, () => {
it('returns path with name, version, and arch type', () => {
setEnv('RUNNER_TOOL_CACHE', 'fake/tool');
- expect(toolPath('eas-cli', '0.34.3')).toBe(path.join('fake', 'tool', 'eas-cli', '0.34.3', os.arch()));
+ expect(toolPath('eas-cli', '0.34.3')).toBe(
+ path.join('fake', 'tool', 'eas-cli', '0.34.3', os.arch())
+ );
});
});