refactor: hide script scheduling and ios internals

This commit is contained in:
Peter Steinberger
2026-05-02 08:43:18 +01:00
parent e4aab1419a
commit f87b3c176d
3 changed files with 13 additions and 18 deletions

View File

@@ -1,19 +1,19 @@
import { readFileSync, writeFileSync } from "node:fs";
import path from "node:path";
export const IOS_VERSION_FILE = "apps/ios/version.json";
export const IOS_CHANGELOG_FILE = "apps/ios/CHANGELOG.md";
export const IOS_VERSION_XCCONFIG_FILE = "apps/ios/Config/Version.xcconfig";
export const IOS_RELEASE_NOTES_FILE = "apps/ios/fastlane/metadata/en-US/release_notes.txt";
const IOS_VERSION_FILE = "apps/ios/version.json";
const IOS_CHANGELOG_FILE = "apps/ios/CHANGELOG.md";
const IOS_VERSION_XCCONFIG_FILE = "apps/ios/Config/Version.xcconfig";
const IOS_RELEASE_NOTES_FILE = "apps/ios/fastlane/metadata/en-US/release_notes.txt";
const PINNED_IOS_VERSION_PATTERN = /^(\d{4}\.\d{1,2}\.\d{1,2})$/u;
const GATEWAY_VERSION_PATTERN = /^(\d{4}\.\d{1,2}\.\d{1,2})(?:-(?:beta\.\d+|\d+))?$/u;
export type IosVersionManifest = {
type IosVersionManifest = {
version: string;
};
export type ResolvedIosVersion = {
type ResolvedIosVersion = {
canonicalVersion: string;
marketingVersion: string;
buildVersion: string;
@@ -23,7 +23,7 @@ export type ResolvedIosVersion = {
releaseNotesPath: string;
};
export type SyncIosVersioningMode = "check" | "write";
type SyncIosVersioningMode = "check" | "write";
function normalizeTrailingNewline(value: string): string {
return value.endsWith("\n") ? value : `${value}\n`;
@@ -59,7 +59,7 @@ export function normalizeGatewayVersionToPinnedIosVersion(rawVersion: string): s
return match[1] ?? trimmed;
}
export function readRootPackageVersion(rootDir = path.resolve(".")): string {
function readRootPackageVersion(rootDir = path.resolve(".")): string {
const packageJsonPath = path.join(rootDir, "package.json");
const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8")) as { version?: unknown };
const version = typeof parsed.version === "string" ? parsed.version.trim() : "";
@@ -80,7 +80,7 @@ export function resolveGatewayVersionForIosRelease(rootDir = path.resolve(".")):
};
}
export function readIosVersionManifest(rootDir = path.resolve(".")): IosVersionManifest {
function readIosVersionManifest(rootDir = path.resolve(".")): IosVersionManifest {
const versionFilePath = path.join(rootDir, IOS_VERSION_FILE);
return JSON.parse(readFileSync(versionFilePath, "utf8")) as IosVersionManifest;
}

View File

@@ -10,11 +10,6 @@ export type LocalVitestScheduling = {
throttledBySystem: boolean;
};
export const DEFAULT_LOCAL_FULL_SUITE_PARALLELISM: number;
export const LARGE_LOCAL_FULL_SUITE_PARALLELISM: number;
export const DEFAULT_LOCAL_FULL_SUITE_VITEST_WORKERS: number;
export const LARGE_LOCAL_FULL_SUITE_VITEST_WORKERS: number;
export function isCiLikeEnv(env?: Record<string, string | undefined>): boolean;
export function resolveLocalVitestEnv(
env?: Record<string, string | undefined>,

View File

@@ -3,10 +3,10 @@
import os from "node:os";
export const DEFAULT_LOCAL_FULL_SUITE_PARALLELISM = 4;
export const LARGE_LOCAL_FULL_SUITE_PARALLELISM = 10;
export const DEFAULT_LOCAL_FULL_SUITE_VITEST_WORKERS = 1;
export const LARGE_LOCAL_FULL_SUITE_VITEST_WORKERS = 2;
const DEFAULT_LOCAL_FULL_SUITE_PARALLELISM = 4;
const LARGE_LOCAL_FULL_SUITE_PARALLELISM = 10;
const DEFAULT_LOCAL_FULL_SUITE_VITEST_WORKERS = 1;
const LARGE_LOCAL_FULL_SUITE_VITEST_WORKERS = 2;
const clamp = (value, min, max) => Math.max(min, Math.min(max, value));