[compiler] Use consistent version hash for npm (#31177)
Modifies our release script to use the same version hash (the hashed `compiler` directory) for all compiler packages to keep them consistent.
lauren committed
Oct 14, 2024 at 11:20 UTC
b60286b8349e79f025103b9d106458ed667d9914
1 file changed
+7
-7
compiler/scripts/release/publish.js
+7
-7
@@ -119,6 +119,13 @@ async function main() {
119
);
120
const dateString = await getDateStringForCommit(commit);
121
const otp = argv.ci === false ? await promptForOTP() : null;
122
+ const {hash} = await hashElement(path.resolve(__dirname, '../..'), {
123
+ encoding: 'hex',
124
+ folders: {exclude: ['node_modules']},
125
+ files: {exclude: ['.DS_Store']},
126
+ });
127
+ const truncatedHash = hash.slice(0, 7);
128
+ const newVersion = `0.0.0-experimental-${truncatedHash}-${dateString}`;
129
130
for (const pkgName of pkgNames) {
131
const pkgDir = path.resolve(__dirname, `../../packages/${pkgName}`);
@@ -126,13 +133,6 @@ async function main() {
133
__dirname,
134
`../../packages/${pkgName}/package.json`
135
);
129
- const {hash} = await hashElement(pkgDir, {
130
- encoding: 'hex',
131
- folders: {exclude: ['node_modules']},
132
- files: {exclude: ['.DS_Store']},
133
- });
134
- const truncatedHash = hash.slice(0, 7);
135
- const newVersion = `0.0.0-experimental-${truncatedHash}-${dateString}`;
136
137
spinner.start(`Writing package.json for ${pkgName}@${newVersion}`);
138
await writeJson(