import * as fse from 'fs-extra' ; import * as path from 'path' ; import { tsConfigFileName , tsDefaultOutDir } from '../../../constants' ; import { IFunctionJson } from '../../../funcConfig/function' ; import { nonNullProp } from '../../../utils/nonNull' ; import { IScriptFunctionWizardContext } from './IScriptFunctionWizardContext' ; import { ScriptFunctionCreateStep } from './ScriptFunctionCreateStep' ; export class TypeScriptFunctionCreateStep extends ScriptFunctionCreateStep { protected async editFunctionJson ( context , functionJson ) { let outDir = tsDefaultOutDir ; try { const tsconfigPath = path . join ( context . projectPath , tsConfigFileName ) ; outDir = ( await fse . readJSON ( tsconfigPath ) ) . compilerOptions . outDir ; } catch { } functionJson . scriptFile = path . posix . join ( '..' , outDir , nonNullProp ( context , 'functionName' ) , 'index.js' ) ; } }