-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(releaser): make sure binary is executable
- Loading branch information
1 parent
1172ed9
commit 47c89f2
Showing
5 changed files
with
90 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import assert from "node:assert/strict"; | ||
import { test } from "node:test"; | ||
import path from "node:path"; | ||
import os from "node:os"; | ||
import { mkdir, realpath, rm, writeFile } from "node:fs/promises"; | ||
import { execSync } from "node:child_process"; | ||
import operations from "./operations"; | ||
|
||
test("produces installable archive", async () => { | ||
const tempDir = path.join( | ||
await realpath(os.tmpdir()), | ||
"turboreleaser-e2e-test" | ||
); | ||
await rm(tempDir, { recursive: true, force: true }); | ||
await mkdir(tempDir, { recursive: true }); | ||
|
||
// make a fake turbo binary at `dist-darwin-arm64/turbo` | ||
const platformPath = "dist-darwin-arm64"; | ||
await mkdir(path.join(tempDir, platformPath)); | ||
await writeFile( | ||
path.join(tempDir, platformPath, "turbo"), | ||
"#!/bin/bash\necho Invoked fake turbo!" | ||
); | ||
|
||
const tarPath = await operations.packPlatform({ | ||
platform: { os: "darwin", arch: "arm64" }, | ||
version: "0.1.2", | ||
srcDir: tempDir, | ||
}); | ||
assert.ok(path.isAbsolute(tarPath)); | ||
|
||
// Make a fake repo to install the tarball in | ||
const fakeRepo = path.join(tempDir, "fake-repo"); | ||
await mkdir(fakeRepo); | ||
await writeFile( | ||
path.join(fakeRepo, "package.json"), | ||
JSON.stringify({ | ||
name: "fake-repo", | ||
scripts: { "test-turbo-install": "turbo" }, | ||
}) | ||
); | ||
execSync(`npm install ${tarPath}`, { cwd: fakeRepo }); | ||
const output = execSync("npm run test-turbo-install", { | ||
stdio: "pipe", | ||
cwd: fakeRepo, | ||
encoding: "utf-8", | ||
}); | ||
assert.equal( | ||
output, | ||
"\n> test-turbo-install\n> turbo\n\nInvoked fake turbo!\n" | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.