lock-pre-release-versions.mjs — tailwindcss Source File
Architecture documentation for lock-pre-release-versions.mjs, a javascript file in the tailwindcss codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 290d1a82_d6ad_16f6_da36_35bd071756ad["lock-pre-release-versions.mjs"] 69c3e246_0d60_1a3b_6419_4c423b01252f["node:child_process"] 290d1a82_d6ad_16f6_da36_35bd071756ad --> 69c3e246_0d60_1a3b_6419_4c423b01252f b75e8457_6610_e7ce_eeaf_9a1dd10fc510["promises"] 290d1a82_d6ad_16f6_da36_35bd071756ad --> b75e8457_6610_e7ce_eeaf_9a1dd10fc510 89aef3dd_1eed_c141_d425_b8949215a653["node:path"] 290d1a82_d6ad_16f6_da36_35bd071756ad --> 89aef3dd_1eed_c141_d425_b8949215a653 10ecf419_277e_3620_6d06_e109dd18d553["prettier"] 290d1a82_d6ad_16f6_da36_35bd071756ad --> 10ecf419_277e_3620_6d06_e109dd18d553 style 290d1a82_d6ad_16f6_da36_35bd071756ad fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { exec } from 'node:child_process'
import fs from 'node:fs/promises'
import path from 'node:path'
import prettier from 'prettier'
exec('pnpm --silent --filter=!./playgrounds/* -r exec pwd', async (err, stdout) => {
if (err) {
console.error(err)
process.exit(1)
}
let paths = stdout
.trim()
.split('\n')
.map((x) => path.resolve(x, 'package.json'))
for (let path of paths) {
let pkg = await fs.readFile(path, 'utf8').then(JSON.parse)
// In our case, all pre-release like versions have a `-` in the version
// number.
//
// E.g.:
//
// - `0.0.0-development.0`
// - `0.0.0-insiders.{hash}`
if (!pkg.version?.includes('-')) continue
let shouldUpdate = false
for (let group of [
'dependencies',
'devDependencies',
'peerDependencies',
'optionalDependencies',
]) {
for (let [name, version] of Object.entries(pkg[group] ?? {})) {
if (version === 'workspace:*' || !version.startsWith('workspace:')) continue
// Set the version to `workspace:*`, we don't need to know the exact
// version because `pnpm` will handle it for us at publishing time.
pkg[group][name] = 'workspace:*'
// Whether or not we should update the `package.json` file.
shouldUpdate = true
}
}
if (shouldUpdate) {
await fs.writeFile(
path,
await prettier
.format(JSON.stringify(pkg, null, 2), { filepath: path })
.then((x) => `${x.trim()}\n`),
)
}
}
console.log('Done.')
})
Dependencies
- node:child_process
- node:path
- prettier
- promises
Source
Frequently Asked Questions
What does lock-pre-release-versions.mjs do?
lock-pre-release-versions.mjs is a source file in the tailwindcss codebase, written in javascript.
What does lock-pre-release-versions.mjs depend on?
lock-pre-release-versions.mjs imports 4 module(s): node:child_process, node:path, prettier, promises.
Where is lock-pre-release-versions.mjs in the architecture?
lock-pre-release-versions.mjs is located at scripts/lock-pre-release-versions.mjs (directory: scripts).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free