Update start release handling (#62851)

This removes the hacky handling for executing lerna with using the
official commands directly, this also removes the legacy package.json
scripts we had for publishing.

Closes NEXT-2700

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
This commit is contained in:
JJ Kasper 2024-03-04 16:28:22 -08:00 committed by GitHub
parent eeb2369a5d
commit e5a4e82f30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 215 deletions

View file

@ -41,10 +41,6 @@
"types": "lerna run types --stream",
"check-precompiled": "./scripts/check-pre-compiled.sh",
"prepublishOnly": "turbo run build",
"release-canary": "git checkout canary && git pull && lerna version prerelease --preid canary --force-publish && release --pre --skip-questions --show-url",
"release-stable": "lerna version --force-publish",
"publish-canary": "node -e 'import(\"open\").then(open => open.default(\"https://github.com/vercel/next.js/actions/workflows/trigger_release.yml\"))'",
"publish-stable": "pnpm publish-canary",
"lint-staged": "lint-staged",
"next-with-deps": "./scripts/next-with-deps.sh",
"next": "cross-env NEXT_TELEMETRY_DISABLED=1 node --trace-deprecation --enable-source-maps packages/next/dist/bin/next",
@ -182,7 +178,6 @@
"npm-run-all": "4.1.5",
"nprogress": "0.2.0",
"octokit": "3.1.0",
"open": "9.0.0",
"outdent": "0.8.0",
"pixrem": "5.0.0",
"playwright": "1.41.2",

View file

@ -392,9 +392,6 @@ importers:
octokit:
specifier: 3.1.0
version: 3.1.0
open:
specifier: 9.0.0
version: 9.0.0
outdent:
specifier: 0.8.0
version: 0.8.0
@ -8641,11 +8638,6 @@ packages:
resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==}
dev: true
/big-integer@1.6.51:
resolution: {integrity: sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==}
engines: {node: '>=0.6'}
dev: true
/big.js@5.2.2:
resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==}
dev: true
@ -8723,13 +8715,6 @@ packages:
widest-line: 3.1.0
dev: true
/bplist-parser@0.2.0:
resolution: {integrity: sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==}
engines: {node: '>= 5.10.0'}
dependencies:
big-integer: 1.6.51
dev: true
/brace-expansion@1.1.11:
resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==}
dependencies:
@ -8916,13 +8901,6 @@ packages:
semver: 7.3.7
dev: true
/bundle-name@3.0.0:
resolution: {integrity: sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==}
engines: {node: '>=12'}
dependencies:
run-applescript: 5.0.0
dev: true
/busboy@1.6.0:
resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==}
engines: {node: '>=10.16.0'}
@ -10070,6 +10048,7 @@ packages:
dependencies:
lru-cache: 4.1.5
which: 1.3.1
dev: false
/cross-spawn@4.0.2:
resolution: {integrity: sha512-yAXz/pA1tD8Gtg2S98Ekf/sewp3Lcp3YoFKJ4Hkp5h5yLWnKVTDU0kwjKJ8NDCYcfTLfyGkzTikst+jWypT1iA==}
@ -10722,24 +10701,6 @@ packages:
engines: {node: '>=0.10.0'}
dev: true
/default-browser-id@3.0.0:
resolution: {integrity: sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==}
engines: {node: '>=12'}
dependencies:
bplist-parser: 0.2.0
untildify: 4.0.0
dev: true
/default-browser@3.1.0:
resolution: {integrity: sha512-SOHecvSoairSAWxEHP/0qcsld/KtI3DargfEuELQDyHIYmS2EMgdGhHOTC1GxaYr+NLUV6kDroeiSBfnNHnn8w==}
engines: {node: '>=12'}
dependencies:
bundle-name: 3.0.0
default-browser-id: 3.0.0
execa: 5.0.0
xdg-default-browser: 2.1.0
dev: true
/defaults@1.0.3:
resolution: {integrity: sha512-s82itHOnYrN0Ib8r+z7laQz3sdE+4FP3d9Q7VLO7U+KRT+CR0GsWuyHxzdAY82I7cXv0G/twrqomTJLOssO5HA==}
dependencies:
@ -10759,11 +10720,6 @@ packages:
resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==}
engines: {node: '>=8'}
/define-lazy-prop@3.0.0:
resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==}
engines: {node: '>=12'}
dev: true
/define-properties@1.1.3:
resolution: {integrity: sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==}
engines: {node: '>= 0.4'}
@ -12234,17 +12190,6 @@ packages:
safe-buffer: 5.2.1
dev: true
/execa@0.2.2:
resolution: {integrity: sha512-zmBGzLd3nhA/NB9P7VLoceAO6vyYPftvl809Vjwe5U2fYI9tYWbeKqP3wZlAw9WS+znnkogf/bhSU+Gcn2NbkQ==}
engines: {node: '>=0.12'}
dependencies:
cross-spawn-async: 2.2.5
npm-run-path: 1.0.0
object-assign: 4.1.1
path-key: 1.0.0
strip-eof: 1.0.0
dev: true
/execa@0.4.0:
resolution: {integrity: sha1-TrZGejaglfq7KXD/nV4/t7zm68M=}
engines: {node: '>=0.12'}
@ -14607,12 +14552,6 @@ packages:
engines: {node: '>=8'}
hasBin: true
/is-docker@3.0.0:
resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
hasBin: true
dev: true
/is-empty@1.2.0:
resolution: {integrity: sha1-3pu1snhzigWgsJpX4ftNSjQan2s=}
dev: true
@ -14699,14 +14638,6 @@ packages:
/is-hexadecimal@2.0.1:
resolution: {integrity: sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==}
/is-inside-container@1.0.0:
resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==}
engines: {node: '>=14.16'}
hasBin: true
dependencies:
is-docker: 3.0.0
dev: true
/is-installed-globally@0.3.2:
resolution: {integrity: sha512-wZ8x1js7Ia0kecP/CHM/3ABkAmujX7WPvQk6uu3Fly/Mk44pySulQpnHG46OMjHGXApINnV4QhY3SWnECO2z5g==}
engines: {node: '>=8'}
@ -18418,6 +18349,7 @@ packages:
engines: {node: '>=0.10.0'}
dependencies:
path-key: 1.0.0
dev: false
/npm-run-path@3.1.0:
resolution: {integrity: sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==}
@ -18666,16 +18598,6 @@ packages:
is-docker: 2.2.1
is-wsl: 2.2.0
/open@9.0.0:
resolution: {integrity: sha512-yerrN5WPzgwuE3T6rxAkT1UuMLDzs4Szpug7hy9s4gru3iOTnaU0yKc1AYOVYrBzvykce5gUdr9RPNB4R+Zc/A==}
engines: {node: '>=14.16'}
dependencies:
default-browser: 3.1.0
define-lazy-prop: 3.0.0
is-inside-container: 1.0.0
is-wsl: 2.2.0
dev: true
/opener@1.5.2:
resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==}
hasBin: true
@ -19204,6 +19126,7 @@ packages:
/path-key@1.0.0:
resolution: {integrity: sha512-T3hWy7tyXlk3QvPFnT+o2tmXRzU4GkitkUWLp/WZ0S/FXd7XMx176tRurgTvHTNMJOQzTcesHNpBqetH86mQ9g==}
engines: {node: '>=0.10.0'}
dev: false
/path-key@2.0.1:
resolution: {integrity: sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=}
@ -22134,13 +22057,6 @@ packages:
fsevents: 2.1.3
dev: true
/run-applescript@5.0.0:
resolution: {integrity: sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==}
engines: {node: '>=12'}
dependencies:
execa: 5.0.0
dev: true
/run-async@2.4.1:
resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==}
engines: {node: '>=0.12.0'}
@ -23244,6 +23160,7 @@ packages:
/strip-eof@1.0.0:
resolution: {integrity: sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==}
engines: {node: '>=0.10.0'}
dev: false
/strip-final-newline@2.0.0:
resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==}
@ -23821,11 +23738,6 @@ packages:
tslib: 2.6.2
dev: true
/titleize@1.0.1:
resolution: {integrity: sha512-rUwGDruKq1gX+FFHbTl5qjI7teVO7eOe+C8IcQ7QT+1BK3eEUXJqbZcBOeaRP4FwSC/C1A5jDoIVta0nIQ9yew==}
engines: {node: '>=0.10.0'}
dev: true
/tmp@0.0.33:
resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==}
engines: {node: '>=0.6.0'}
@ -24631,11 +24543,6 @@ packages:
isobject: 3.0.1
dev: false
/untildify@4.0.0:
resolution: {integrity: sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==}
engines: {node: '>=8'}
dev: true
/upath@2.0.1:
resolution: {integrity: sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w==}
engines: {node: '>=4'}
@ -25441,14 +25348,6 @@ packages:
engines: {node: '>=8'}
dev: true
/xdg-default-browser@2.1.0:
resolution: {integrity: sha512-HY4G725+IDQr16N8XOjAms5qJGArdJaWIuC7Q7A8UXIwj2mifqnPXephazyL7sIkQPvmEoPX3E0v2yFv6hQUNg==}
engines: {node: '>=4'}
dependencies:
execa: 0.2.2
titleize: 1.0.1
dev: true
/xml-name-validator@4.0.0:
resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==}
engines: {node: '>=12'}

View file

@ -1,79 +1,6 @@
const path = require('path')
const execa = require('execa')
const resolveFrom = require('resolve-from')
const ansiEscapes = require('ansi-escapes')
function getPromptErrorDetails(rawAssertion, mostRecentChunk) {
const assertion = rawAssertion.toString().trim()
const mostRecent = (mostRecentChunk || '').trim()
return `Waiting for:\n "${assertion}"\nmost recent chunk was:\n "${mostRecent}"`
}
async function waitForPrompt(cp, rawAssertion, timeout = 3000) {
let assertion
if (typeof rawAssertion === 'string') {
assertion = (chunk) => chunk.includes(rawAssertion)
} else if (rawAssertion instanceof RegExp) {
assertion = (chunk) => rawAssertion.test(chunk)
} else {
assertion = rawAssertion
}
return new Promise((resolve, reject) => {
let mostRecentChunk = 'NO CHUNKS SO FAR'
console.log('Waiting for prompt...')
const handleTimeout = setTimeout(() => {
cleanup()
const promptErrorDetails = getPromptErrorDetails(
rawAssertion,
mostRecentChunk
)
reject(
new Error(
`Timed out after ${timeout}ms in waitForPrompt. ${promptErrorDetails}`
)
)
}, timeout)
const onComplete = () => {
cleanup()
const promptErrorDetails = getPromptErrorDetails(
rawAssertion,
mostRecentChunk
)
reject(
new Error(
`Process exited before prompt was found in waitForPrompt. ${promptErrorDetails}`
)
)
}
const onData = (rawChunk) => {
const chunk = rawChunk.toString()
mostRecentChunk = chunk
console.log('> ' + chunk)
if (assertion(chunk)) {
cleanup()
resolve()
}
}
const cleanup = () => {
cp.stdout?.off('data', onData)
cp.stderr?.off('data', onData)
cp.off('close', onComplete)
cp.off('exit', onComplete)
clearTimeout(handleTimeout)
}
cp.stdout?.on('data', onData)
cp.stderr?.on('data', onData)
cp.on('close', onComplete)
cp.on('exit', onComplete)
})
}
const SEMVER_TYPES = ['patch', 'minor', 'major']
@ -126,41 +53,18 @@ async function main() {
})
console.log(`Running pnpm release-${isCanary ? 'canary' : 'stable'}...`)
const child = execa(`pnpm release-${isCanary ? 'canary' : 'stable'}`, {
stdio: 'pipe',
shell: true,
})
const child = execa(
isCanary
? `pnpm lerna version prerelease --preid canary --force-publish -y && pnpm release --pre --skip-questions --show-url`
: `pnpm lerna version ${semverType} --force-publish -y`,
{
stdio: 'pipe',
shell: true,
}
)
child.stdout.pipe(process.stdout)
child.stderr.pipe(process.stderr)
if (isCanary) {
console.log("Releasing canary: enter 'y'\n")
child.stdin.write('y\n')
} else {
console.log('Wait for the version prompt to show up')
await waitForPrompt(child, 'Select a new version')
console.log('Releasing stable')
if (semverType === 'minor') {
console.log('Releasing minor: cursor down > 1\n')
child.stdin.write(ansiEscapes.cursorDown(1))
}
if (semverType === 'major') {
console.log('Releasing major: curser down > 1')
child.stdin.write(ansiEscapes.cursorDown(1))
console.log('Releasing major: curser down > 2')
child.stdin.write(ansiEscapes.cursorDown(1))
}
if (semverType === 'patch') {
console.log('Releasing patch: cursor stay\n')
}
console.log('Enter newline')
child.stdin.write('\n')
await waitForPrompt(child, 'Changes:')
console.log('Enter y')
child.stdin.write('y\n')
}
console.log('Await child process...')
await child
console.log('Release process is finished')
}