Home / Function/ main() — vue Function Reference

main() — vue Function Reference

Architecture documentation for the main() function in release.js from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  972fb9c2_5d8a_c197_c499_7cac09d96d9f["main()"]
  0eec000d_49b6_8620_8562_6755100cc5c1["release.js"]
  972fb9c2_5d8a_c197_c499_7cac09d96d9f -->|defined in| 0eec000d_49b6_8620_8562_6755100cc5c1
  21cb750e_d6c7_0c9d_32c9_db6438287063["inc()"]
  972fb9c2_5d8a_c197_c499_7cac09d96d9f -->|calls| 21cb750e_d6c7_0c9d_32c9_db6438287063
  1256efc5_7356_09dd_eb53_082c7d8e1103["step()"]
  972fb9c2_5d8a_c197_c499_7cac09d96d9f -->|calls| 1256efc5_7356_09dd_eb53_082c7d8e1103
  e7409ccc_8d64_2648_5407_5b8407e25bd7["run()"]
  972fb9c2_5d8a_c197_c499_7cac09d96d9f -->|calls| e7409ccc_8d64_2648_5407_5b8407e25bd7
  73b6c0fa_c53b_4ca6_a74f_179deb02e560["updatePackage()"]
  972fb9c2_5d8a_c197_c499_7cac09d96d9f -->|calls| 73b6c0fa_c53b_4ca6_a74f_179deb02e560
  58ea9b37_85d8_576d_e04f_31cc890f571b["getPkgRoot()"]
  972fb9c2_5d8a_c197_c499_7cac09d96d9f -->|calls| 58ea9b37_85d8_576d_e04f_31cc890f571b
  2e843f45_87a5_ab9e_f669_1a9ea0768255["publishPackage()"]
  972fb9c2_5d8a_c197_c499_7cac09d96d9f -->|calls| 2e843f45_87a5_ab9e_f669_1a9ea0768255
  style 972fb9c2_5d8a_c197_c499_7cac09d96d9f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/release.js lines 36–132

async function main() {
  let targetVersion = args._[0]

  if (!targetVersion) {
    // no explicit version, offer suggestions
    const { release } = await prompt({
      type: 'select',
      name: 'release',
      message: 'Select release type',
      choices: versionIncrements.map(i => `${i} (${inc(i)})`).concat(['custom'])
    })

    if (release === 'custom') {
      targetVersion = (
        await prompt({
          type: 'input',
          name: 'version',
          message: 'Input custom version',
          initial: currentVersion
        })
      ).version
    } else {
      targetVersion = release.match(/\((.*)\)/)[1]
    }
  }

  if (!semver.valid(targetVersion)) {
    throw new Error(`invalid target version: ${targetVersion}`)
  }

  const { yes } = await prompt({
    type: 'confirm',
    name: 'yes',
    message: `Releasing v${targetVersion}. Confirm?`
  })

  if (!yes) {
    return
  }

  // run tests before release
  step('\nRunning tests...')
  if (!skipTests && !isDryRun) {
    await run('pnpm', ['test'])
  } else {
    console.log(`(skipped)`)
  }

  // update all package versions and inter-dependencies
  step('\nUpdating package versions...')
  packages.forEach(p => updatePackage(getPkgRoot(p), targetVersion))

  // build all packages with types
  step('\nBuilding all packages...')
  if (!skipBuild && !isDryRun) {
    await run('pnpm', ['run', 'build'])
    if (skipTests) {
      await run('pnpm', ['run', 'build:types'])
    }
  } else {
    console.log(`(skipped)`)
  }

  // generate changelog
  step('\nGenerating changelog...')
  await run(`pnpm`, ['run', 'changelog'])

  // update pnpm-lock.yaml
  step('\nUpdating lockfile...')
  await run(`pnpm`, ['install', '--prefer-offline'])

  const { stdout } = await run('git', ['diff'], { stdio: 'pipe' })
  if (stdout) {
    step('\nCommitting changes...')
    await runIfNotDry('git', ['add', '-A'])
    await runIfNotDry('git', ['commit', '-m', `release: v${targetVersion}`])
  } else {
    console.log('No changes to commit.')
  }

  // publish packages

Domain

Subdomains

Defined In

Frequently Asked Questions

What does main() do?
main() is a function in the vue codebase, defined in scripts/release.js.
Where is main() defined?
main() is defined in scripts/release.js at line 36.
What does main() call?
main() calls 6 function(s): getPkgRoot, inc, publishPackage, run, step, updatePackage.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free