Skip to content

Commit bbd8164

Browse files
committed
🎉 initial commit
0 parents  commit bbd8164

13 files changed

+2912
-0
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/bower_components/
2+
/node_modules/
3+
/.pulp-cache/
4+
/output/
5+
/generated-docs/
6+
/.psc-package/
7+
/.psc*
8+
/.purs*
9+
/.psa*
10+
/.spago

.vscode/settings.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"purescript.addNpmPath": true,
3+
"purescript.addPscPackageSources": true,
4+
"purescript.addSpagoSources": true,
5+
"purescript.buildCommand": "spago build --purs-args \"--json-errors\"",
6+
"purescript.formatter": "purs-tidy",
7+
"[purescript]": {
8+
"editor.formatOnSave": true
9+
}
10+
}

package.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "purescript-firebase",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"repository": "https://github.com/codingedgar/purescript-firebase.git",
6+
"author": "codingedgar <[email protected]>",
7+
"license": "MIT",
8+
"dependencies": {
9+
"firebase": "9.9.2"
10+
},
11+
"devDependencies": {
12+
"purs-tidy": "0.9.1"
13+
}
14+
}

packages.dhall

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{-
2+
Welcome to your new Dhall package-set!
3+
4+
Below are instructions for how to edit this file for most use
5+
cases, so that you don't need to know Dhall to use it.
6+
7+
## Use Cases
8+
9+
Most will want to do one or both of these options:
10+
1. Override/Patch a package's dependency
11+
2. Add a package not already in the default package set
12+
13+
This file will continue to work whether you use one or both options.
14+
Instructions for each option are explained below.
15+
16+
### Overriding/Patching a package
17+
18+
Purpose:
19+
- Change a package's dependency to a newer/older release than the
20+
default package set's release
21+
- Use your own modified version of some dependency that may
22+
include new API, changed API, removed API by
23+
using your custom git repo of the library rather than
24+
the package set's repo
25+
26+
Syntax:
27+
where `entityName` is one of the following:
28+
- dependencies
29+
- repo
30+
- version
31+
-------------------------------
32+
let upstream = --
33+
in upstream
34+
with packageName.entityName = "new value"
35+
-------------------------------
36+
37+
Example:
38+
-------------------------------
39+
let upstream = --
40+
in upstream
41+
with halogen.version = "master"
42+
with halogen.repo = "https://example.com/path/to/git/repo.git"
43+
44+
with halogen-vdom.version = "v4.0.0"
45+
with halogen-vdom.dependencies = [ "extra-dependency" ] # halogen-vdom.dependencies
46+
-------------------------------
47+
48+
### Additions
49+
50+
Purpose:
51+
- Add packages that aren't already included in the default package set
52+
53+
Syntax:
54+
where `<version>` is:
55+
- a tag (i.e. "v4.0.0")
56+
- a branch (i.e. "master")
57+
- commit hash (i.e. "701f3e44aafb1a6459281714858fadf2c4c2a977")
58+
-------------------------------
59+
let upstream = --
60+
in upstream
61+
with new-package-name =
62+
{ dependencies =
63+
[ "dependency1"
64+
, "dependency2"
65+
]
66+
, repo =
67+
"https://example.com/path/to/git/repo.git"
68+
, version =
69+
"<version>"
70+
}
71+
-------------------------------
72+
73+
Example:
74+
-------------------------------
75+
let upstream = --
76+
in upstream
77+
with benchotron =
78+
{ dependencies =
79+
[ "arrays"
80+
, "exists"
81+
, "profunctor"
82+
, "strings"
83+
, "quickcheck"
84+
, "lcg"
85+
, "transformers"
86+
, "foldable-traversable"
87+
, "exceptions"
88+
, "node-fs"
89+
, "node-buffer"
90+
, "node-readline"
91+
, "datetime"
92+
, "now"
93+
]
94+
, repo =
95+
"https://github.com/hdgarrood/purescript-benchotron.git"
96+
, version =
97+
"v7.0.0"
98+
}
99+
-------------------------------
100+
-}
101+
let upstream =
102+
https://github.com/purescript/package-sets/releases/download/psc-0.14.5-20220224/packages.dhall sha256:67cc3d4f0e8fb72bb1413ba94ddd72a3ceb0783eb725e3b22ad7568b3b581163
103+
104+
in upstream

spago.dhall

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{-
2+
Welcome to a Spago project!
3+
You can edit this file as you like.
4+
5+
Need help? See the following resources:
6+
- Spago documentation: https://github.com/purescript/spago
7+
- Dhall language tour: https://docs.dhall-lang.org/tutorials/Language-Tour.html
8+
9+
When creating a new Spago project, you can use
10+
`spago init --no-comments` or `spago init -C`
11+
to generate this file without the comments in this block.
12+
-}
13+
{ name = "my-project"
14+
, dependencies =
15+
[ "aff"
16+
, "aff-promise"
17+
, "argonaut-core"
18+
, "console"
19+
, "effect"
20+
, "either"
21+
, "foreign"
22+
, "foreign-generic"
23+
, "functions"
24+
, "maybe"
25+
, "nullable"
26+
, "point-free"
27+
, "prelude"
28+
, "psci-support"
29+
, "transformers"
30+
, "undefined-or"
31+
, "unsafe-coerce"
32+
]
33+
, packages = ./packages.dhall
34+
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
35+
}

src/Firebase/App.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// @ts-check
2+
const { initializeApp, getApp } = require("firebase/app");
3+
4+
exports.initializeAppImp = function (config) {
5+
return function () {
6+
return initializeApp(config);
7+
}
8+
}
9+
10+
/**
11+
*
12+
* @param {String} name
13+
* @returns {() => import("firebase/app").FirebaseApp}
14+
*/
15+
exports.getAppImp = function (name) {
16+
return function () {
17+
return getApp(name);
18+
}
19+
}
20+
21+
/**
22+
*
23+
* @returns {import("firebase/app").FirebaseApp}
24+
*/
25+
exports.getApp2Imp = function () {
26+
return getApp();
27+
}

src/Firebase/App.purs

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module Firebase.App
2+
( initializeApp
3+
, FirebaseApp
4+
, FirebaseOptions
5+
, getApp
6+
, getApp'
7+
) where
8+
9+
import Effect (Effect)
10+
11+
type FirebaseOptions =
12+
{ apiKey :: String
13+
, authDomain :: String
14+
, projectId :: String
15+
, storageBucket :: String
16+
, messagingSenderId :: String
17+
, appId :: String
18+
}
19+
20+
foreign import data FirebaseApp :: Type
21+
22+
foreign import initializeAppImp :: FirebaseOptions -> Effect FirebaseApp
23+
24+
initializeApp :: FirebaseOptions -> Effect FirebaseApp
25+
initializeApp = initializeAppImp
26+
27+
foreign import getAppImp :: String -> Effect FirebaseApp
28+
29+
getApp :: String -> Effect FirebaseApp
30+
getApp name = getAppImp name
31+
32+
foreign import getApp2Imp :: Effect FirebaseApp
33+
34+
getApp' :: Effect FirebaseApp
35+
getApp' = getApp2Imp

0 commit comments

Comments
 (0)