Skip to content

Commit

Permalink
(Feat) [email protected]: Support for breaking changes in Firebase 8.0 (#35
Browse files Browse the repository at this point in the history
)

* 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]>
  • Loading branch information
Shubham567 and 0xTheProDev authored Aug 3, 2021
1 parent 8dc0b65 commit 03910ce
Show file tree
Hide file tree
Showing 9 changed files with 338 additions and 697 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ Good to have: commit or PR links.
-->

## v0.2.0 [#35](https://github.com/interviewstreet/firepad-x/pull/35)

### Changed

- Updated peer dependency from `[email protected]` to `[email protected]`.
- No breaking change on API level.
- Improve `README.md` with a beginner friendly guide as well.

### Fixes

- Fixed the issue when using firebase from regions other than US would throw [error](https://stackoverflow.com/a/66387384/8556127).
[solution](https://stackoverflow.com/questions/64545862/upgrade-to-firebase-js-8-0-0-attempted-import-error-app-is-not-exported-from/64545863).

## v0.1.1 - [#30](https://github.com/interviewstreet/firepad-x/pull/24)

### Fixes
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ class MyEditorAdapter implements IEditorAdapter {

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.

### Dispose

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.

```ts
...

const firepad = new Firepad(databaseAdapter, editorAdapter, options);

...

firepad.dispose();
```

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).

## Development

We have used [`yarn`](https://yarnpkg.com/) as our package manager through out the project.
Expand Down
2 changes: 1 addition & 1 deletion examples/firepad-monaco-example.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as monaco from "monaco-editor";
import * as firebase from "firebase/app";
import firebase from "firebase/app";
import "firebase/database";

import * as Firepad from "../src";
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hackerrank/firepad",
"description": "Collaborative text editing powered by Firebase",
"version": "0.1.1",
"version": "0.2.0",
"author": {
"email": "[email protected]",
"name": "Progyan Bhattacharya",
Expand All @@ -11,7 +11,8 @@
"Michael Lehenbauer <[email protected]>",
"Brijesh Bittu <[email protected]>",
"Nishchay Kaushik <[email protected]>",
"Mohanasundar <[email protected]>"
"Mohanasundar <[email protected]>",
"Shubham Shekhar <[email protected]>"
],
"maintainers": [
{
Expand Down Expand Up @@ -54,7 +55,7 @@
"node": ">= 10.17.0"
},
"peerDependencies": {
"firebase": "7.12.0",
"firebase": "8.8.1",
"monaco-editor": "0.18.1"
},
"dependencies": {
Expand All @@ -73,7 +74,7 @@
"child-process-promise": "2.2.1",
"core-js": "3.11.0",
"css-loader": "5.2.4",
"firebase": "7.12.0",
"firebase": "8.8.1",
"git-format-staged": "2.1.1",
"husky": "6.0.0",
"jest": "27.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/firebase-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "firebase/database";

import * as firebase from "firebase/app";
import firebase from "firebase/app";

import { CursorType, ICursor } from "./cursor";
import {
Expand Down
6 changes: 3 additions & 3 deletions src/firepad-classic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Firebase from "firebase";
import firebase from "firebase";
import * as monaco from "monaco-editor";

import { Cursor } from "./cursor";
Expand Down Expand Up @@ -49,7 +49,7 @@ export default class FirepadClassic implements IFirepad {
* @param options - Firepad constructor options (optional).
*/
constructor(
databaseRef: Firebase.database.Reference,
databaseRef: firebase.database.Reference,
editor: monaco.editor.IStandaloneCodeEditor,
options: IFirepadClassicConstructorOptions = {}
) {
Expand Down Expand Up @@ -223,7 +223,7 @@ export default class FirepadClassic implements IFirepad {
* @param options - Firepad constructor options (optional).
*/
static fromMonaco(
databaseRef: Firebase.database.Reference,
databaseRef: firebase.database.Reference,
editor: monaco.editor.IStandaloneCodeEditor,
options?: IFirepadClassicConstructorOptions
) {
Expand Down
1 change: 1 addition & 0 deletions src/firepad-monaco.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import firebase from "firebase";
import * as monaco from "monaco-editor";
import { v4 as uuid } from "uuid";

Expand Down
1 change: 1 addition & 0 deletions test/firepad-monaco.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import firebase from "firebase";
import { editor } from "monaco-editor";
import { fromMonaco } from "../src/firepad-monaco";
import { getDatabaseAdapter, getEditorAdapter } from "./factory";
Expand Down
Loading

0 comments on commit 03910ce

Please sign in to comment.