Home / File/ upgrade.mjs — tailwindcss Source File

upgrade.mjs — tailwindcss Source File

Architecture documentation for upgrade.mjs, a javascript file in the tailwindcss codebase. 4 imports, 0 dependents.

File javascript 4 imports

Entity Profile

Dependency Diagram

graph LR
  d2de02ad_581d_2af3_8246_6f1c4847ed66["upgrade.mjs"]
  8d4c06fc_a152_c497_9c1b_b60c5c91b817["node:child_process"]
  d2de02ad_581d_2af3_8246_6f1c4847ed66 --> 8d4c06fc_a152_c497_9c1b_b60c5c91b817
  8118fcf2_a51d_d1a1_93d3_c71d3a646692["promises"]
  d2de02ad_581d_2af3_8246_6f1c4847ed66 --> 8118fcf2_a51d_d1a1_93d3_c71d3a646692
  2a7660a5_3e09_bd74_37f0_e4e54bc64ce5["node:path"]
  d2de02ad_581d_2af3_8246_6f1c4847ed66 --> 2a7660a5_3e09_bd74_37f0_e4e54bc64ce5
  83f4eb5c_a623_9c4e_b3f7_d95e77d40d82["node:url"]
  d2de02ad_581d_2af3_8246_6f1c4847ed66 --> 83f4eb5c_a623_9c4e_b3f7_d95e77d40d82
  style d2de02ad_581d_2af3_8246_6f1c4847ed66 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { execSync } from 'node:child_process'
import fs from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const __dirname = fileURLToPath(new URL('.', import.meta.url))
const cwd = path.join(__dirname, '..')

let originalLockfile = await fs.readFile(path.join(cwd, '../../pnpm-lock.yaml'), 'utf-8')

console.log('Overwriting dependencies for @tailwindcss/upgrade')

// Apply package patches
let json = JSON.parse(await fs.readFile('package.json', 'utf-8'))
json.pnpm = {
  overrides: {
    '@tailwindcss/upgrade>tailwindcss': 'file:../../dist/tailwindcss.tgz',
    '@tailwindcss/upgrade>@tailwindcss/node': 'file:../../dist/tailwindcss-node.tgz',
  },
}
json.devDependencies['@tailwindcss/upgrade'] = 'file:../../dist/tailwindcss-upgrade.tgz'
await fs.writeFile('package.json', JSON.stringify(json, null, 2))

try {
  execSync('pnpm install --ignore-workspace', { cwd })
} catch (error) {
  console.error(error.stdout?.toString() ?? error)
}

execSync('npx @tailwindcss/upgrade --force', { cwd, stdio: 'inherit' })

// Undo package patches
json = JSON.parse(await fs.readFile('package.json', 'utf-8'))
delete json.pnpm
delete json.devDependencies['@tailwindcss/upgrade']
await fs.writeFile('package.json', JSON.stringify(json, null, 2))

// Restore original lockfile (to avoid unnecessary changes in git diff)
await fs.writeFile(path.join(cwd, '../../pnpm-lock.yaml'), originalLockfile)
await fs.unlink(path.join(cwd, 'pnpm-lock.yaml'))

Dependencies

  • node:child_process
  • node:path
  • node:url
  • promises

Frequently Asked Questions

What does upgrade.mjs do?
upgrade.mjs is a source file in the tailwindcss codebase, written in javascript.
What does upgrade.mjs depend on?
upgrade.mjs imports 4 module(s): node:child_process, node:path, node:url, promises.
Where is upgrade.mjs in the architecture?
upgrade.mjs is located at playgrounds/v3/scripts/upgrade.mjs (directory: playgrounds/v3/scripts).

Analyze Your Own Codebase

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

Try Supermodel Free