We are facing an issue with Firebase Functions, using a typescript code base. Our monorepo includes a separate library, also in typescript, which imports types and interfaces via symlinks (yarn workspace) and annotates the files using them.
Our goal is to utilize this library for common utility functions and then transfer a version of it to the 'functions' directory of cloud functions before each deployment. This process avoids the manual copying of the monorepo folder into it every time.
Due to the limitations of monorepo / symlinks not working with cloud functions, as it requires all code to be within your functions folder or on npm as a package, we cannot publish part of our code base publicly.
The challenge at hand is compiling our utilities package, which has typescript annotations imported from another 'interfaces' library, into raw typescript files without these annotations or type/interface imports. This step is necessary since firebase functions cannot import them if left as is.
To clarify, consider the following:
function.ts
const { MyInterface } = require('interfaces');
const myFunction = (foo: MyInterface) => bar;
Our objective is to create a stripped file without annotations or type/interface imports:
function.ts (stripped)
const myFunction = (foo) => bar;
Any assistance on this matter would be highly appreciated. Thank you.