import { constants } from '@create-figma-plugin/common' ; import { exec , ExecException } from 'child_process' ; import { findUp } from 'find-up' ; import { join } from 'path' ; export async function buildCssModulesTypingsAsync ( ) { const tcm = await findUp ( join ( 'node_modules' , '.bin' , 'tcm' ) ) ; if ( typeof tcm === 'undefined' ) { throw new Error ( 'Cannot find `tcm`' ) ; } return new Promise ( function ( resolve , reject ) { exec ( `"${ tcm }" ${ constants . build . srcDirectoryName }` , function ( error ) { if ( error !== null ) { reject ( error ) ; return ; } resolve ( ) ; } ) ; } ) ; }