Files
firebase-tools/templates/init/functions/javascript/index.js
Thomas Bouldin 3d8da0c766 Add support for TypeScript when initializing Cloud Functions. (#239)
Add support for TypeScript when initializing Cloud Functions.

Meets agreed upon UX and implements the "optional" feature of linter support. Refactors
the functions.js into 3 different files: initalization for all languages, an NPM install helper
for all NPM based runtimes, and the JS implmentation. Then adds support for TypeScript along with
JavaScript. TypeScript adds a predeploy command to ensure TypeScript is always compiled before deploy.

I did a first pass on linter rules based on the full list on the tslint website. These are definitely open for discussion.

I'm curious whether we should add "(Experimental)" to the list when choosing TypeScript. There's a chance we will want to
change project structure or lint rules in the future and this could be seen as breaking. And as mentioend offline, there's
a wart that we didn't consider how this feature should work with the emulator either.

In general I want to chat a bit about ideal project structure. I'm worried that this is hard to add tests with the project
layout that we use in the firebase-functions codebase. I'm considering that maybe both should have SxS foo.ts and foo.spec.ts.
This would fix our use of a .tmp directory that has both "src" and "spec" inside it whereas production files are only in "lib".
If we were to do this, I might also recommend adding a ".npmignore" file and making the functions deploy process honor it. Since
we're already shipping unit tests I can't see this being a blocker for release.
2017-10-31 01:30:20 -07:00

9 lines
303 B
JavaScript

const functions = require('firebase-functions');
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
// exports.helloWorld = functions.https.onRequest((request, response) => {
// response.send("Hello from Firebase!");
// });