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
  c60badf3_b09f_932b_32cb_5499fe7d97cf["main()"]
  62056798_8de6_14bf_7c16_4b4ac238cc56["release.js"]
  c60badf3_b09f_932b_32cb_5499fe7d97cf -->|defined in| 62056798_8de6_14bf_7c16_4b4ac238cc56
  ec762e89_61a8_18ae_22df_295cc85cc5a6["inc()"]
  c60badf3_b09f_932b_32cb_5499fe7d97cf -->|calls| ec762e89_61a8_18ae_22df_295cc85cc5a6
  08e6faac_cd86_1b15_a24f_fed426d58e20["step()"]
  c60badf3_b09f_932b_32cb_5499fe7d97cf -->|calls| 08e6faac_cd86_1b15_a24f_fed426d58e20
  5f9b24ab_4956_11a2_271c_0ff9e8e7d9e8["run()"]
  c60badf3_b09f_932b_32cb_5499fe7d97cf -->|calls| 5f9b24ab_4956_11a2_271c_0ff9e8e7d9e8
  d8e37b2a_0f5f_5c96_d947_dd6a40921d47["updatePackage()"]
  c60badf3_b09f_932b_32cb_5499fe7d97cf -->|calls| d8e37b2a_0f5f_5c96_d947_dd6a40921d47
  d2d00d5e_e9bf_9a34_ebbe_a2d2bcb27eb3["getPkgRoot()"]
  c60badf3_b09f_932b_32cb_5499fe7d97cf -->|calls| d2d00d5e_e9bf_9a34_ebbe_a2d2bcb27eb3
  00b288cb_d78e_9b91_4900_48b883b50901["publishPackage()"]
  c60badf3_b09f_932b_32cb_5499fe7d97cf -->|calls| 00b288cb_d78e_9b91_4900_48b883b50901
  style c60badf3_b09f_932b_32cb_5499fe7d97cf 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