import * as path from "path" ; import { Runtime , ProjectBuild , RuntimeLogLevels } from "@codotype/core" ; import { OUTPUT_DIRECTORY , CODOTYPE_ARTIFACTS_DIRECTORY } from "../constants" ; param param . cwd see RuntimeProps . cwd param param . runtime see CodotypeRuntime param param . build see ProjectBuild export async function prepareProjectBuildDestination ( params ) { const { runtime , cwd , build } = params ; runtime . log ( "Writing build manfiest" , { level : RuntimeLogLevels . verbose , } ) ; let buildID = build . id || "" ; const destRoot = path . join ( cwd , OUTPUT_DIRECTORY , buildID , build . projectInput . identifiers . snake ) ; await runtime . ensureDir ( destRoot ) ; const manifestDest = path . join ( destRoot , CODOTYPE_ARTIFACTS_DIRECTORY ) ; await runtime . ensureDir ( manifestDest ) ; return new Promise < void > ( ( resolve ) => { const projectFilename = `${ build . projectInput . identifiers . kebab }-codotype-project.json` ; runtime . writeFile ( path . join ( `${ manifestDest }/${ projectFilename }` ) , JSON . stringify ( build . projectInput , null , 2 ) ) ; runtime . log ( "Wrote codotype-project.json" , { level : RuntimeLogLevels . verbose , } ) ; return resolve ( ) ; } ) ; }