Skip to content

Commit bc82163

Browse files
committed
Deploy indexes before testing
Change-Id: If4f82672972ae44c0da46609f1b00bb6bee95fd0
1 parent 75aca05 commit bc82163

File tree

8 files changed

+150
-21
lines changed

8 files changed

+150
-21
lines changed

firestore/main/.gitignore

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
firebase-debug.log*
8+
9+
# Firebase cache
10+
.firebase/
11+
12+
# Firebase config
13+
14+
# Uncomment this if you'd like others to create their own Firebase project.
15+
# For a team working on the same Firebase project(s), it is recommended to leave
16+
# it commented so all members can deploy to the same project(s) in .firebaserc.
17+
# .firebaserc
18+
19+
# Runtime data
20+
pids
21+
*.pid
22+
*.seed
23+
*.pid.lock
24+
25+
# Directory for instrumented libs generated by jscoverage/JSCover
26+
lib-cov
27+
28+
# Coverage directory used by tools like istanbul
29+
coverage
30+
31+
# nyc test coverage
32+
.nyc_output
33+
34+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
35+
.grunt
36+
37+
# Bower dependency directory (https://bower.io/)
38+
bower_components
39+
40+
# node-waf configuration
41+
.lock-wscript
42+
43+
# Compiled binary addons (http://nodejs.org/api/addons.html)
44+
build/Release
45+
46+
# Dependency directories
47+
node_modules/
48+
49+
# Optional npm cache directory
50+
.npm
51+
52+
# Optional eslint cache
53+
.eslintcache
54+
55+
# Optional REPL history
56+
.node_repl_history
57+
58+
# Output of 'npm pack'
59+
*.tgz
60+
61+
# Yarn Integrity file
62+
.yarn-integrity
63+
64+
# dotenv environment variables file
65+
.env

firestore/main/firebase.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"firestore": {
3+
"rules": "firestore.rules",
4+
"indexes": "firestore.indexes.json"
5+
}
6+
}

firestore/main/firestore.indexes.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"indexes": [
3+
{
4+
"collectionGroup": "cities",
5+
"queryScope": "COLLECTION",
6+
"fields": [
7+
{
8+
"fieldPath": "name",
9+
"order": "ASCENDING"
10+
},
11+
{
12+
"fieldPath": "state",
13+
"order": "ASCENDING"
14+
}
15+
]
16+
}
17+
],
18+
"fieldOverrides": [
19+
{
20+
"collectionGroup": "landmarks",
21+
"fieldPath": "type",
22+
"indexes": [
23+
{
24+
"order": "ASCENDING",
25+
"queryScope": "COLLECTION"
26+
},
27+
{
28+
"order": "DESCENDING",
29+
"queryScope": "COLLECTION"
30+
},
31+
{
32+
"arrayConfig": "CONTAINS",
33+
"queryScope": "COLLECTION"
34+
},
35+
{
36+
"order": "ASCENDING",
37+
"queryScope": "COLLECTION_GROUP"
38+
}
39+
]
40+
}
41+
]
42+
}

firestore/main/firestore.rules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
service cloud.firestore {
2+
match /databases/{database}/documents {
3+
match /{document=**} {
4+
allow read, write;
5+
}
6+
}
7+
}

firestore/main/package-lock.json

Lines changed: 21 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

firestore/main/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7+
"setup-test": "GOOGLE_APPLICATION_CREDENTIALS=../../service-account.json firebase deploy --only firestore:indexes",
78
"test-debug": "env DEBUG=firestore-snippets-node mocha index.js",
89
"test": "env ./node_modules/.bin/mocha --timeout 20000 index.js"
910
},

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"license": "Apache-2.0",
77
"scripts": {
88
"lerna-test": "lerna run test",
9-
"lerna-bootstrap": "lerna bootstrap",
9+
"lerna-bootstrap": "lerna bootstrap && lerna run setup-test",
1010
"lint": "find . -type f -name \"*.js\" -not -path \"*node_modules*\" | xargs eslint"
1111
},
1212
"devDependencies": {

0 commit comments

Comments
 (0)