mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 21:07:46 +00:00
### Related Issues Noticed this log was not being converted to a string so we're losing some context so this corrects in case we have a failure on this step in the future. Fixes: https://github.com/vercel/vercel/runs/7344626478?check_suite_focus=true#step:8:258 ### 📋 Checklist <!-- Please keep your PR as a Draft until the checklist is complete --> #### Tests - [ ] The code changed/added as part of this PR has been covered with tests - [ ] All tests pass locally with `yarn test-unit` #### Code Review - [ ] This PR has a concise title and thorough description useful to a reviewer - [ ] Issue from task tracker has a link to this PR
33 lines
914 B
JavaScript
Vendored
33 lines
914 B
JavaScript
Vendored
const fs = require('fs');
|
|
const path = require('path');
|
|
const { execSync } = require('child_process');
|
|
|
|
const changedFiles = execSync('git diff HEAD~ --name-only')
|
|
.toString()
|
|
.split('\n')
|
|
.map(file => file.trim());
|
|
|
|
const changedPackageVersions = new Map();
|
|
|
|
for (const file of changedFiles) {
|
|
if (file.match(/packages\/.+\/package.json/)) {
|
|
const packageData = JSON.parse(
|
|
fs.readFileSync(path.join(__dirname, '..', file), 'utf8')
|
|
);
|
|
changedPackageVersions.set(packageData.name, packageData.version);
|
|
}
|
|
}
|
|
|
|
for (const [package, version] of changedPackageVersions) {
|
|
if (version.includes('canary')) {
|
|
console.log(
|
|
`skipping ${package}@${version} as it is already a canary version`
|
|
);
|
|
} else {
|
|
console.log(
|
|
execSync(`npm dist-tag add ${package}@${version} canary`).toString()
|
|
);
|
|
console.log(`updated canary dist-tag for ${package}@${version}`);
|
|
}
|
|
}
|