-
Notifications
You must be signed in to change notification settings - Fork 955
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Overhaul ext:dev:init * Lint and changelog * Typo fix
- Loading branch information
Showing
14 changed files
with
172 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GREETING=Hello | ||
LOCATION=us-central1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"emulators": { | ||
"functions": { | ||
"port": 5001 | ||
}, | ||
"ui": { | ||
"enabled": true | ||
}, | ||
"singleProjectMode": true | ||
}, | ||
"extensions": { | ||
"greet-the-world": "../.." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
This directory now contains the source files for a simple extension called **greet-the-world**. To try out this extension right away, install it in an existing Firebase project by running: | ||
This directory now contains the source files for a simple extension called **greet-the-world**. You can try it out right away in the Firebase Emulator suite - just naviagte to the integration-test directory and run: | ||
|
||
`firebase ext:install . --project=<project-id>` | ||
`firebase emulators:start --project=<project-id>` | ||
|
||
If you want to jump into the code to customize your extension, then modify **index.js** and **extension.yaml** in your favorite editor. When you're ready to try out your fancy new extension, run: | ||
If you don't have a project to use, you can instead use '--project=demo-test' to run against a fake project. | ||
|
||
`firebase ext:install . --project=<project-id>` | ||
The `integration-test` directory also includes an end to end test (in the file integration-test.spec.js) that verifies that the extension responds back with the expected greeting. You can see it in action by running: | ||
|
||
As always, in the docs, you can find detailed instructions for creating and testing your extension (including using the emulator!). | ||
`npm run test` | ||
|
||
If you want to jump into the code to customize your extension, then modify **index.js** and **extension.yaml** in your favorite editor. | ||
|
||
If you want to deploy your extension to test on a real project, go to a Firebase project directory (or create a new one with `firebase init`) and run: | ||
|
||
`firebase ext:install ./path/to/extension/directory --project=<project-id>` | ||
`firebase deploy --only extensions` | ||
|
||
You can find more information about building extensions in the publisher docs: https://firebase.google.com/docs/extensions/alpha/overview-build-extensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const axios = require("axios"); | ||
const chai = require("chai"); | ||
|
||
describe("greet-the-world", () => { | ||
it("should respond with the configured greeting", async () => { | ||
const expected = "Hello World from greet-the-world"; | ||
|
||
const httpFunctionUri = "http://localhost:5001/demo-test/us-central1/ext-greet-the-world-greetTheWorld/"; | ||
const res = await axios.get(httpFunctionUri); | ||
|
||
return chai.expect(res.data).to.eql(expected); | ||
}).timeout(10000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
This directory now contains the source files for a simple extension called **greet-the-world**. To try out this extension right away, install it in an existing Firebase project by running: | ||
This directory now contains the source files for a simple extension called **greet-the-world**. You can try it out right away in the Firebase Emulator suite: first, compile your code by running: | ||
|
||
`npm run build --prefix=functions && firebase ext:install . --project=<project-id>` | ||
`npm run build --prefix=functions` | ||
|
||
If you want to jump into the code to customize your extension, then modify **index.ts** and **extension.yaml** in your favorite editor. When you're ready to try out your fancy new extension, run: | ||
Then, navigate to the `functions/integration-test` directory and run: | ||
|
||
`npm run build --prefix=functions && firebase ext:install . --project=<project-id>` | ||
`firebase emulators:start --project=<project-id>` | ||
|
||
As always, in the docs, you can find detailed instructions for creating and testing your extension (including using the emulator!). | ||
If you don't have a project to use, you can instead use '--project=demo-test' to run against a fake project. | ||
|
||
The `integration-test` directory also includes an end to end test (in the file **integration-test.spec.ts**) that verifies that the extension responds back with the expected greeting. You can see it in action by running: | ||
|
||
`npm run test` | ||
|
||
If you want to jump into the code to customize your extension, then modify **index.ts** and **extension.yaml** in your favorite editor. | ||
|
||
If you want to deploy your extension to test on a real project, go to a Firebase project directory (or create a new one with `firebase init`) and run: | ||
|
||
`firebase ext:install ./path/to/extension/directory --project=<project-id>` | ||
`firebase deploy --only extensions` | ||
|
||
You can find more information about building extensions in the publisher docs: https://firebase.google.com/docs/extensions/alpha/overview-build-extensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"require": "ts-node/register", | ||
"extensions": ["ts", "tsx"], | ||
"spec": [ | ||
"integration-tests/**/*.spec.*" | ||
], | ||
"watch-files": [ | ||
"src" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import axios from "axios"; | ||
import { expect } from "chai"; | ||
|
||
describe("greet-the-world", () => { | ||
it("should respond with the configured greeting", async () => { | ||
const expected = "Hello World from greet-the-world"; | ||
|
||
const httpFunctionUri = "http://localhost:5001/demo-test/us-central1/ext-greet-the-world-greetTheWorld/"; | ||
const res = await axios.get(httpFunctionUri); | ||
|
||
return expect(res.data).to.eql(expected); | ||
}).timeout(10000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters