MCPcopy
hub / github.com/vuejs/core / main

Function main

scripts/release.js:143–279  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

141const step = (/** @type {string} */ msg) => console.log(pico.cyan(msg))
142
143async function main() {
144 if (!(await isInSyncWithRemote())) {
145 return
146 } else {
147 console.log(`${pico.green(`✓`)} commit is up-to-date with remote.\n`)
148 }
149
150 let targetVersion = positionals[0]
151
152 if (!targetVersion) {
153 // no explicit version, offer suggestions
154 /** @type {{ release: string }} */
155 const { release } = await prompt({
156 type: 'select',
157 name: 'release',
158 message: 'Select release type',
159 choices: versionIncrements
160 .map(i => `${i} (${inc(i)})`)
161 .concat(['custom']),
162 })
163
164 if (release === 'custom') {
165 /** @type {{ version: string }} */
166 const result = await prompt({
167 type: 'input',
168 name: 'version',
169 message: 'Input custom version',
170 initial: currentVersion,
171 })
172 targetVersion = result.version
173 } else {
174 targetVersion = release.match(/\((.*)\)/)?.[1] ?? ''
175 }
176 }
177
178 // @ts-expect-error
179 if (versionIncrements.includes(targetVersion)) {
180 // @ts-expect-error
181 targetVersion = inc(targetVersion)
182 }
183
184 if (!semver.valid(targetVersion)) {
185 throw new Error(`invalid target version: ${targetVersion}`)
186 }
187
188 if (skipPrompts) {
189 step(`Releasing v${targetVersion}...`)
190 } else {
191 /** @type {{ yes: boolean }} */
192 const { yes: confirmRelease } = await prompt({
193 type: 'confirm',
194 name: 'yes',
195 message: `Releasing v${targetVersion}. Confirm?`,
196 })
197
198 if (!confirmRelease) {
199 return
200 }

Callers

nothing calls this directly

Calls 9

isInSyncWithRemoteFunction · 0.85
stepFunction · 0.85
runTestsIfNeededFunction · 0.85
updateVersionsFunction · 0.85
buildPackagesFunction · 0.85
publishPackagesFunction · 0.85
mapMethod · 0.80
incFunction · 0.70
runFunction · 0.70

Tested by

no test coverage detected