Skip to content

Commit 5084d78

Browse files
prescottprueBobbyloginov-rocks
committed
* chore(ci): add package version check stage to prevent failed builds if version is already released * feat(types): generic types for firestore methods (prescottprue#920) - @puppybits * fix(types): use correct import for react in types (prescottprue#927) - @loginov-rocks * chore(types): remove unused AppTypes import Co-authored-by: Bobby <bobby@getfiskal.com> Co-authored-by: Danila Loginov <danila@loginov.rocks>
1 parent 2f7b202 commit 5084d78

File tree

4 files changed

+875
-1551
lines changed

4 files changed

+875
-1551
lines changed

.github/workflows/publish.yml

+11-7
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,45 @@ jobs:
1414
- name: Checkout code
1515
uses: actions/checkout@v2
1616

17-
- name: Check package version
18-
uses: technote-space/package-version-check-action@v1
19-
with:
20-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
17+
- name: Check if version has been updated
18+
id: check
19+
uses: EndBug/version-check@v1
2120

2221
- name: Setup Node 10
22+
if: steps.check.outputs.changed == 'true'
2323
uses: actions/setup-node@v1
2424
with:
2525
node-version: 10
2626
registry-url: https://registry.npmjs.org/
2727

2828
# Setup dependency caching
2929
- uses: actions/cache@v1
30+
if: steps.check.outputs.changed == 'true'
3031
with:
3132
path: ~/.npm
3233
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
3334

3435
- name: Install Dependencies
36+
if: steps.check.outputs.changed == 'true'
3537
env:
3638
CI: true
3739
run: npm ci
3840

3941
- name: Check For Lint
42+
if: steps.check.outputs.changed == 'true'
4043
env:
4144
CI: true
4245
run: npm run lint
4346

4447
- name: Run Unit Tests + Coverage
48+
if: steps.check.outputs.changed == 'true'
4549
env:
4650
CI: true
4751
CODE_CLIMATE: ${{ secrets.CODE_CLIMATE }}
4852
run: npm run test:cov
4953

5054
- name: Publish
55+
if: steps.check.outputs.changed == 'true'
5156
env:
5257
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5358
GITHUB_REF: ${{ github.ref }}
@@ -57,18 +62,17 @@ jobs:
5762
npm publish $PUBLISH_FLAG
5863
5964
- name: Archive Build Artifact
65+
if: steps.check.outputs.changed == 'true'
6066
uses: actions/upload-artifact@master
61-
if: success()
6267
with:
6368
name: build
6469
path: lib
6570

6671
- name: Upload Coverage
67-
if: success()
72+
if: steps.check.outputs.changed == 'true'
6873
env:
6974
CI: true
7075
CODE_COV: ${{ secrets.CODE_COV }}
7176
# Upload to Code Cover. Curl used in place of codecov/codecov-action
7277
# due to long build time. See https://github.com/codecov/codecov-action/issues/21
7378
run: curl -s https://codecov.io/bash | bash -s -- -t $CODE_COV
74-

index.d.ts

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import React from 'react'
1+
import * as React from 'react'
22
import * as FirestoreTypes from '@firebase/firestore-types'
33
import * as DatabaseTypes from '@firebase/database-types'
44
import * as StorageTypes from '@firebase/storage-types'
55
import * as AuthTypes from '@firebase/auth-types'
6-
import * as AppTypes from '@firebase/app-types'
76
import { Dispatch } from 'redux'
87

98
/**
@@ -451,40 +450,43 @@ interface ExtendedFirestoreInstance extends FirestoreTypes.FirebaseFirestore {
451450
* Get data from firestore.
452451
* @see https://github.com/prescottprue/redux-firestore#get
453452
*/
454-
get: (docPath: string | ReduxFirestoreQuerySetting) => Promise<void>
453+
get: <T>(
454+
docPath: string | ReduxFirestoreQuerySetting
455+
) => Promise<FirestoreTypes.DocumentSnapshot<Partial<T>>>
455456

456457
/**
457458
* Set data to firestore.
458459
* @see https://github.com/prescottprue/redux-firestore#set
459460
*/
460-
set: (
461+
set: <T>(
461462
docPath: string | ReduxFirestoreQuerySetting,
462-
data: Object
463-
) => Promise<void>
463+
data: Partial<T>,
464+
options?: FirestoreTypes.SetOptions
465+
) => Promise<FirestoreTypes.DocumentSnapshot<Partial<T>>>
464466

465467
/**
466468
* Add document to firestore.
467469
* @see https://github.com/prescottprue/redux-firestore#add
468470
*/
469-
add: (
471+
add: <T>(
470472
collectionPath: string | ReduxFirestoreQuerySetting,
471-
data: Object
473+
data: Partial<T>
472474
) => Promise<{ id: string }>
473475

474476
/**
475477
* Update document within firestore.
476478
* @see https://github.com/prescottprue/redux-firestore#update
477479
*/
478-
update: (
480+
update: <T>(
479481
docPath: string | ReduxFirestoreQuerySetting,
480-
data: Object
481-
) => Promise<void>
482+
data: Partial<T>
483+
) => Promise<FirestoreTypes.DocumentSnapshot<Partial<T>>>
482484

483485
/**
484486
* Delete a document within firestore.
485487
* @see https://github.com/prescottprue/redux-firestore#delete
486488
*/
487-
delete: (docPath: string | ReduxFirestoreQuerySetting) => Promise<void>
489+
delete: <T>(docPath: string | ReduxFirestoreQuerySetting) => Promise<T>
488490

489491
/**
490492
* Executes the given updateFunction and then attempts to commit the changes applied within the

0 commit comments

Comments
 (0)