Skip to content

Fix release build issues #905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ const { values: rawOptions } = parseArgs({
*/
const options = /** @type {Options} */ (rawOptions);

if (options.forRelease && !options.setPrerelease) {
throw new Error("forRelease requires setPrerelease");
}

const defaultGoBuildTags = [
...(options.noembed ? ["noembed"] : []),
];
Expand Down Expand Up @@ -1153,7 +1157,24 @@ export const packNativePreviewExtensions = task({

await $({ cwd: extensionDir })`npm run bundle`;

const version = getVersion();
let version = "0.0.0";
if (options.forRelease) {
// No real semver prerelease versioning.
// https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions
assert(options.setPrerelease, "forRelease is true but setPrerelease is not set");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear this is obviously temporary and any stable release would not do this

const prerelease = options.setPrerelease;
assert(typeof prerelease === "string", "setPrerelease is not a string");
// parse `dev.<number>.<number>`.
const match = prerelease.match(/dev\.(\d+)\.(\d+)/);
if (!match) {
throw new Error(`Prerelease version should be in the form of dev.<number>.<number>, but got ${prerelease}`);
}
// Set version to `0.<number>.<number>`.
version = `0.${match[1]}.${match[2]}`;
}

console.log("Version:", version);

const platforms = nativePreviewPlatforms();

await Promise.all(platforms.map(async ({ npmDir, vscodeTarget, extensionDir: thisExtensionDir, vsixPath, vsixManifestPath, vsixSignaturePath }) => {
Expand Down
3 changes: 3 additions & 0 deletions _packages/native-preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"type": "git",
"url": "https://github.com/microsoft/typescript-go.git"
},
"publishConfig": {
"access": "public"
},
"type": "module",
"preferUnplugged": true,
"engines": {
Expand Down