diff --git a/scripts/refresh/snapshots.mts b/scripts/refresh/snapshots.mts index cf3485cf4..5e39c983d 100644 --- a/scripts/refresh/snapshots.mts +++ b/scripts/refresh/snapshots.mts @@ -8,9 +8,9 @@ import type { ScriptMeta } from '../lib/run-main.mts' import { runMain } from '../lib/run-main.mts' import type { SnapshotDependencyName } from './snapshots/dependencies.mts' import { + SNAPSHOT_DEPENDENCIES, assertSnapshotDependenciesCurrent, normalizeSnapshotDependencyName, - SNAPSHOT_DEPENDENCIES, } from './snapshots/dependencies.mts' const ROOT = path.resolve(import.meta.dirname, '../..') diff --git a/scripts/test/native.mts b/scripts/test/native.mts index 393dbb95c..27cc304be 100644 --- a/scripts/test/native.mts +++ b/scripts/test/native.mts @@ -8,6 +8,7 @@ import process from 'node:process' import { isMainModule } from '../lib/is-main-module.mts' import type { ScriptMeta } from '../lib/run-main.mts' import { runMain } from '../lib/run-main.mts' +import { SEA_VERSION } from '../../src/sea/version.mts' import { assertSnapshotDependenciesCurrent } from '../refresh/snapshots/dependencies.mts' import { persistNativeSigningReceipt, @@ -118,9 +119,11 @@ function runPnpm(args: readonly string[], env = process.env): void { } async function main(): Promise { - const packageInfo = JSON.parse( + const { name } = JSON.parse( await fs.readFile(PACKAGE_PATH, 'utf8'), ) as PackageMetadata + // The 1.x line builds its native CLI as the configured 2.1 prerelease. + const nativeApp: PackageMetadata = { name, version: SEA_VERSION } const userArgs = process.argv.slice(2) const build = userArgs.includes('--build') const vitestArgs = userArgs.filter( @@ -208,7 +211,7 @@ async function main(): Promise { if (process.platform !== 'win32') { await fs.chmod(binaryPath, 0o700) } - const manifest = await verifyArtifact(packageInfo, binaryPath, manifestPath) + const manifest = await verifyArtifact(nativeApp, binaryPath, manifestPath) const sourceDigest = manifest.payloads.find( payload => payload.id === 'socket-vfs', )!.sha256! @@ -229,7 +232,7 @@ async function main(): Promise { process.env['SOCKET_CLI_NATIVE_TEST_STAGE'] = stageDir process.env['SOCKET_CLI_NATIVE_TEST_CAPABILITIES'] = manifest.capabilities.available.join(',') - process.env['SOCKET_CLI_NATIVE_TEST_VERSION'] = packageInfo.version + process.env['SOCKET_CLI_NATIVE_TEST_VERSION'] = nativeApp.version const nodeRuntime = manifest.payloads.find( payload => payload.id === 'node-runtime', ) @@ -292,7 +295,7 @@ async function main(): Promise { } if ( version.status !== 0 || - !version.stdout.trim().startsWith(packageInfo.version) + !version.stdout.trim().startsWith(nativeApp.version) ) { throw new Error( `Native --version check failed (status ${version.status}): ${version.stdout}${version.stderr}`, diff --git a/test/release-workflow.test.mts b/test/release-workflow.test.mts index 4ef9672b5..85ed6d3b5 100644 --- a/test/release-workflow.test.mts +++ b/test/release-workflow.test.mts @@ -1,10 +1,5 @@ import { execFileSync } from 'node:child_process' -import { - mkdtempSync, - readFileSync, - rmSync, - writeFileSync, -} from 'node:fs' +import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import path from 'node:path' @@ -153,9 +148,7 @@ describe('v1 release workflow contract', () => { const stage = workflow.jobs.publish.steps.find( step => step.name === 'Stage release packages', ) - const parser = stage?.run - ?.split("<<'NODE'\n")[1] - ?.split('\nNODE')[0] + const parser = stage?.run?.split("<<'NODE'\n")[1]?.split('\nNODE')[0] expect(parser).toBeDefined() const directory = mkdtempSync(path.join(tmpdir(), 'npm-stage-output-')) @@ -221,7 +214,9 @@ describe('v1 release workflow contract', () => { expect(checkIndex).toBeGreaterThanOrEqual(0) expect(finalizeIndex).toBeGreaterThan(checkIndex) expect(finalize?.run).toContain('make_latest=false') - expect(finalize?.run).toContain('gh release view "${TAG}" --json databaseId') + expect(finalize?.run).toContain( + 'gh release view "${TAG}" --json databaseId', + ) expect(finalize?.run).not.toContain('releases/tags/${TAG}') }) @@ -262,7 +257,8 @@ describe('v1 release workflow contract', () => { const manifest = JSON.parse( readFileSync(new URL('../package.json', import.meta.url), 'utf8'), ) as { publishConfig?: { tag?: string }; version?: string } - expect(manifest.version).toMatch(/^2\.1\.0-rc\.\d+$/u) + // The stable v1 lane and the 2.1 prerelease lane both write this version. + expect(manifest.version).toMatch(/^(?:1\.\d+\.\d+|2\.1\.0-rc\.\d+)$/u) expect(manifest.publishConfig?.tag).toBe('rc-2.1.0') expect(workflow.on.workflow_dispatch.inputs['release-major']?.default).toBe( '1',