Skip to content

Commit aaf5202

Browse files
committed
Add compilation checks
1 parent af138b3 commit aaf5202

22 files changed

+212
-74
lines changed

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI Tests
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
env:
8+
CI: true
9+
10+
jobs:
11+
unit:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version:
16+
- 10.x
17+
steps:
18+
- uses: actions/checkout@v1
19+
- uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
23+
- name: Cache npm
24+
uses: actions/cache@v1
25+
with:
26+
path: ~/.npm
27+
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
28+
29+
- run: npm install
30+
31+
- name: "Lint and Test"
32+
run: ./scripts/test.sh

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
package-lock.json
2-
node_modules
2+
node_modules
3+
4+
tsconfig.json
5+
dist/

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ on [firebase.google.com](https://firebase.google.com/docs/).
66
## Contributing
77

88
We love contributions! See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
9+
10+
## Build Status
11+
12+
[![Actions Status][gh-actions-badge]][gh-actions]
13+
14+
[gh-actions]: https://github.com/firebase/snippets-web/actions
15+
[gh-actions-badge]: https://github.com/firebase/snippets-web/workflows/CI%20Tests/badge.svg

auth/link-multiple-accounts.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ function getProviders() {
3636
// [END auth_get_providers]
3737
}
3838

39-
function simpleLink() {
40-
// This is just a dummy variable for sample purposes, the other
41-
// snippets demonstrate how to get a real credential.
42-
var credential = new firebase.auth.AuthCredential();
43-
39+
function simpleLink(credential) {
4440
// [START auth_simple_link]
4541
auth.currentUser.linkWithCredential(credential)
4642
.then(function(usercred) {
@@ -52,11 +48,7 @@ function simpleLink() {
5248
// [END auth_simple_link]
5349
}
5450

55-
function anonymousLink() {
56-
// This is just a dummy variable for sample purposes, the other
57-
// snippets demonstrate how to get a real credential.
58-
var credential = new firebase.auth.AuthCredential();
59-
51+
function anonymousLink(credential) {
6052
// [START auth_anonymous_link]
6153
auth.currentUser.linkWithCredential(credential)
6254
.then(function(usercred) {
@@ -108,11 +100,7 @@ function linkWithRedirect() {
108100
// [END auth_get_redirect_result]
109101
}
110102

111-
function mergeAccounts() {
112-
// This is just a dummy variable for sample purposes, the other
113-
// snippets demonstrate how to get a real credential.
114-
var newCredential = new firebase.auth.AuthCredential();
115-
103+
function mergeAccounts(newCredential) {
116104
// [START auth_merge_accounts]
117105
// The implementation of how you store your user data depends on your application
118106
var repo = new MyUserDataRepo();
@@ -150,7 +138,6 @@ function mergeAccounts() {
150138
// If there are errors we want to undo the data merge/deletion
151139
console.log("Sign In Error", error);
152140
repo.set(prevUser, prevUserData);
153-
repo.set(currentUser, currentUserData);
154141
});
155142
// [END auth_merge_accounts]
156143
}
@@ -164,7 +151,7 @@ function makeEmailCredential() {
164151
// [END auth_make_email_credential]
165152
}
166153

167-
function unlink() {
154+
function unlink(providerId) {
168155
var user = auth.currentUser;
169156

170157
// [START auth_unlink_provider]

auth/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"name": "auth",
33
"version": "1.0.0",
4-
"scripts": {},
4+
"scripts": {
5+
"compile": "cp ../tsconfig.json.template ./tsconfig.json && tsc"
6+
},
57
"license": "Apache 2.0",
68
"dependencies": {
79
"firebase": "^7.12.0"

database/emulator-suite.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11

2-
function onDocumentReady(firebase) {
2+
// These samples are intended for Web so this import would normally be
3+
// done in HTML however using modules here is more convenient for
4+
// ensuring sample correctness offline.
5+
var firebase = require("firebase/app");
6+
require("firebase/database");
37

8+
function onDocumentReady(firebase) {
49
//[START rtdb_emulator_connect]
510
if (location.hostname === "localhost") {
611

database/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "database",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"compile": "cp ../tsconfig.json.template ./tsconfig.json && tsc"
6+
},
7+
"license": "Apache 2.0",
8+
"dependencies": {
9+
"firebase": "^7.12.0"
10+
}
11+
}

database/read-and-write.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// These samples are intended for Web so this import would normally be
2+
// done in HTML however using modules here is more convenient for
3+
// ensuring sample correctness offline.
4+
var firebase = require("firebase/app");
5+
require("firebase/database");
6+
17
// [START rtdb_write_new_user]
28
function writeUserData(userId, name, email, imageUrl) {
39
firebase.database().ref('users/' + userId).set({

firebaseapp/firebaseapp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var firebase = require('@firebase/app');
1+
var firebase = require('firebase/app');
22

33
function multpleFirebaseApps() {
44
// [START firebase_options]
@@ -21,4 +21,4 @@ function multpleFirebaseApps() {
2121
// Access services, such as the Realtime Database
2222
// secondaryApp.database();
2323
// [END firebase_secondary]
24-
}
24+
}

firebaseapp/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"name": "firebaseapp",
33
"version": "1.0.0",
4-
"scripts": {},
4+
"scripts": {
5+
"compile": "cp ../tsconfig.json.template ./tsconfig.json && tsc"
6+
},
57
"license": "Apache-2.0",
68
"dependencies": {
79
"firebase": "^7.9.2"

0 commit comments

Comments
 (0)