Skip to content

Commit fd5dbc6

Browse files
authored
Produce npm packages to release in stages (#4433)
1 parent 1fcdf07 commit fd5dbc6

2 files changed

Lines changed: 20 additions & 16 deletions

File tree

Herebyfile.mjs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,6 +1560,10 @@ async function runBuildNativePreviewPackages() {
15601560

15611561
const { stdout: gitHead } = await $pipe`git rev-parse HEAD`;
15621562
inputPackageJson.gitHead = gitHead;
1563+
inputPackageJson.publishConfig = {
1564+
access: "public",
1565+
tag: "latest",
1566+
};
15631567

15641568
const mainPackage = {
15651569
...inputPackageJson,
@@ -1796,20 +1800,23 @@ async function runPackNativePreviewPackages() {
17961800
await fs.promises.rename(filename, npmTarball);
17971801
}));
17981802

1799-
// npm packages need to be published in reverse dep order, e.g. such that no package
1800-
// is published before its dependencies.
1801-
const publishOrder = [
1802-
...platforms.map(p => p.npmTarball),
1803-
mainNativePreviewPackage.npmTarball,
1804-
].map(p => path.basename(p));
1805-
1806-
const publishManifest = publishOrder.map(pkg => ({
1807-
filename: pkg,
1808-
tag: "latest",
1809-
}));
1803+
// npm packages need to be published in dependency order: platform packages
1804+
// first, then the main package that references them as optionalDependencies.
1805+
const publishManifest = {
1806+
stages: [
1807+
platforms.map(p => ({
1808+
filename: path.basename(p.npmTarball),
1809+
})),
1810+
[
1811+
{
1812+
filename: path.basename(mainNativePreviewPackage.npmTarball),
1813+
},
1814+
],
1815+
],
1816+
};
18101817

1811-
const publishOrderPath = path.join(builtNpm, "publish-order.json");
1812-
await fs.promises.writeFile(publishOrderPath, JSON.stringify(publishManifest, undefined, 4) + "\n");
1818+
const publishManifestPath = path.join(builtNpm, "publish-manifest.json");
1819+
await fs.promises.writeFile(publishManifestPath, JSON.stringify(publishManifest, undefined, 4) + "\n");
18131820
}
18141821

18151822
export const packNativePreviewExtensions = task({

_packages/native-preview/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
"type": "git",
2222
"url": "https://github.com/microsoft/typescript-go.git"
2323
},
24-
"publishConfig": {
25-
"access": "public"
26-
},
2724
"type": "module",
2825
"preferUnplugged": true,
2926
"engines": {

0 commit comments

Comments
 (0)