Home / File/ lock-pre-release-versions.mjs — tailwindcss Source File

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.

File javascript 4 imports

Entity Profile

Dependency Diagram

graph LR
  0453cbdf_b483_5a63_1c8c_352ba748cc0b["lock-pre-release-versions.mjs"]
  8d4c06fc_a152_c497_9c1b_b60c5c91b817["node:child_process"]
  0453cbdf_b483_5a63_1c8c_352ba748cc0b --> 8d4c06fc_a152_c497_9c1b_b60c5c91b817
  8118fcf2_a51d_d1a1_93d3_c71d3a646692["promises"]
  0453cbdf_b483_5a63_1c8c_352ba748cc0b --> 8118fcf2_a51d_d1a1_93d3_c71d3a646692
  2a7660a5_3e09_bd74_37f0_e4e54bc64ce5["node:path"]
  0453cbdf_b483_5a63_1c8c_352ba748cc0b --> 2a7660a5_3e09_bd74_37f0_e4e54bc64ce5
  314f842b_c991_fa3a_70e2_6e0554f5789b["prettier"]
  0453cbdf_b483_5a63_1c8c_352ba748cc0b --> 314f842b_c991_fa3a_70e2_6e0554f5789b
  style 0453cbdf_b483_5a63_1c8c_352ba748cc0b 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

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