firebase-login-custom 0.0.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ pnpm run lint && pnpm run test
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.3.0"
3
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,54 @@
1
+ # Changelog
2
+
3
+ ## [0.3.0](https://github.com/vergissberlin/firebase-login-custom/compare/v0.2.0...v0.3.0) (2026-03-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * implement error handling for FirebaseLoginCustom ([703feef](https://github.com/vergissberlin/firebase-login-custom/commit/703feefc8e4909046064df0afcf31570164e36d5))
9
+
10
+ ## [0.1.0](https://github.com/vergissberlin/firebase-login-custom/compare/v0.0.4...v0.1.0) (2026-03-16)
11
+
12
+
13
+ ### Features
14
+
15
+ * add CommonJS default export support in Vite configuration ([35b2791](https://github.com/vergissberlin/firebase-login-custom/commit/35b2791bb9b788d0bdb4c85a54db5df2927b4e67))
16
+ * enhance test setup for FirebaseLoginCustom with pretest script ([fb0abd1](https://github.com/vergissberlin/firebase-login-custom/commit/fb0abd1d16592473d744a34e2056ec97749ce208))
17
+ * enhance testing setup and documentation ([b27b93e](https://github.com/vergissberlin/firebase-login-custom/commit/b27b93e4b68612905ad9a3ac9dec79ddf1f04823))
18
+ * update README and release workflow for clarity and functionality ([1e38db6](https://github.com/vergissberlin/firebase-login-custom/commit/1e38db6b64c2e8508dbfa2f5c31b7090fb739e2a))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * refine TypeScript configuration and enhance test output management ([1f687e1](https://github.com/vergissberlin/firebase-login-custom/commit/1f687e1f17214920011e5b2bdac048bd4981b3c4))
24
+ * update CI workflow to restrict branches and remove Firebase condition ([281df21](https://github.com/vergissberlin/firebase-login-custom/commit/281df2149d59d226d1720e4e3765ae44201966f6))
25
+ * update FirebaseLoginCustom to allow optional secret in options ([6b9cfcb](https://github.com/vergissberlin/firebase-login-custom/commit/6b9cfcb56b1b715397fb275a75b877476455ecb2))
26
+ * update README for improved structure and clarity ([88c229a](https://github.com/vergissberlin/firebase-login-custom/commit/88c229ac4110753d1fd91405dbfdca79b72be746))
27
+
28
+ ## [0.2.0](https://github.com/vergissberlin/firebase-login-custom/compare/v0.1.0...v0.2.0) (2026-03-16)
29
+
30
+
31
+ ### Features
32
+
33
+ * enhance testing setup and documentation ([b27b93e](https://github.com/vergissberlin/firebase-login-custom/commit/b27b93e4b68612905ad9a3ac9dec79ddf1f04823))
34
+ * update README and release workflow for clarity and functionality ([1e38db6](https://github.com/vergissberlin/firebase-login-custom/commit/1e38db6b64c2e8508dbfa2f5c31b7090fb739e2a))
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * refine TypeScript configuration and enhance test output management ([1f687e1](https://github.com/vergissberlin/firebase-login-custom/commit/1f687e1f17214920011e5b2bdac048bd4981b3c4))
40
+
41
+ ## [0.1.0](https://github.com/vergissberlin/firebase-login-custom/compare/v0.0.3...v0.1.0) (2026-03-16)
42
+
43
+
44
+ ### Features
45
+
46
+ * add CommonJS default export support in Vite configuration ([35b2791](https://github.com/vergissberlin/firebase-login-custom/commit/35b2791bb9b788d0bdb4c85a54db5df2927b4e67))
47
+ * enhance test setup for FirebaseLoginCustom with pretest script ([fb0abd1](https://github.com/vergissberlin/firebase-login-custom/commit/fb0abd1d16592473d744a34e2056ec97749ce208))
48
+
49
+
50
+ ### Bug Fixes
51
+
52
+ * update CI workflow to restrict branches and remove Firebase condition ([281df21](https://github.com/vergissberlin/firebase-login-custom/commit/281df2149d59d226d1720e4e3765ae44201966f6))
53
+ * update FirebaseLoginCustom to allow optional secret in options ([6b9cfcb](https://github.com/vergissberlin/firebase-login-custom/commit/6b9cfcb56b1b715397fb275a75b877476455ecb2))
54
+ * update README for improved structure and clarity ([88c229a](https://github.com/vergissberlin/firebase-login-custom/commit/88c229ac4110753d1fd91405dbfdca79b72be746))
@@ -0,0 +1,8 @@
1
+ # Contributing
2
+
3
+ 1. Fork it
4
+ 2. Create your feature branch (`git flow feature start my-new-feature`)
5
+ 3. Commit your changes (`git commit -am 'Add code'`)
6
+ 4. Finish your implementation (`git flow feature finish my-new-feature`)
7
+ 5. Push to origin (`git push origin`)
8
+ 6. Create new Pull Request
package/README.md CHANGED
@@ -1,14 +1,10 @@
1
- firebase-login-custom
2
- =====================
1
+ # firebase-login-custom
3
2
 
4
- [![Build Status](https://travis-ci.org/vergissberlin/firebase-login-custom.svg)](https://travis-ci.org/vergissberlin/firebase-login-custom)
5
- [![Dependency Status](https://gemnasium.com/vergissberlin/firebase-login-custom.svg)](https://gemnasium.com/vergissberlin/firebase-login-custom)
6
- [![Issues](http://img.shields.io/github/issues/vergissberlin/firebase-login-custom.svg)]( https://github.com/vergissberlin/firebase-login-custom/issues "GitHub ticket system")
7
- [![npm version](https://img.shields.io/npm/v/firebase-login-custom.png)](https://npmjs.org/package/firebase-login-custom "View this project on npm")
3
+ [![CI](https://github.com/vergissberlin/firebase-login-custom/actions/workflows/ci.yml/badge.svg)](https://github.com/vergissberlin/firebase-login-custom/actions/workflows/ci.yml)
4
+ [![Issues](https://img.shields.io/github/issues/vergissberlin/firebase-login-custom.svg)](https://github.com/vergissberlin/firebase-login-custom/issues "GitHub ticket system")
5
+ [![npm version](https://img.shields.io/npm/v/firebase-login-custom.svg)](https://www.npmjs.com/package/firebase-login-custom "View this project on npm")
8
6
 
9
-
10
- Authenticating Users with Email & Password
11
- ------------------------------------------
7
+ ## Authenticating Users with Email & Password
12
8
 
13
9
  To authenticate a user using [Custom Login](https://www.firebase.com/docs/web/guide/login/custom.html),
14
10
  we must provide each client with a secure JWT that has been generated on a server.
@@ -19,71 +15,113 @@ Firebase account and clicking on the Security tab in the Firebase Dashboard.
19
15
  This package is a wrapper to Firebase custom login including all dependencies
20
16
  with the exception of firebase it self.
21
17
 
22
- More information your can find [here](https://www.firebase.com/docs/web/guide/login/custom.html).
18
+ More information can be found in the [Firebase custom login documentation](https://www.firebase.com/docs/web/guide/login/custom.html).
19
+
20
+ ## Installation
23
21
 
24
- Installation
25
- ------------
22
+ Install via npm or pnpm:
26
23
 
27
- Install via npm:
24
+ ```bash
25
+ npm install firebase firebase-login-custom
26
+ ```
28
27
 
29
28
  ```bash
30
- npm install firebase firebase-login-custom
29
+ pnpm add firebase firebase-login-custom
31
30
  ```
32
31
 
33
- Example
34
- -------
32
+ ## Example
35
33
 
36
34
  ```javascript
37
35
 
38
- var ref = new Firebase('https://<Your Firebase>.firebaseio.com');
39
-
40
- FirebaseLoginCustom(firebaseRef, {
41
- uid: <Your id>
42
- },
43
- {
44
- secret: <Your secret>,
45
- },
46
- function (error, data) {
47
- if (error !== null) {
48
- console.log(error);
49
- } else {
50
- console.log(data.token);
51
- }
36
+ var ref = new Firebase('https://<Your Firebase>.firebaseio.com');
37
+
38
+ FirebaseLoginCustom(firebaseRef, {
39
+ uid: <Your id>
40
+ },
41
+ {
42
+ secret: <Your secret>,
43
+ },
44
+ function (error, data) {
45
+ if (error !== null) {
46
+ console.log(error);
47
+ } else {
48
+ console.log(data.token);
52
49
  }
53
- );
50
+ }
51
+ );
54
52
  ```
55
53
 
56
- Issues
57
- ------
54
+ ### Error handling
55
+
56
+ - **Validation errors** (invalid `ref`, `data`, `option`, or `callback`): the constructor throws `FirebaseLoginCustomValidationError` (or the callable form throws it). You can check `error.code === 'FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR'` or `error instanceof FirebaseLoginCustomValidationError`.
57
+ - **Token generation errors**: if token creation fails, the **callback** is invoked with a `FirebaseLoginCustomTokenError` (once, asynchronously). It has a `cause` property with the original thrown value.
58
+ - **Auth errors** (from Firebase): the callback receives a user-facing string for known codes (`INVALID_EMAIL`, `INVALID_PASSWORD`, `INVALID_USER`) or a generic message including the original error for other failures.
59
+
60
+ ## Issues
58
61
 
59
62
  Please report issues to [ticket system](https://github.com/vergissberlin/firebase-login-custom/issues).
60
- Pull requests are welcome here!
63
+ Pull requests are welcome here! See [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute.
61
64
 
65
+ ## Install locally
62
66
 
63
- Contributing
64
- ------------
67
+ Tests use a **Firebase mock** by default (no credentials needed). With env vars set, they use real Firebase.
65
68
 
66
- 1. Fork it
67
- 2. Create your feature branch (`git flow feature start my-new-feature`)
68
- 3. Commit your changes (`git commit -am 'Add code'`)
69
- 4. Finish your implementation (`git flow feature finish my-new-feature`)
70
- 4. Push to origin (`git push origin`)
71
- 5. Create new Pull Request
69
+ ```bash
70
+ cd /path/to/firebase-login-custom
71
+ pnpm install
72
+ pnpm run build
73
+ pnpm test
74
+ ```
75
+
76
+ - **Unit tests** (Vitest): `pnpm run test:unit` (no build required). Watch mode: `pnpm run test:watch`.
77
+ - **Integration tests**: `pnpm run test:integration` (builds first if needed). `pnpm test` runs unit then integration.
72
78
 
73
- Install locally
74
- ---------------
79
+ **Pre-commit hooks (Husky):** Before each commit, `pnpm run lint` and `pnpm run test` run automatically. If either fails, the commit is aborted. Hooks are installed when you run `pnpm install` (via the `prepare` script).
80
+
81
+ To run against real Firebase:
75
82
 
76
83
  ```bash
77
- $ cd /path/to/firebase-login-email/
78
- $ npm install
79
- $ export FIREBASE_ID=<YOUR_TEST_ID>
80
- $ export FIREBASE_SECRET=<123456abcdefg>
81
- $ node tests/integration/firebase-login-custom-integration-child.js
82
- $ node tests/integration/firebase-login-custom-integration-simple.js
83
- $ node tests/integration/firebase-login-custom-integration-unique.js
84
+ export FIREBASE_ID=<YOUR_TEST_ID>
85
+ export FIREBASE_UID=<YOUR_USER_ID>
86
+ export FIREBASE_SECRET=<YOUR_SECRET>
87
+ pnpm test
84
88
  ```
85
89
 
86
- <a name="thanks"></a>
87
- Thanks to
88
- ---------
90
+ For CI, optional: set repository secrets `FIREBASE_ID`, `FIREBASE_UID`, and `FIREBASE_SECRET` to run integration tests against real Firebase on push/PR.
91
+
92
+ ## Releasing
93
+
94
+ Releases are automated via GitHub Actions and [Release Please](https://github.com/googleapis/release-please).
95
+
96
+ - **Release Please** (workflow `release-please`): On every push to `main`, it opens or updates a release PR based on [Conventional Commits](https://www.conventionalcommits.org/). Merge that PR; Release Please then creates the version tag and GitHub Release.
97
+ - **Release** (workflow `Release`): Triggered when a GitHub Release is published (e.g. by Release Please), when a version tag (`v*`) is pushed, or **manually**. It builds, **publishes to npm** (requires `NPM_TOKEN` secret), and creates/updates the GitHub Release when triggered by a tag push.
98
+
99
+ ### First-time publish (Release workflow never ran)
100
+
101
+ If the Release workflow has never run and nothing is on [npm](https://www.npmjs.com/package/firebase-login-custom) yet:
102
+
103
+ 1. **Add `NPM_TOKEN`** (Settings → Secrets and variables → Actions): Create an npm [Access Token](https://www.npmjs.com/settings/~youruser/tokens) with **Automation** or **Publish** scope and add it as repository secret `NPM_TOKEN`.
104
+ 2. **Run the Release workflow once**: In the repo go to **Actions → Release → Run workflow** (use “Run workflow” on the default branch). This publishes the current `package.json` version to npm. No GitHub Release is created when run manually.
105
+ 3. After that, use either Release Please (conventional commits + merge release PR) or manual tag push (`git tag v0.1.0 && git push origin v0.1.0`) so future releases also trigger the workflow automatically.
106
+
107
+ ### Regular releases
108
+
109
+ 1. **Secrets** (Settings → Secrets and variables → Actions):
110
+ - **NPM_TOKEN** (required): npm auth token with publish permission. Create at [npmjs.com → Access Tokens](https://www.npmjs.com/settings/~youruser/tokens) (Automation or Publish).
111
+ - **GH_PAT** (optional): GitHub Personal Access Token with `repo` scope. Only needed if the default `GITHUB_TOKEN` cannot create releases (e.g. in some org settings). If you use it, set the Release workflow's "Create GitHub Release" step to `GITHUB_TOKEN: ${{ secrets.GH_PAT }}`.
112
+
113
+ 2. **Version and tag (with Release Please)**: Use conventional commits (e.g. `feat:`, `fix:`, `chore:`). After pushing to `main`, Release Please will open or update a release PR. Merge that PR; Release Please creates the tag and GitHub Release. The Release workflow runs on **release published** (and on tag push), so it will build and publish to npm—ensure **NPM_TOKEN** is set in repository secrets.
114
+
115
+ **Without Release Please** (manual): Bump version in `package.json`, commit, push a version tag:
116
+ ```bash
117
+ pnpm version patch # or minor / major
118
+ git push origin main
119
+ git push origin v0.0.4 # use the new version number
120
+ ```
121
+ Pushing a tag `v*` triggers the Release workflow.
122
+
123
+ 3. **Manual run**: You can also trigger the Release workflow manually (Actions → Release → Run workflow). It will publish the current version from `package.json` to npm; no GitHub Release is created unless a tag is pushed.
124
+
125
+ ## Thanks to {#thanks}
126
+
89
127
  1. A special thanks to the developers of **NodeJS** and **Firebase**.
@@ -0,0 +1,65 @@
1
+ /**
2
+ * FirebaseLoginCustom
3
+ *
4
+ * Authenticating Users with Custom login
5
+ * Firebase makes it easy to integrate email and password authentication
6
+ * into your app. Firebase automatically stores your users' credentials
7
+ * securely (using bcrypt) and redundantly (daily off-site backups).
8
+ * This separates sensitive user credentials from your application data,
9
+ * and lets you focus on the user interface and experience for your app.
10
+ *
11
+ * @author André Lademann <vergissberlin@googlemail.com>
12
+ * @link https://www.firebase.com/docs/web/guide/login/password.html
13
+ * @param ref Firebase object reference
14
+ * @param data Authentication object with uid and secret
15
+ * @param option Option object with admin, debug and expire settings
16
+ * @param callback Callback function
17
+ * @return FirebaseLoginCustom
18
+ */
19
+ /** Error code for validation failures (invalid ref, data, option, or callback). */
20
+ export declare const FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR = "FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR";
21
+ /** Error code for token generation failures (e.g. invalid claims or secret). */
22
+ export declare const FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR = "FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR";
23
+ /**
24
+ * Thrown when constructor arguments are invalid (ref, data, option, or callback).
25
+ * Consumers can use `error.code === FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR` or
26
+ * `error instanceof FirebaseLoginCustomValidationError`.
27
+ */
28
+ export declare class FirebaseLoginCustomValidationError extends Error {
29
+ readonly code = "FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR";
30
+ constructor(message: string);
31
+ }
32
+ /**
33
+ * Thrown when token generation fails (e.g. invalid secret or claims).
34
+ * Passed to the callback when createToken throws; not thrown from the constructor.
35
+ */
36
+ export declare class FirebaseLoginCustomTokenError extends Error {
37
+ readonly code = "FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR";
38
+ readonly cause: unknown;
39
+ constructor(message: string, cause?: unknown);
40
+ }
41
+ export interface AuthData {
42
+ uid: string;
43
+ [key: string]: unknown;
44
+ }
45
+ export interface FirebaseLoginOption {
46
+ admin?: boolean;
47
+ debug?: boolean;
48
+ expires?: number;
49
+ notBefore?: number;
50
+ secret: string;
51
+ }
52
+ /** Option type for inputs where secret is not yet validated */
53
+ type FirebaseLoginOptionInput = Omit<FirebaseLoginOption, 'secret'> & {
54
+ secret?: string;
55
+ };
56
+ export type FirebaseLoginCallback = (error: Error | string | null, authData?: unknown) => void;
57
+ export interface FirebaseRef {
58
+ authWithCustomToken: (token: string, callback: FirebaseLoginCallback) => void;
59
+ }
60
+ export declare class FirebaseLoginCustom {
61
+ constructor(ref: FirebaseRef, data?: AuthData, option?: FirebaseLoginOptionInput, callback?: FirebaseLoginCallback);
62
+ }
63
+ /** Callable export for backward compatibility (use without `new`) */
64
+ declare function firebaseLoginCustom(ref: FirebaseRef, data?: AuthData, option?: FirebaseLoginOptionInput, callback?: FirebaseLoginCallback): void;
65
+ export default firebaseLoginCustom;
@@ -1,99 +1,3 @@
1
-
2
- /**
3
- * FirebaseLoginCustom
4
- *
5
- * Authenticating Users with Custom login
6
- * Firebase makes it easy to integrate email and password authentication
7
- * into your app. Firebase automatically stores your users' credentials
8
- * securely (using bcrypt) and redundantly (daily off-site backups).
9
- * This separates sensitive user credentials from your application data,
10
- * and lets you focus on the user interface and experience for your app.
11
- *
12
- * @author André Lademann <vergissberlin@googlemail.com>
13
- * @link https://www.firebase.com/docs/web/guide/login/password.html
14
- * @param {*} ref Firebase object reference
15
- * @param {*} data Authentication object with uid and secret
16
- * @param {*} option Option object with admin, debug and expire settingst
17
- * @param {*} callback Callback function
18
- * @return {*} FirebaseLoginCustom
19
- */
20
-
21
- (function() {
22
- var FirebaseLoginCustom;
23
-
24
- FirebaseLoginCustom = (function() {
25
- function FirebaseLoginCustom(ref, data, option, callback) {
26
- var FirebaseTokenGenerator, authToken, tokenGenerator;
27
- if (data == null) {
28
- data = {};
29
- }
30
- if (option == null) {
31
- option = {
32
- admin: false,
33
- expires: false,
34
- debug: false,
35
- notBefore: false
36
- };
37
- }
38
- if (callback == null) {
39
- callback = function() {};
40
- }
41
- FirebaseTokenGenerator = require('firebase-token-generator');
42
- if (typeof option.admin !== 'boolean') {
43
- option.admin = false;
44
- }
45
- if (typeof option.debug !== 'boolean') {
46
- option.debug = false;
47
- }
48
- if (typeof option.expires !== 'number') {
49
- option.expires = +(new Date) / 1000 + 86400;
50
- }
51
- if (typeof option.notBefore !== 'number') {
52
- option.notBefore = +(new Date) / 1000;
53
- }
54
- if (typeof ref !== 'object') {
55
- throw new Error('Ref must be an object!');
56
- }
57
- if (typeof data.uid !== 'string') {
58
- throw new Error('Data object must have an "uid" field!');
59
- }
60
- if (typeof option.secret !== 'string') {
61
- throw new Error('Option object must have an "secret" field!');
62
- }
63
- if (typeof callback !== "function") {
64
- throw new Error('Callback must be a function!');
65
- }
66
- tokenGenerator = new FirebaseTokenGenerator(option.secret);
67
- authToken = tokenGenerator.createToken(data, {
68
- admin: option.admin,
69
- debug: option.debug,
70
- expires: option.expires,
71
- notBefore: option.notBefore
72
- });
73
- ref.authWithCustomToken(authToken, function(error, authData) {
74
- if (error) {
75
- switch (error.code) {
76
- case 'INVALID_EMAIL':
77
- error = 'The specified user account email is invalid.';
78
- break;
79
- case 'INVALID_PASSWORD':
80
- error = 'The specified user account password is incorrect.';
81
- break;
82
- case 'INVALID_USER':
83
- error = 'The specified user account does not exist.';
84
- break;
85
- default:
86
- error = 'Error logging user in: ' + error.toString();
87
- }
88
- }
89
- return callback(error, authData);
90
- });
91
- }
92
-
93
- return FirebaseLoginCustom;
94
-
95
- })();
96
-
97
- module.exports = FirebaseLoginCustom;
98
-
99
- }).call(this);
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`firebase-token-generator`);c=s(c);var l=`FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR`,u=`FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR`,d=class e extends Error{constructor(t){super(t),this.code=l,this.name=`FirebaseLoginCustomValidationError`,Object.setPrototypeOf(this,e.prototype)}},f=class e extends Error{constructor(t,n){super(t),this.code=u,this.name=`FirebaseLoginCustomTokenError`,this.cause=n,Object.setPrototypeOf(this,e.prototype)}},p={admin:!1,expires:0,debug:!1,notBefore:0},m=class{constructor(e,t={uid:``},n={...p},r=()=>{}){if(typeof n.admin!=`boolean`&&(n.admin=!1),typeof n.debug!=`boolean`&&(n.debug=!1),typeof n.expires!=`number`&&(n.expires=new Date/1e3+86400),typeof n.notBefore!=`number`&&(n.notBefore=new Date/1e3),typeof e!=`object`)throw new d(`Ref must be an object!`);if(typeof t.uid!=`string`)throw new d(`Data object must have a "uid" field!`);if(typeof n.secret!=`string`)throw new d(`Option object must have a "secret" field!`);if(typeof r!=`function`)throw new d(`Callback must be a function!`);let i;try{i=new c.default(n.secret).createToken(t,{admin:n.admin,debug:n.debug,expires:n.expires,notBefore:n.notBefore})}catch(e){let t=e instanceof Error?new f(`Token generation failed: `+e.message,e):new f(`Token generation failed: `+String(e),e);process.nextTick(()=>r(t,void 0));return}e.authWithCustomToken(i,(e,t)=>{let n=null;if(e)switch(e.code){case`INVALID_EMAIL`:n=`The specified user account email is invalid.`;break;case`INVALID_PASSWORD`:n=`The specified user account password is incorrect.`;break;case`INVALID_USER`:n=`The specified user account does not exist.`;break;default:n=`Error logging user in: `+String(e)}r(n,t)})}};function h(e,t,n,r){new m(e,t??{uid:``},n??{...p},r??(()=>{}))}exports.FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR=u,exports.FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR=l,exports.FirebaseLoginCustom=m,exports.FirebaseLoginCustomTokenError=f,exports.FirebaseLoginCustomValidationError=d,exports.default=h;
2
+ //# sourceMappingURL=firebase-login-custom.js.map
3
+ if (typeof module !== 'undefined' && module.exports) { var _def = module.exports.default, _cls = module.exports.FirebaseLoginCustom; module.exports = _def; if (_def) { _def.default = _def; if (_cls !== undefined) _def.FirebaseLoginCustom = _cls; } }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase-login-custom.js","names":[],"sources":["../src/firebase-login-custom.ts"],"sourcesContent":["/**\n * FirebaseLoginCustom\n *\n * Authenticating Users with Custom login\n * Firebase makes it easy to integrate email and password authentication\n * into your app. Firebase automatically stores your users' credentials\n * securely (using bcrypt) and redundantly (daily off-site backups).\n * This separates sensitive user credentials from your application data,\n * and lets you focus on the user interface and experience for your app.\n *\n * @author André Lademann <vergissberlin@googlemail.com>\n * @link https://www.firebase.com/docs/web/guide/login/password.html\n * @param ref Firebase object reference\n * @param data Authentication object with uid and secret\n * @param option Option object with admin, debug and expire settings\n * @param callback Callback function\n * @return FirebaseLoginCustom\n */\n\nimport FirebaseTokenGenerator from 'firebase-token-generator';\n\n/** Error code for validation failures (invalid ref, data, option, or callback). */\nexport const FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR = 'FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR';\n\n/** Error code for token generation failures (e.g. invalid claims or secret). */\nexport const FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR = 'FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR';\n\n/**\n * Thrown when constructor arguments are invalid (ref, data, option, or callback).\n * Consumers can use `error.code === FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR` or\n * `error instanceof FirebaseLoginCustomValidationError`.\n */\nexport class FirebaseLoginCustomValidationError extends Error {\n readonly code = FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR;\n\n constructor(message: string) {\n super(message);\n this.name = 'FirebaseLoginCustomValidationError';\n Object.setPrototypeOf(this, FirebaseLoginCustomValidationError.prototype);\n }\n}\n\n/**\n * Thrown when token generation fails (e.g. invalid secret or claims).\n * Passed to the callback when createToken throws; not thrown from the constructor.\n */\nexport class FirebaseLoginCustomTokenError extends Error {\n readonly code = FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR;\n readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'FirebaseLoginCustomTokenError';\n this.cause = cause;\n Object.setPrototypeOf(this, FirebaseLoginCustomTokenError.prototype);\n }\n}\n\nexport interface AuthData {\n uid: string;\n [key: string]: unknown;\n}\n\nexport interface FirebaseLoginOption {\n admin?: boolean;\n debug?: boolean;\n expires?: number;\n notBefore?: number;\n secret: string;\n}\n\n/** Option type for inputs where secret is not yet validated */\ntype FirebaseLoginOptionInput = Omit<FirebaseLoginOption, 'secret'> & {\n secret?: string;\n};\n\nexport type FirebaseLoginCallback = (\n error: Error | string | null,\n authData?: unknown\n) => void;\n\nexport interface FirebaseRef {\n authWithCustomToken: (\n token: string,\n callback: FirebaseLoginCallback\n ) => void;\n}\n\nconst defaultOption: Required<Omit<FirebaseLoginOption, 'secret'>> & {\n secret?: string;\n} = {\n admin: false,\n expires: 0,\n debug: false,\n notBefore: 0,\n};\n\nexport class FirebaseLoginCustom {\n constructor(\n ref: FirebaseRef,\n data: AuthData = { uid: '' },\n option: FirebaseLoginOptionInput = { ...defaultOption },\n callback: FirebaseLoginCallback = () => {}\n ) {\n if (typeof option.admin !== 'boolean') {\n option.admin = false;\n }\n if (typeof option.debug !== 'boolean') {\n option.debug = false;\n }\n if (typeof option.expires !== 'number') {\n option.expires = +new Date() / 1000 + 86400;\n }\n if (typeof option.notBefore !== 'number') {\n option.notBefore = +new Date() / 1000;\n }\n\n if (typeof ref !== 'object') {\n throw new FirebaseLoginCustomValidationError('Ref must be an object!');\n }\n if (typeof data.uid !== 'string') {\n throw new FirebaseLoginCustomValidationError('Data object must have a \"uid\" field!');\n }\n if (typeof option.secret !== 'string') {\n throw new FirebaseLoginCustomValidationError('Option object must have a \"secret\" field!');\n }\n if (typeof callback !== 'function') {\n throw new FirebaseLoginCustomValidationError('Callback must be a function!');\n }\n\n let authToken: string;\n try {\n const tokenGenerator = new FirebaseTokenGenerator(option.secret);\n authToken = tokenGenerator.createToken(data, {\n admin: option.admin,\n debug: option.debug,\n expires: option.expires,\n notBefore: option.notBefore,\n });\n } catch (err) {\n const callbackError =\n err instanceof Error\n ? new FirebaseLoginCustomTokenError('Token generation failed: ' + err.message, err)\n : new FirebaseLoginCustomTokenError('Token generation failed: ' + String(err), err);\n process.nextTick(() => callback(callbackError, undefined));\n return;\n }\n\n ref.authWithCustomToken(authToken, (error, authData) => {\n let callbackError: Error | string | null = null;\n if (error) {\n const err = error as { code?: string };\n switch (err.code) {\n case 'INVALID_EMAIL':\n callbackError = 'The specified user account email is invalid.';\n break;\n case 'INVALID_PASSWORD':\n callbackError = 'The specified user account password is incorrect.';\n break;\n case 'INVALID_USER':\n callbackError = 'The specified user account does not exist.';\n break;\n default:\n callbackError = 'Error logging user in: ' + String(error);\n }\n }\n callback(callbackError, authData);\n });\n }\n}\n\n/** Callable export for backward compatibility (use without `new`) */\nfunction firebaseLoginCustom(\n ref: FirebaseRef,\n data?: AuthData,\n option?: FirebaseLoginOptionInput,\n callback?: FirebaseLoginCallback\n): void {\n new FirebaseLoginCustom(\n ref,\n data ?? { uid: '' },\n option ?? { ...defaultOption },\n callback ?? (() => {})\n );\n}\n\nexport default firebaseLoginCustom;\n"],"mappings":"8mBAsBA,IAAa,EAAyC,yCAGzC,EAAoC,oCAOpC,EAAb,MAAa,UAA2C,KAAM,CAG5D,YAAY,EAAiB,CAC3B,MAAM,EAAQ,WAHA,EAId,KAAK,KAAO,qCACZ,OAAO,eAAe,KAAM,EAAmC,UAAU,GAQhE,EAAb,MAAa,UAAsC,KAAM,CAIvD,YAAY,EAAiB,EAAiB,CAC5C,MAAM,EAAQ,WAJA,EAKd,KAAK,KAAO,gCACZ,KAAK,MAAQ,EACb,OAAO,eAAe,KAAM,EAA8B,UAAU,GAkClE,EAEF,CACF,MAAO,GACP,QAAS,EACT,MAAO,GACP,UAAW,EACZ,CAEY,EAAb,KAAiC,CAC/B,YACE,EACA,EAAiB,CAAE,IAAK,GAAI,CAC5B,EAAmC,CAAE,GAAG,EAAe,CACvD,MAAwC,GACxC,CAcA,GAbI,OAAO,EAAO,OAAU,YAC1B,EAAO,MAAQ,IAEb,OAAO,EAAO,OAAU,YAC1B,EAAO,MAAQ,IAEb,OAAO,EAAO,SAAY,WAC5B,EAAO,QAAW,IAAI,KAAS,IAAO,OAEpC,OAAO,EAAO,WAAc,WAC9B,EAAO,UAAa,IAAI,KAAS,KAG/B,OAAO,GAAQ,SACjB,MAAM,IAAI,EAAmC,yBAAyB,CAExE,GAAI,OAAO,EAAK,KAAQ,SACtB,MAAM,IAAI,EAAmC,uCAAuC,CAEtF,GAAI,OAAO,EAAO,QAAW,SAC3B,MAAM,IAAI,EAAmC,4CAA4C,CAE3F,GAAI,OAAO,GAAa,WACtB,MAAM,IAAI,EAAmC,+BAA+B,CAG9E,IAAI,EACJ,GAAI,CAEF,EADuB,IAAI,EAAA,QAAuB,EAAO,OAAO,CACrC,YAAY,EAAM,CAC3C,MAAO,EAAO,MACd,MAAO,EAAO,MACd,QAAS,EAAO,QAChB,UAAW,EAAO,UACnB,CAAC,OACK,EAAK,CACZ,IAAM,EACJ,aAAe,MACX,IAAI,EAA8B,4BAA8B,EAAI,QAAS,EAAI,CACjF,IAAI,EAA8B,4BAA8B,OAAO,EAAI,CAAE,EAAI,CACvF,QAAQ,aAAe,EAAS,EAAe,IAAA,GAAU,CAAC,CAC1D,OAGF,EAAI,oBAAoB,GAAY,EAAO,IAAa,CACtD,IAAI,EAAuC,KAC3C,GAAI,EAEF,OADY,EACA,KAAZ,CACE,IAAK,gBACH,EAAgB,+CAChB,MACF,IAAK,mBACH,EAAgB,oDAChB,MACF,IAAK,eACH,EAAgB,6CAChB,MACF,QACE,EAAgB,0BAA4B,OAAO,EAAM,CAG/D,EAAS,EAAe,EAAS,EACjC,GAKN,SAAS,EACP,EACA,EACA,EACA,EACM,CACN,IAAI,EACF,EACA,GAAQ,CAAE,IAAK,GAAI,CACnB,GAAU,CAAE,GAAG,EAAe,CAC9B,QAAmB,IACpB"}
@@ -0,0 +1,59 @@
1
+ import e from "firebase-token-generator";
2
+ //#region src/firebase-login-custom.ts
3
+ var t = "FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR", n = "FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR", r = class e extends Error {
4
+ constructor(n) {
5
+ super(n), this.code = t, this.name = "FirebaseLoginCustomValidationError", Object.setPrototypeOf(this, e.prototype);
6
+ }
7
+ }, i = class e extends Error {
8
+ constructor(t, r) {
9
+ super(t), this.code = n, this.name = "FirebaseLoginCustomTokenError", this.cause = r, Object.setPrototypeOf(this, e.prototype);
10
+ }
11
+ }, a = {
12
+ admin: !1,
13
+ expires: 0,
14
+ debug: !1,
15
+ notBefore: 0
16
+ }, o = class {
17
+ constructor(t, n = { uid: "" }, o = { ...a }, s = () => {}) {
18
+ if (typeof o.admin != "boolean" && (o.admin = !1), typeof o.debug != "boolean" && (o.debug = !1), typeof o.expires != "number" && (o.expires = /* @__PURE__ */ new Date() / 1e3 + 86400), typeof o.notBefore != "number" && (o.notBefore = /* @__PURE__ */ new Date() / 1e3), typeof t != "object") throw new r("Ref must be an object!");
19
+ if (typeof n.uid != "string") throw new r("Data object must have a \"uid\" field!");
20
+ if (typeof o.secret != "string") throw new r("Option object must have a \"secret\" field!");
21
+ if (typeof s != "function") throw new r("Callback must be a function!");
22
+ let c;
23
+ try {
24
+ c = new e(o.secret).createToken(n, {
25
+ admin: o.admin,
26
+ debug: o.debug,
27
+ expires: o.expires,
28
+ notBefore: o.notBefore
29
+ });
30
+ } catch (e) {
31
+ let t = e instanceof Error ? new i("Token generation failed: " + e.message, e) : new i("Token generation failed: " + String(e), e);
32
+ process.nextTick(() => s(t, void 0));
33
+ return;
34
+ }
35
+ t.authWithCustomToken(c, (e, t) => {
36
+ let n = null;
37
+ if (e) switch (e.code) {
38
+ case "INVALID_EMAIL":
39
+ n = "The specified user account email is invalid.";
40
+ break;
41
+ case "INVALID_PASSWORD":
42
+ n = "The specified user account password is incorrect.";
43
+ break;
44
+ case "INVALID_USER":
45
+ n = "The specified user account does not exist.";
46
+ break;
47
+ default: n = "Error logging user in: " + String(e);
48
+ }
49
+ s(n, t);
50
+ });
51
+ }
52
+ };
53
+ function s(e, t, n, r) {
54
+ new o(e, t ?? { uid: "" }, n ?? { ...a }, r ?? (() => {}));
55
+ }
56
+ //#endregion
57
+ export { n as FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR, t as FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR, o as FirebaseLoginCustom, i as FirebaseLoginCustomTokenError, r as FirebaseLoginCustomValidationError, s as default };
58
+
59
+ //# sourceMappingURL=firebase-login-custom.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase-login-custom.mjs","names":[],"sources":["../src/firebase-login-custom.ts"],"sourcesContent":["/**\n * FirebaseLoginCustom\n *\n * Authenticating Users with Custom login\n * Firebase makes it easy to integrate email and password authentication\n * into your app. Firebase automatically stores your users' credentials\n * securely (using bcrypt) and redundantly (daily off-site backups).\n * This separates sensitive user credentials from your application data,\n * and lets you focus on the user interface and experience for your app.\n *\n * @author André Lademann <vergissberlin@googlemail.com>\n * @link https://www.firebase.com/docs/web/guide/login/password.html\n * @param ref Firebase object reference\n * @param data Authentication object with uid and secret\n * @param option Option object with admin, debug and expire settings\n * @param callback Callback function\n * @return FirebaseLoginCustom\n */\n\nimport FirebaseTokenGenerator from 'firebase-token-generator';\n\n/** Error code for validation failures (invalid ref, data, option, or callback). */\nexport const FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR = 'FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR';\n\n/** Error code for token generation failures (e.g. invalid claims or secret). */\nexport const FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR = 'FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR';\n\n/**\n * Thrown when constructor arguments are invalid (ref, data, option, or callback).\n * Consumers can use `error.code === FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR` or\n * `error instanceof FirebaseLoginCustomValidationError`.\n */\nexport class FirebaseLoginCustomValidationError extends Error {\n readonly code = FIREBASE_LOGIN_CUSTOM_VALIDATION_ERROR;\n\n constructor(message: string) {\n super(message);\n this.name = 'FirebaseLoginCustomValidationError';\n Object.setPrototypeOf(this, FirebaseLoginCustomValidationError.prototype);\n }\n}\n\n/**\n * Thrown when token generation fails (e.g. invalid secret or claims).\n * Passed to the callback when createToken throws; not thrown from the constructor.\n */\nexport class FirebaseLoginCustomTokenError extends Error {\n readonly code = FIREBASE_LOGIN_CUSTOM_TOKEN_ERROR;\n readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'FirebaseLoginCustomTokenError';\n this.cause = cause;\n Object.setPrototypeOf(this, FirebaseLoginCustomTokenError.prototype);\n }\n}\n\nexport interface AuthData {\n uid: string;\n [key: string]: unknown;\n}\n\nexport interface FirebaseLoginOption {\n admin?: boolean;\n debug?: boolean;\n expires?: number;\n notBefore?: number;\n secret: string;\n}\n\n/** Option type for inputs where secret is not yet validated */\ntype FirebaseLoginOptionInput = Omit<FirebaseLoginOption, 'secret'> & {\n secret?: string;\n};\n\nexport type FirebaseLoginCallback = (\n error: Error | string | null,\n authData?: unknown\n) => void;\n\nexport interface FirebaseRef {\n authWithCustomToken: (\n token: string,\n callback: FirebaseLoginCallback\n ) => void;\n}\n\nconst defaultOption: Required<Omit<FirebaseLoginOption, 'secret'>> & {\n secret?: string;\n} = {\n admin: false,\n expires: 0,\n debug: false,\n notBefore: 0,\n};\n\nexport class FirebaseLoginCustom {\n constructor(\n ref: FirebaseRef,\n data: AuthData = { uid: '' },\n option: FirebaseLoginOptionInput = { ...defaultOption },\n callback: FirebaseLoginCallback = () => {}\n ) {\n if (typeof option.admin !== 'boolean') {\n option.admin = false;\n }\n if (typeof option.debug !== 'boolean') {\n option.debug = false;\n }\n if (typeof option.expires !== 'number') {\n option.expires = +new Date() / 1000 + 86400;\n }\n if (typeof option.notBefore !== 'number') {\n option.notBefore = +new Date() / 1000;\n }\n\n if (typeof ref !== 'object') {\n throw new FirebaseLoginCustomValidationError('Ref must be an object!');\n }\n if (typeof data.uid !== 'string') {\n throw new FirebaseLoginCustomValidationError('Data object must have a \"uid\" field!');\n }\n if (typeof option.secret !== 'string') {\n throw new FirebaseLoginCustomValidationError('Option object must have a \"secret\" field!');\n }\n if (typeof callback !== 'function') {\n throw new FirebaseLoginCustomValidationError('Callback must be a function!');\n }\n\n let authToken: string;\n try {\n const tokenGenerator = new FirebaseTokenGenerator(option.secret);\n authToken = tokenGenerator.createToken(data, {\n admin: option.admin,\n debug: option.debug,\n expires: option.expires,\n notBefore: option.notBefore,\n });\n } catch (err) {\n const callbackError =\n err instanceof Error\n ? new FirebaseLoginCustomTokenError('Token generation failed: ' + err.message, err)\n : new FirebaseLoginCustomTokenError('Token generation failed: ' + String(err), err);\n process.nextTick(() => callback(callbackError, undefined));\n return;\n }\n\n ref.authWithCustomToken(authToken, (error, authData) => {\n let callbackError: Error | string | null = null;\n if (error) {\n const err = error as { code?: string };\n switch (err.code) {\n case 'INVALID_EMAIL':\n callbackError = 'The specified user account email is invalid.';\n break;\n case 'INVALID_PASSWORD':\n callbackError = 'The specified user account password is incorrect.';\n break;\n case 'INVALID_USER':\n callbackError = 'The specified user account does not exist.';\n break;\n default:\n callbackError = 'Error logging user in: ' + String(error);\n }\n }\n callback(callbackError, authData);\n });\n }\n}\n\n/** Callable export for backward compatibility (use without `new`) */\nfunction firebaseLoginCustom(\n ref: FirebaseRef,\n data?: AuthData,\n option?: FirebaseLoginOptionInput,\n callback?: FirebaseLoginCallback\n): void {\n new FirebaseLoginCustom(\n ref,\n data ?? { uid: '' },\n option ?? { ...defaultOption },\n callback ?? (() => {})\n );\n}\n\nexport default firebaseLoginCustom;\n"],"mappings":";;AAsBA,IAAa,IAAyC,0CAGzC,IAAoC,qCAOpC,IAAb,MAAa,UAA2C,MAAM;CAG5D,YAAY,GAAiB;AAG3B,EAFA,MAAM,EAAQ,cAHA,GAId,KAAK,OAAO,sCACZ,OAAO,eAAe,MAAM,EAAmC,UAAU;;GAQhE,IAAb,MAAa,UAAsC,MAAM;CAIvD,YAAY,GAAiB,GAAiB;AAI5C,EAHA,MAAM,EAAQ,cAJA,GAKd,KAAK,OAAO,iCACZ,KAAK,QAAQ,GACb,OAAO,eAAe,MAAM,EAA8B,UAAU;;GAkClE,IAEF;CACF,OAAO;CACP,SAAS;CACT,OAAO;CACP,WAAW;CACZ,EAEY,IAAb,MAAiC;CAC/B,YACE,GACA,IAAiB,EAAE,KAAK,IAAI,EAC5B,IAAmC,EAAE,GAAG,GAAe,EACvD,UAAwC,IACxC;AAcA,MAbI,OAAO,EAAO,SAAU,cAC1B,EAAO,QAAQ,KAEb,OAAO,EAAO,SAAU,cAC1B,EAAO,QAAQ,KAEb,OAAO,EAAO,WAAY,aAC5B,EAAO,0BAAW,IAAI,MAAM,GAAG,MAAO,QAEpC,OAAO,EAAO,aAAc,aAC9B,EAAO,4BAAa,IAAI,MAAM,GAAG,MAG/B,OAAO,KAAQ,SACjB,OAAM,IAAI,EAAmC,yBAAyB;AAExE,MAAI,OAAO,EAAK,OAAQ,SACtB,OAAM,IAAI,EAAmC,yCAAuC;AAEtF,MAAI,OAAO,EAAO,UAAW,SAC3B,OAAM,IAAI,EAAmC,8CAA4C;AAE3F,MAAI,OAAO,KAAa,WACtB,OAAM,IAAI,EAAmC,+BAA+B;EAG9E,IAAI;AACJ,MAAI;AAEF,OADuB,IAAI,EAAuB,EAAO,OAAO,CACrC,YAAY,GAAM;IAC3C,OAAO,EAAO;IACd,OAAO,EAAO;IACd,SAAS,EAAO;IAChB,WAAW,EAAO;IACnB,CAAC;WACK,GAAK;GACZ,IAAM,IACJ,aAAe,QACX,IAAI,EAA8B,8BAA8B,EAAI,SAAS,EAAI,GACjF,IAAI,EAA8B,8BAA8B,OAAO,EAAI,EAAE,EAAI;AACvF,WAAQ,eAAe,EAAS,GAAe,KAAA,EAAU,CAAC;AAC1D;;AAGF,IAAI,oBAAoB,IAAY,GAAO,MAAa;GACtD,IAAI,IAAuC;AAC3C,OAAI,EAEF,SADY,EACA,MAAZ;IACE,KAAK;AACH,SAAgB;AAChB;IACF,KAAK;AACH,SAAgB;AAChB;IACF,KAAK;AACH,SAAgB;AAChB;IACF,QACE,KAAgB,4BAA4B,OAAO,EAAM;;AAG/D,KAAS,GAAe,EAAS;IACjC;;;AAKN,SAAS,EACP,GACA,GACA,GACA,GACM;AACN,KAAI,EACF,GACA,KAAQ,EAAE,KAAK,IAAI,EACnB,KAAU,EAAE,GAAG,GAAe,EAC9B,YAAmB,IACpB"}
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "firebase-login-custom",
3
- "version": "0.0.4",
3
+ "version": "0.3.0",
4
4
  "description": "This package is a wrapper to firebase custom login including all dependencies with the exception of firebase it self.",
5
- "main": "dist/firbase-login-custom.js",
5
+ "engines": {
6
+ "node": ">=20"
7
+ },
8
+ "main": "dist/firebase-login-custom.js",
9
+ "module": "dist/firebase-login-custom.es.js",
10
+ "types": "dist/firebase-login-custom.d.ts",
6
11
  "directories": {
7
12
  "test": "tests"
8
13
  },
9
- "scripts": {
10
- "test": "node tests/integration/firebase-login-custom-integration-child.js && node tests/integration/firebase-login-custom-integration-simple.js && node tests/integration/firebase-login-custom-integration-unique.js"
11
- },
12
14
  "repository": {
13
15
  "type": "git",
14
16
  "url": "https://github.com/vergissberlin/firebase-login-custom.git"
@@ -39,13 +41,26 @@
39
41
  "firebase-token-generator": "^2.0.0"
40
42
  },
41
43
  "devDependencies": {
42
- "coffee-script": "^1.7.1",
43
- "firebase": "^2.1.2",
44
- "grunt": "^0.4.5",
45
- "grunt-coffeelint": "0.0.10",
46
- "grunt-contrib-clean": "^0.5.0",
47
- "grunt-contrib-coffee": "^0.10.1",
48
- "grunt-contrib-watch": "^0.6.1",
49
- "load-grunt-tasks": "^0.6.0"
44
+ "@eslint/js": "^10.0.1",
45
+ "@types/node": "^22.10.0",
46
+ "eslint": "^10.0.3",
47
+ "firebase": "^12.10.0",
48
+ "husky": "^9.1.7",
49
+ "typescript": "^5.9.3",
50
+ "typescript-eslint": "^8.57.1",
51
+ "vite": "^8.0.0",
52
+ "vite-plugin-dts": "^4.5.4",
53
+ "vitest": "^4.1.0"
54
+ },
55
+ "scripts": {
56
+ "build": "vite build",
57
+ "dev": "vite build --watch",
58
+ "watch": "vite build --watch",
59
+ "typecheck": "tsc --noEmit",
60
+ "lint": "pnpm exec eslint src/",
61
+ "test": "pnpm run test:unit && pnpm run test:integration",
62
+ "test:unit": "vitest run",
63
+ "test:integration": "node -e \"const fs=require('fs'); if(!fs.existsSync('dist/firebase-login-custom.js')){ const {execSync}=require('child_process'); execSync('pnpm run build',{stdio:'inherit'}); }\" && node tests/run-integration.js",
64
+ "test:watch": "vitest"
50
65
  }
51
- }
66
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3
+ "release-type": "node",
4
+ "include-component-in-tag": false,
5
+ "packages": {
6
+ ".": {}
7
+ }
8
+ }
package/renovate.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:recommended"
5
+ ]
6
+ }
@@ -0,0 +1,17 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import { resolve } from 'path';
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ globals: true,
7
+ environment: 'node',
8
+ include: ['src/**/*.test.ts', 'src/**/*.spec.ts'],
9
+ testTimeout: 5000,
10
+ hookTimeout: 5000,
11
+ },
12
+ resolve: {
13
+ alias: {
14
+ '@': resolve(__dirname, 'src'),
15
+ },
16
+ },
17
+ });
package/.npmignore DELETED
@@ -1,15 +0,0 @@
1
- .*.swp
2
- ._*
3
- .DS_Store
4
- .editorconfig
5
- .git
6
- .hg
7
- .idea
8
- .lock-wscript
9
- .travis.yml
10
- .wafpickle-*
11
- CVS
12
- Gruntfile.js
13
- npm-debug.log
14
- src
15
- tests