Skip to content

Commit cd48895

Browse files
committed
Modify package task to package a single binary
This is so it can be used as part of the build/release script.
1 parent 2eb60ca commit cd48895

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

build/tasks.ts

+22-28
Original file line numberDiff line numberDiff line change
@@ -260,43 +260,37 @@ const ensurePatched = register("vscode:patch", async (runner) => {
260260
}
261261
});
262262

263-
register("package", async (runner, releaseTag, binLocation) => {
263+
register("package", async (runner, binaryPath, releaseTag, platform) => {
264+
if (!binaryPath) {
265+
throw new Error("Please specify the location of the binary.");
266+
}
264267
if (!releaseTag) {
265268
throw new Error("Please specify the release tag.");
266269
}
267-
if (!binLocation) {
268-
throw new Error("Please specify the location of the binaries.");
270+
if (!platform) {
271+
throw new Error("Please specify the platform.");
269272
}
270273

271274
const releasePath = path.resolve(__dirname, `../release/${releaseTag}`);
272-
fse.removeSync(releasePath);
273275
fse.mkdirpSync(releasePath);
274276

275-
await Promise.all([{
276-
bin: "cli-linux",
277-
name: "linux",
278-
}, {
279-
bin: "cli-osx",
280-
name: "apple-darwin",
281-
}].map(async (pkg) => {
282-
const archiveName = `code-server-${releaseTag}-x86_64-${pkg.name}`;
283-
const archiveDir = path.join(releasePath, archiveName);
284-
fse.mkdirpSync(archiveDir);
285-
286-
const binaryPath = path.join(binLocation, pkg.bin);
287-
const binaryDestination = path.join(archiveDir, "code-server");
288-
fse.copySync(binaryPath, binaryDestination);
289-
fs.chmodSync(binaryDestination, "755");
290-
["README.md", "LICENSE"].forEach((fileName) => {
291-
fse.copySync(path.resolve(__dirname, `../${fileName}`), path.join(archiveDir, fileName));
292-
});
277+
const archiveName = `code-server-${releaseTag}-${platform}`;
278+
const archiveDir = path.join(releasePath, archiveName);
279+
fse.removeSync(archiveDir);
280+
fse.mkdirpSync(archiveDir);
281+
282+
const binaryDestination = path.join(archiveDir, "code-server");
283+
fse.copySync(binaryPath, binaryDestination);
284+
fs.chmodSync(binaryDestination, "755");
285+
["README.md", "LICENSE"].forEach((fileName) => {
286+
fse.copySync(path.resolve(__dirname, `../${fileName}`), path.join(archiveDir, fileName));
287+
});
293288

294-
runner.cwd = releasePath;
295-
await Promise.all([
296-
runner.execute("tar", ["-cvzf", `${archiveName}.tar.gz`, `${archiveName}`]),
297-
runner.execute("zip", ["-r", `${archiveName}.zip`, `${archiveName}`]),
298-
]);
299-
}));
289+
runner.cwd = releasePath;
290+
await Promise.all([
291+
runner.execute("tar", ["-cvzf", `${archiveName}.tar.gz`, `${archiveName}`]),
292+
runner.execute("zip", ["-r", `${archiveName}.zip`, `${archiveName}`]),
293+
]);
300294
});
301295

302296
run();

0 commit comments

Comments
 (0)