-
Notifications
You must be signed in to change notification settings - Fork 940
Memory-only Firestore build #2608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
860b649
a4a8856
2080ba8
0ed63b3
af52293
7121065
34c6f64
cce2ddd
9b4ef91
5d61740
9544744
e4a596c
df0b87c
09276a7
2ac9dfc
ce47ef8
37e1f0f
2a8e78a
de25f91
07ff26e
6a6ec47
53a4d12
df6a633
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* This file serves as the public entrypoint for users that import | ||
* `firebase/firestore/memory`. | ||
*/ | ||
|
||
import '../../../firestore/dist/index.memory.esm'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's still the case that looking at this file I can't tell why it exists, what bits of the build it interacts with, and whether or not I should use for anything when e.g. writing Firestore tests. I think this file is establishing the public interface to Firestore as seen when a user imports There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a short comment that explains this a little bit. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "firebase/firestore/memory", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this also have a description and a license and all those standard fields? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is modeled after the package.json files in firebase@next, but I believe you are right. @Feiyang1 should we add license/description fields? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no license needed for json files. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Descriptions added to this package.json and top-level package.json. |
||
"description": "A memory-only build of the Cloud Firestore JS SDK.", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.esm.js", | ||
"typings": "../../empty-import.d.ts", | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import firebase from '@firebase/app'; | ||
import { FirebaseNamespace } from '@firebase/app-types'; | ||
|
||
import { Firestore } from './src/api/database'; | ||
import { MemoryPersistenceProvider } from './src/local/memory_persistence'; | ||
import { configureForFirebase } from './src/platform/config'; | ||
|
||
import './register-module'; | ||
import './src/platform_browser/browser_init'; | ||
|
||
import { name, version } from './package.json'; | ||
|
||
/** | ||
* Registers the memory-only Firestore build with the components framework. | ||
*/ | ||
export function registerFirestore(instance: FirebaseNamespace): void { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done (here and elsewhere) |
||
configureForFirebase( | ||
instance, | ||
(app, auth) => new Firestore(app, auth, new MemoryPersistenceProvider()) | ||
); | ||
instance.registerVersion(name, version); | ||
} | ||
|
||
registerFirestore(firebase); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import firebase from '@firebase/app'; | ||
import { FirebaseNamespace } from '@firebase/app-types'; | ||
|
||
import { Firestore } from './src/api/database'; | ||
import { MemoryPersistenceProvider } from './src/local/memory_persistence'; | ||
import { configureForFirebase } from './src/platform/config'; | ||
import './register-module'; | ||
import './src/platform_node/node_init'; | ||
|
||
import { name, version } from './package.json'; | ||
|
||
/** | ||
* Registers the memory-only Firestore build for Node with the components | ||
* framework. | ||
*/ | ||
export function registerFirestore(instance: FirebaseNamespace): void { | ||
configureForFirebase( | ||
instance, | ||
(app, auth) => new Firestore(app, auth, new MemoryPersistenceProvider()) | ||
); | ||
instance.registerVersion(name, version); | ||
} | ||
|
||
registerFirestore(firebase); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "@firebase/firestore/memory", | ||
"description": "A memory-only build of the Cloud Firestore JS SDK.", | ||
"main": "../dist/index.memory.node.cjs.js", | ||
"browser": "../dist/index.memory.cjs.js", | ||
"module": "../dist/index.memory.esm.js", | ||
"esm2017": "../dist/index.memory.esm2017.js", | ||
"typings": "../dist/index.d.ts" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "@firebase/firestore", | ||
"version": "1.12.1", | ||
"description": "", | ||
"version": "1.11.2", | ||
"description": "The Cloud Firestore component of the Firebase JS SDK.", | ||
"author": "Firebase <[email protected]> (https://firebase.google.com/)", | ||
"scripts": { | ||
"prebuild": "tsc -d --downlevelIteration --declarationDir dist/lib --emitDeclarationOnly && tsc -m es2015 --moduleResolution node scripts/*.ts ", | ||
|
@@ -10,7 +10,7 @@ | |
"dev": "rollup -c -w", | ||
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", | ||
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", | ||
"prettier": "prettier --write 'src/**/*.js' 'test/**/*.js' 'src/**/*.ts' 'test/**/*.ts'", | ||
"prettier": "prettier --write '*.ts' '*.js' 'src/**/*.js' 'test/**/*.js' 'src/**/*.ts' 'test/**/*.ts'", | ||
"test": "run-s lint test:all", | ||
"test:all": "run-p test:browser test:travis test:minified", | ||
"test:browser": "karma start --single-run", | ||
|
@@ -20,7 +20,7 @@ | |
"test:node:persistence": "FIRESTORE_EMULATOR_PORT=8080 FIRESTORE_EMULATOR_PROJECT_ID=test-emulator USE_MOCK_PERSISTENCE=YES TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register --require index.node.ts --require test/util/node_persistence.ts --opts ../../config/mocha.node.opts", | ||
"test:node:persistence:prod": "USE_MOCK_PERSISTENCE=YES TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register --require index.node.ts --require test/util/node_persistence.ts --opts ../../config/mocha.node.opts", | ||
"test:travis": "ts-node --compiler-options='{\"module\":\"commonjs\"}' ../../scripts/emulator-testing/firestore-test-runner.ts", | ||
"test:minified": "(cd ../../integration/firestore ; yarn test:manual)", | ||
"test:minified": "(cd ../../integration/firestore ; yarn test)", | ||
"prepare": "yarn build" | ||
}, | ||
"main": "dist/index.node.cjs.js", | ||
|
@@ -29,7 +29,8 @@ | |
"esm2017": "dist/index.esm2017.js", | ||
"license": "Apache-2.0", | ||
"files": [ | ||
"dist" | ||
"dist", | ||
"memory/package.json" | ||
], | ||
"dependencies": { | ||
"@firebase/component": "0.1.7", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much like
yarn test
does everything, I think it's reasonable to still have ayarn build
that builds everything.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now,
gulp
uses the same output folder for both modes. This means that the builds overwrite each other. We can probably use different output folders, but this would require some extra plumbing. Let me know if this is something that you want me to do.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. I see. It's certainly not something to tackle in this PR. If gulp were better about doing incremental builds this could be worthwhile, but I suspect it's not going to actually buy us much or possibly even anything.