Dashes in folder names cause initialization crash
Describe the bug
If you name a folder with dashes in it, the dash is converted to a dot (.) by the FunctionParser class. This was while testing a reactive function not a restful endpoint.
To Reproduce
Bad structure:

Good Structure:

In order to see the difference in the generated exports, I modified my index.ts file. If you run the firebase emulator and do something to invoke a reactive function, you'll see the difference. Make one function's folder have a dash in the name and another without to compare logs.
// index.ts
import * as admin from 'firebase-admin';
import { FunctionParser } from 'firebase-backend';
admin.initializeApp();
const exportsTmp = new FunctionParser({
rootPath: __dirname,
exports: exports,
verbose: true,
}).exports;
console.log('exportsTmp', exportsTmp);
exports = exportsTmp;
const backendVersion = 'v1';
const separator = '_';
for (const key in exports) {
if (Object.prototype.hasOwnProperty.call(exports, key)) {
const newKey = `${backendVersion}${separator}${key}`;
console.log('key', key);
console.log('newKey', newKey);
exports[newKey] = exports[key];
delete exports[key];
}
}
Expected behavior Dashes should be converted to camel-case.
Screenshots See above.
Additional context Keep it up @FilledStacks!
Thanks for filing the issue.
I don't know if we should support a structure we don't want to promote. Js uses camel case so I don't think it's important to supply conversions from kebab case. If you want to do it you can submit a PR, I'll happily include it. But it's not something that I'll be adding.