pkg() — tailwindcss Function Reference
Architecture documentation for the pkg() function in packages.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 00cccf76_743c_3b0f_179f_c3f05c433097["pkg()"] 32e1ecdd_6093_f556_114f_ec3d5663975f["migratePostCSSConfig()"] 32e1ecdd_6093_f556_114f_ec3d5663975f -->|calls| 00cccf76_743c_3b0f_179f_c3f05c433097 eb8ababf_fa35_08e1_76f8_c2b2cea868b8["run()"] eb8ababf_fa35_08e1_76f8_c2b2cea868b8 -->|calls| 00cccf76_743c_3b0f_179f_c3f05c433097 0aa64a1c_efd8_a69d_48ed_649b7a86c854["get()"] 00cccf76_743c_3b0f_179f_c3f05c433097 -->|calls| 0aa64a1c_efd8_a69d_48ed_649b7a86c854 aad2b44f_7d63_9c23_fd06_f010fcd02b2b["error()"] 00cccf76_743c_3b0f_179f_c3f05c433097 -->|calls| aad2b44f_7d63_9c23_fd06_f010fcd02b2b style 00cccf76_743c_3b0f_179f_c3f05c433097 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