Skip to content

Commit 03910ce

Browse files
(Feat) [email protected]: Support for breaking changes in Firebase 8.0 (#35)
* Fix for breaking changes in Firebase 8.0 https://stackoverflow.com/questions/64545862/upgrade-to-firebase-js-8-0-0-attempted-import-error-app-is-not-exported-from/64545863 * Update readme and changelog for v1.0.0 also updated peerDependency and devDependency in package.json * updated readme for typo * (chore) Build: Update Build Configs and Example for Upgrade Co-authored-by: Progyan Bhattacharya <[email protected]> Signed-off-by: Progyan Bhattacharya <[email protected]>
1 parent 8dc0b65 commit 03910ce

9 files changed

+338
-697
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ Good to have: commit or PR links.
2222
2323
-->
2424

25+
## v0.2.0 [#35](https://github.com/interviewstreet/firepad-x/pull/35)
26+
27+
### Changed
28+
29+
- Updated peer dependency from `[email protected]` to `[email protected]`.
30+
- No breaking change on API level.
31+
- Improve `README.md` with a beginner friendly guide as well.
32+
33+
### Fixes
34+
35+
- Fixed the issue when using firebase from regions other than US would throw [error](https://stackoverflow.com/a/66387384/8556127).
36+
[solution](https://stackoverflow.com/questions/64545862/upgrade-to-firebase-js-8-0-0-attempted-import-error-app-is-not-exported-from/64545863).
37+
2538
## v0.1.1 - [#30](https://github.com/interviewstreet/firepad-x/pull/24)
2639

2740
### Fixes

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,22 @@ class MyEditorAdapter implements IEditorAdapter {
8888

8989
Similar thing can be done for Database as well by implementing `IDatabaseAdapter` interface. Keep in mind, you might also need to implement event handlers and event triggers depending upon nature of the adapters.
9090

91+
### Dispose
92+
93+
After Firepad usecase is over, it is recommended to cleanup all the resources (e.g., memory, network etc.) using `dispose()` method. Note that, making any further API call after calling `dispose()` will result into error.
94+
95+
```ts
96+
...
97+
98+
const firepad = new Firepad(databaseAdapter, editorAdapter, options);
99+
100+
...
101+
102+
firepad.dispose();
103+
```
104+
105+
Here is a beginner friendly guide on [How to setup Collaborative Editor Experience with Monaco Editor and Firebase](https://dev.to/shubham567/collaborative-coding-in-monaco-editor-4foa).
106+
91107
## Development
92108

93109
We have used [`yarn`](https://yarnpkg.com/) as our package manager through out the project.

examples/firepad-monaco-example.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as monaco from "monaco-editor";
2-
import * as firebase from "firebase/app";
2+
import firebase from "firebase/app";
33
import "firebase/database";
44

55
import * as Firepad from "../src";

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@hackerrank/firepad",
33
"description": "Collaborative text editing powered by Firebase",
4-
"version": "0.1.1",
4+
"version": "0.2.0",
55
"author": {
66
"email": "[email protected]",
77
"name": "Progyan Bhattacharya",
@@ -11,7 +11,8 @@
1111
"Michael Lehenbauer <[email protected]>",
1212
"Brijesh Bittu <[email protected]>",
1313
"Nishchay Kaushik <[email protected]>",
14-
"Mohanasundar <[email protected]>"
14+
"Mohanasundar <[email protected]>",
15+
"Shubham Shekhar <[email protected]>"
1516
],
1617
"maintainers": [
1718
{
@@ -54,7 +55,7 @@
5455
"node": ">= 10.17.0"
5556
},
5657
"peerDependencies": {
57-
"firebase": "7.12.0",
58+
"firebase": "8.8.1",
5859
"monaco-editor": "0.18.1"
5960
},
6061
"dependencies": {
@@ -73,7 +74,7 @@
7374
"child-process-promise": "2.2.1",
7475
"core-js": "3.11.0",
7576
"css-loader": "5.2.4",
76-
"firebase": "7.12.0",
77+
"firebase": "8.8.1",
7778
"git-format-staged": "2.1.1",
7879
"husky": "6.0.0",
7980
"jest": "27.0.3",

src/firebase-adapter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import "firebase/database";
22

3-
import * as firebase from "firebase/app";
3+
import firebase from "firebase/app";
44

55
import { CursorType, ICursor } from "./cursor";
66
import {

src/firepad-classic.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as Firebase from "firebase";
1+
import firebase from "firebase";
22
import * as monaco from "monaco-editor";
33

44
import { Cursor } from "./cursor";
@@ -49,7 +49,7 @@ export default class FirepadClassic implements IFirepad {
4949
* @param options - Firepad constructor options (optional).
5050
*/
5151
constructor(
52-
databaseRef: Firebase.database.Reference,
52+
databaseRef: firebase.database.Reference,
5353
editor: monaco.editor.IStandaloneCodeEditor,
5454
options: IFirepadClassicConstructorOptions = {}
5555
) {
@@ -223,7 +223,7 @@ export default class FirepadClassic implements IFirepad {
223223
* @param options - Firepad constructor options (optional).
224224
*/
225225
static fromMonaco(
226-
databaseRef: Firebase.database.Reference,
226+
databaseRef: firebase.database.Reference,
227227
editor: monaco.editor.IStandaloneCodeEditor,
228228
options?: IFirepadClassicConstructorOptions
229229
) {

src/firepad-monaco.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import firebase from "firebase";
12
import * as monaco from "monaco-editor";
23
import { v4 as uuid } from "uuid";
34

test/firepad-monaco.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import firebase from "firebase";
12
import { editor } from "monaco-editor";
23
import { fromMonaco } from "../src/firepad-monaco";
34
import { getDatabaseAdapter, getEditorAdapter } from "./factory";

0 commit comments

Comments
 (0)