import { writeFile } from 'fs-extra' ; import { Org , Project , ProjectLink } from '../../types' ; import { getLinkFromDir , VERCEL_DIR , VERCEL_DIR_PROJECT } from './link' ; import { join } from 'path' ; export type ProjectLinkAndSettings = ProjectLink & { settings : { buildCommand : Project [ 'buildCommand' ] ; devCommand : Project [ 'devCommand' ] ; outputDirectory : Project [ 'outputDirectory' ] ; directoryListing : Project [ 'directoryListing' ] ; rootDirectory : Project [ 'rootDirectory' ] ; framework : Project [ 'framework' ] ; } ; } ; export async function writeProjectSettings ( cwd , project , org ) { return await writeFile ( join ( cwd , VERCEL_DIR , VERCEL_DIR_PROJECT ) , JSON . stringify ( { projectId : project . id , orgId : org . id , settings : { buildCommand : project . buildCommand , devCommand : project . devCommand , outputDirectory : project . outputDirectory , directoryListing : project . directoryListing , rootDirectory : project . rootDirectory , framework : project . framework , } , } ) ) ; } export async function readProjectSettings ( cwd ) { return await getLinkFromDir < ProjectLinkAndSettings > ( cwd ) ; }