import { banner } from "../lib" ; import { spawnOrFail } from "../utils/cmd-utils" ; import { installUpgrade } from "../utils/npm-utils" ; export async function installCodegenDeps ( opts ) { const { projectPath } = opts ; return ( ( await installUpgrade ( "@plasmicapp/cli" , { workingDir : projectPath } ) ) && ( await installUpgrade ( "@plasmicapp/host" , { workingDir : projectPath } ) ) ) ; } export async function runCodegenSync ( opts ) { const { projectId , projectApiToken , projectPath } = opts ; banner ( "SYNCING PLASMIC COMPONENTS" ) ; const project = projectApiToken ? `${ projectId }:${ projectApiToken }` : projectId ; await spawnOrFail ( `npx -p @plasmicapp/cli plasmic sync --yes -p ${ project }` , projectPath ) ; }