-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
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.
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!
Metadata
Metadata
Assignees
Labels
No labels

