releaseUtils.ts — vite Source File
Architecture documentation for releaseUtils.ts, a typescript file in the vite codebase. 4 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR a29bcc0c_c42b_5d23_0e04_88b2bf49cb44["releaseUtils.ts"] a09ff191_7c83_bdcd_30f1_b4e129910bf6["promises"] a29bcc0c_c42b_5d23_0e04_88b2bf49cb44 --> a09ff191_7c83_bdcd_30f1_b4e129910bf6 51e96894_3556_ed5c_1ede_97d449867adf["node:path"] a29bcc0c_c42b_5d23_0e04_88b2bf49cb44 --> 51e96894_3556_ed5c_1ede_97d449867adf bff4f846_ab01_b5ba_74d4_c1608e434d2c["picocolors"] a29bcc0c_c42b_5d23_0e04_88b2bf49cb44 --> bff4f846_ab01_b5ba_74d4_c1608e434d2c e4bc57e8_546b_c84b_ee54_df323bec2a01["execa"] a29bcc0c_c42b_5d23_0e04_88b2bf49cb44 --> e4bc57e8_546b_c84b_ee54_df323bec2a01 44cd7040_d15e_67ad_0c51_767320f01648["release.ts"] 44cd7040_d15e_67ad_0c51_767320f01648 --> a29bcc0c_c42b_5d23_0e04_88b2bf49cb44 style a29bcc0c_c42b_5d23_0e04_88b2bf49cb44 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fs from 'node:fs/promises'
import path from 'node:path'
import colors from 'picocolors'
import type { Options as ExecaOptions, ResultPromise } from 'execa'
import { execa } from 'execa'
function run<EO extends ExecaOptions>(
bin: string,
args: string[],
opts?: EO,
): ResultPromise<
EO & (keyof EO extends 'stdio' ? object : { stdio: 'inherit' })
> {
return execa(bin, args, { stdio: 'inherit', ...opts }) as any
}
export async function getLatestTag(pkgName: string): Promise<string> {
const pkgJson = JSON.parse(
await fs.readFile(`packages/${pkgName}/package.json`, 'utf-8'),
)
const version = pkgJson.version
return pkgName === 'vite' ? `v${version}` : `${pkgName}@${version}`
}
export async function logRecentCommits(pkgName: string): Promise<void> {
const tag = await getLatestTag(pkgName)
if (!tag) return
const sha = await run('git', ['rev-list', '-n', '1', tag], {
stdio: 'pipe',
}).then((res) => res.stdout.trim())
console.log(
colors.bold(
`\n${colors.blue(`i`)} Commits of ${colors.green(
pkgName,
)} since ${colors.green(tag)} ${colors.gray(`(${sha.slice(0, 5)})`)}`,
),
)
await run(
'git',
[
'--no-pager',
'log',
`${sha}..HEAD`,
'--oneline',
'--',
`packages/${pkgName}`,
],
{ stdio: 'inherit' },
)
console.log()
}
export async function updateTemplateVersions(): Promise<void> {
const vitePkgJson = JSON.parse(
await fs.readFile('packages/vite/package.json', 'utf-8'),
)
const viteVersion = vitePkgJson.version
if (/beta|alpha|rc/.test(viteVersion)) return
const dir = 'packages/create-vite'
const templates = (await fs.readdir(dir)).filter((dir) =>
dir.startsWith('template-'),
)
for (const template of templates) {
const pkgPath = path.join(dir, template, `package.json`)
const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8'))
pkg.devDependencies.vite = `^` + viteVersion
await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
}
}
Domain
Subdomains
Dependencies
- execa
- node:path
- picocolors
- promises
Imported By
Source
Frequently Asked Questions
What does releaseUtils.ts do?
releaseUtils.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain, ConfigEngine subdomain.
What functions are defined in releaseUtils.ts?
releaseUtils.ts defines 4 function(s): getLatestTag, logRecentCommits, run, updateTemplateVersions.
What does releaseUtils.ts depend on?
releaseUtils.ts imports 4 module(s): execa, node:path, picocolors, promises.
What files import releaseUtils.ts?
releaseUtils.ts is imported by 1 file(s): release.ts.
Where is releaseUtils.ts in the architecture?
releaseUtils.ts is located at scripts/releaseUtils.ts (domain: ViteCore, subdomain: ConfigEngine, directory: scripts).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free