The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix wrong serverless handelrPath (#15675)
martmulld1224e1c7873
diff --git a/packages/twenty-cli/src/utils/load-manifest.ts b/packages/twenty-cli/src/utils/load-manifest.tsindex 121018e614b..c12a307f161 100644--- a/packages/twenty-cli/src/utils/load-manifest.ts+++ b/packages/twenty-cli/src/utils/load-manifest.ts@@ -57,11 +57,10 @@ type JSONValue =| { [k: string]: JSONValue };const getProgramFromTsconfig = (- appPath?: string,+ appPath: string,tsconfigPath = 'tsconfig.json',) => {- const basePath = appPath ?? process.cwd();- const configFile = readConfigFile(join(basePath, tsconfigPath), sys.readFile);+ const configFile = readConfigFile(join(appPath, tsconfigPath), sys.readFile);if (configFile.error)throw new Error(formatDiagnosticsWithColorAndContext([configFile.error], {@@ -70,7 +69,7 @@ const getProgramFromTsconfig = (getNewLine: () => sys.newLine,}),);- const parsed = parseJsonConfigFileContent(configFile.config, sys, basePath);+ const parsed = parseJsonConfigFileContent(configFile.config, sys, appPath);if (parsed.errors.length) {throw new Error(formatDiagnosticsWithColorAndContext(parsed.errors, {@@ -358,13 +357,13 @@ const findHandlerAndConfig = (};};-const posixRelativeFromCwd = (absPath: string) => {- const rel = relative(process.cwd(), absPath);+const posixRelativeFromCwd = (fileName: string, appPath: string) => {+ const rel = relative(appPath, fileName);// normalize to posix separators for portability / manifest stabilityreturn rel.split(sep).join(posix.sep);};-const collectServerlessFunctions = (program: Program) => {+const collectServerlessFunctions = (program: Program, appPath: string) => {const serverlessFunctions: ServerlessFunctionManifest[] = [];for (const sf of program.getSourceFiles()) {@@ -373,7 +372,7 @@ const collectServerlessFunctions = (program: Program) => {try {const { handlerName, configObject } = findHandlerAndConfig(sf);- const handlerPath = posixRelativeFromCwd(sf.fileName);+ const handlerPath = posixRelativeFromCwd(sf.fileName, appPath);serverlessFunctions.push({...configObject,@@ -516,7 +515,7 @@ export const loadManifest = async (const [objects, serverlessFunctions, application, sources] =await Promise.all([Promise.resolve(collectObjects(program)),- Promise.resolve(collectServerlessFunctions(program)),+ Promise.resolve(collectServerlessFunctions(program, appPath)),Promise.resolve(extractTwentyAppConfig(program)),loadFolderContentIntoJson(appPath),]);diff --git a/packages/twenty-cli/tsconfig.json b/packages/twenty-cli/tsconfig.jsonindex e48d23f545c..1de5590dcb5 100644--- a/packages/twenty-cli/tsconfig.json+++ b/packages/twenty-cli/tsconfig.json@@ -5,4 +5,4 @@},"include": ["src/**/*"],"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts", "**/*.e2e-spec.ts", "**/__tests__/**"]-}\ No newline at end of file+}