pkg() — tailwindcss Function Reference
Architecture documentation for the pkg() function in packages.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 845754ab_207c_0988_5948_8599387b64dc["pkg()"] 5987acc9_de8e_d765_ba48_301e64c09fab["migratePostCSSConfig()"] 5987acc9_de8e_d765_ba48_301e64c09fab -->|calls| 845754ab_207c_0988_5948_8599387b64dc c1db9de2_3654_d42b_b9f2_1c5a0ccbd307["run()"] c1db9de2_3654_d42b_b9f2_1c5a0ccbd307 -->|calls| 845754ab_207c_0988_5948_8599387b64dc 4cd99e59_ac1e_2a1f_0946_33cc1afd2532["get()"] 845754ab_207c_0988_5948_8599387b64dc -->|calls| 4cd99e59_ac1e_2a1f_0946_33cc1afd2532 98270aaa_96c5_20ee_11bb_e7e96422cda4["error()"] 845754ab_207c_0988_5948_8599387b64dc -->|calls| 98270aaa_96c5_20ee_11bb_e7e96422cda4 style 845754ab_207c_0988_5948_8599387b64dc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/@tailwindcss-upgrade/src/utils/packages.ts lines 25–74
export function pkg(base: string) {
return {
async manager() {
return await packageManagerForBase.get(base)
},
async add(packages: string[], location: 'dependencies' | 'devDependencies' = 'dependencies') {
let packageManager = await packageManagerForBase.get(base)
let args = packages.slice()
if (location === 'devDependencies') {
args.push(SAVE_DEV[packageManager] || SAVE_DEV.default)
}
// Allow running the `pnpm` command in the workspace root without
// erroring. Can't just use `--workspace-root` because that will force
// install dependencies in the workspace root.
if (packageManager === 'pnpm') {
args.push('--ignore-workspace-root-check')
}
let command = `${packageManager} add ${args.join(' ')}`
try {
return await exec(command, { cwd: base })
} catch (e: any) {
error(`An error occurred while running \`${command}\`\n\n${e.stdout}\n${e.stderr}`, {
prefix: '↳ ',
})
throw e
} finally {
manifests.delete(base)
}
},
has(name: string) {
return manifests.get(base).includes(`"${name}":`)
},
async remove(packages: string[]) {
let packageManager = await packageManagerForBase.get(base)
let command = `${packageManager} remove ${packages.join(' ')}`
try {
return await exec(command, { cwd: base })
} catch (e: any) {
error(`An error occurred while running \`${command}\`\n\n${e.stdout}\n${e.stderr}`, {
prefix: '↳ ',
})
throw e
} finally {
manifests.delete(base)
}
},
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does pkg() do?
pkg() is a function in the tailwindcss codebase.
What does pkg() call?
pkg() calls 2 function(s): error, get.
What calls pkg()?
pkg() is called by 2 function(s): migratePostCSSConfig, run.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free