Skip to content

Commit e3848e8

Browse files
committed
Updated readme and logging
1 parent bffe9dd commit e3848e8

File tree

7 files changed

+103
-11
lines changed

7 files changed

+103
-11
lines changed

packages/data-connect/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Firebase Data Connect
2+
3+
## Local Development
4+
5+
Check `test/dataconnect.yaml` to ensure that the correct values are filled in.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "jscore-sandbox-141b5"
4+
}
5+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
firebase-debug.log*
8+
firebase-debug.*.log*
9+
10+
# Firebase cache
11+
.firebase/
12+
13+
# Firebase config
14+
15+
# Uncomment this if you'd like others to create their own Firebase project.
16+
# For a team working on the same Firebase project(s), it is recommended to leave
17+
# it commented so all members can deploy to the same project(s) in .firebaserc.
18+
# .firebaserc
19+
20+
# Runtime data
21+
pids
22+
*.pid
23+
*.seed
24+
*.pid.lock
25+
26+
# Directory for instrumented libs generated by jscoverage/JSCover
27+
lib-cov
28+
29+
# Coverage directory used by tools like istanbul
30+
coverage
31+
32+
# nyc test coverage
33+
.nyc_output
34+
35+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36+
.grunt
37+
38+
# Bower dependency directory (https://bower.io/)
39+
bower_components
40+
41+
# node-waf configuration
42+
.lock-wscript
43+
44+
# Compiled binary addons (http://nodejs.org/api/addons.html)
45+
build/Release
46+
47+
# Dependency directories
48+
node_modules/
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Optional REPL history
57+
.node_repl_history
58+
59+
# Output of 'npm pack'
60+
*.tgz
61+
62+
# Yarn Integrity file
63+
.yarn-integrity
64+
65+
# dotenv environment variables file
66+
.env
67+
68+
# dataconnect generated files
69+
.dataconnect
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
connectorId: "movies"
1+
connectorId: "tests"
22
authMode: "PUBLIC"
33
generate:
44
javascriptSdk:
55
outputDir: "./gen/web"
6-
package: "@movie-app-ssr/movies"
6+
package: "@test-app/tests"
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
specVersion: "v1beta"
2-
serviceId: "dataconnect"
2+
serviceId: "fdc-service"
33
location: "us-west2"
44
schema:
55
source: "./schema"
66
datasource:
77
postgresql:
8-
database: "dataconnect-test"
8+
database: "tests"
99
cloudSql:
10-
instanceId: "local"
10+
instanceId: "prod"
11+
# schemaValidation: "COMPATIBLE"
1112
connectorDirs: ["./connector"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"emulators": {
3+
"dataconnect": {
4+
"dataDir": "dataconnect/.dataconnect/pgliteData"
5+
}
6+
},
7+
"dataconnect": {
8+
"source": "dataconnect"
9+
}
10+
}

packages/data-connect/test/util.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ import {
2424
getDataConnect
2525
} from '../src';
2626

27-
export const USE_EMULATOR = true;
2827
export const EMULATOR_PORT = process.env.DC_EMULATOR_PORT;
29-
// export const EMULATOR_PROJECT = process.env.PROJECT;
30-
export const CONNECTOR_NAME = 'movies'; // TODO(mtewani): Rename this and connector.yaml
28+
const USE_EMULATOR = !!EMULATOR_PORT;
29+
export const CONNECTOR_NAME = 'tests';
3130
export const LOCATION_NAME = 'us-west2';
32-
export const SERVICE_NAME = 'dataconnect';
33-
export const PROJECT_ID = 'p';
31+
export const SERVICE_NAME = 'fdc-service';
32+
export const PROJECT_ID = USE_EMULATOR ? 'p' : 'jscore-sandbox-141b5';
3433
export function getConnectionConfig(): ConnectorConfig {
3534
return {
3635
connector: CONNECTOR_NAME,
@@ -46,8 +45,11 @@ export const app = initializeApp({
4645
// Seed the database to have the proper fields to query, such as a list of tasks.
4746
export function initDatabase(): DataConnect {
4847
const instance = getDataConnect(getConnectionConfig());
49-
if(EMULATOR_PORT !== undefined) {
48+
if (USE_EMULATOR) {
5049
connectDataConnectEmulator(instance, 'localhost', Number(EMULATOR_PORT));
50+
} else {
51+
// eslint-disable-next-line no-console
52+
console.log('not running emulator');
5153
}
5254
return instance;
5355
}

0 commit comments

Comments
 (0)