@roadmanjs/push 0.0.2 → 1.2.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.
- package/README.md +24 -4
- package/dist/push/Push.test.d.ts +1 -1
- package/dist/push/Push.test.js +36 -17
- package/dist/push/Push.test.js.map +1 -1
- package/dist/push/push.methods.d.ts +17 -4
- package/dist/push/push.methods.js +54 -3
- package/dist/push/push.methods.js.map +1 -1
- package/dist/roadman.js.map +1 -1
- package/dist/user/UserDevice.model.js +16 -15
- package/dist/user/UserDevice.model.js.map +1 -1
- package/docs/roadman.png +0 -0
- package/docs/roadman_dance.gif +0 -0
- package/package.json +9 -45
package/README.md
CHANGED
|
@@ -1,17 +1,37 @@
|
|
|
1
|
-
|
|
2
1
|
<p align="center">
|
|
3
2
|
<h1 align="center"> Roadman - Push </h1>
|
|
4
3
|
</p>
|
|
5
4
|
|
|
5
|
+
<div align="center">
|
|
6
|
+
|
|
7
|
+
<img width="500px" src="./docs/roadman_dance.gif"></img>
|
|
8
|
+
|
|
9
|
+
</div>
|
|
6
10
|
|
|
7
11
|
## A roadman for push notifications
|
|
8
12
|
|
|
13
|
+
### Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm i @roadmanjs/push
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {roadman} from 'roadman';
|
|
23
|
+
import {pushRoadman} from '@roadmanjs/push';
|
|
24
|
+
|
|
25
|
+
await roadman({
|
|
26
|
+
roadmen: [pushRoadman],
|
|
27
|
+
});
|
|
28
|
+
```
|
|
9
29
|
|
|
30
|
+
### Env required
|
|
10
31
|
|
|
11
|
-
#### Env required
|
|
12
32
|
```sh
|
|
13
33
|
DEBUG=roadman*
|
|
14
34
|
|
|
15
|
-
FIREBASE_SA_IOS={"firebase
|
|
16
|
-
FIREBASE_SA_ANDROID={"firebase
|
|
35
|
+
FIREBASE_SA_IOS={"firebase admin service account": ""}
|
|
36
|
+
FIREBASE_SA_ANDROID={"firebase admin service account": ""}
|
|
17
37
|
```
|
package/dist/push/Push.test.d.ts
CHANGED
package/dist/push/Push.test.js
CHANGED
|
@@ -1,28 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("reflect-metadata");
|
|
4
3
|
require("mocha");
|
|
5
|
-
|
|
6
|
-
const couchset_1 = require("@roadmanjs/couchset");
|
|
4
|
+
require("reflect-metadata");
|
|
7
5
|
const push_methods_1 = require("./push.methods");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const chai_1 = require("chai");
|
|
7
|
+
// import {startCouchbase} from '@roadmanjs/couchset';
|
|
8
|
+
// before((done) => {
|
|
9
|
+
// startCouchbase().then(() => done());
|
|
10
|
+
// });
|
|
11
11
|
describe('Push', () => {
|
|
12
|
+
// it('it should send a notification to user', async () => {
|
|
13
|
+
// const userId = '99bc43ba-02ab-4394-b48b-49a39a95443c';
|
|
14
|
+
// const sentMessage = await sendMessageToUser(userId, {
|
|
15
|
+
// data: {
|
|
16
|
+
// type: 'tv',
|
|
17
|
+
// },
|
|
18
|
+
// notification: {
|
|
19
|
+
// title: 'Basic Notification',
|
|
20
|
+
// body: 'This is a basic notification sent from the server!',
|
|
21
|
+
// imageUrl: 'https://my-cdn.com/app-logo.png',
|
|
22
|
+
// sound: 'vuga_zing',
|
|
23
|
+
// },
|
|
24
|
+
// });
|
|
25
|
+
// console.log("sendMessageToUser", sentMessage)
|
|
26
|
+
// expect(sentMessage).to.be.not.empty;
|
|
27
|
+
// });
|
|
12
28
|
it('it should send a notification to user', async () => {
|
|
13
|
-
const
|
|
14
|
-
const sentMessage = await (0, push_methods_1.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
const topic = 'Tv';
|
|
30
|
+
const sentMessage = await (0, push_methods_1.sendMessageToTopic)({
|
|
31
|
+
topic,
|
|
32
|
+
payload: {
|
|
33
|
+
data: {
|
|
34
|
+
type: 'tv',
|
|
35
|
+
},
|
|
36
|
+
notification: {
|
|
37
|
+
title: 'Notification Test',
|
|
38
|
+
body: 'Notification Test',
|
|
39
|
+
// imageUrl: 'https://my-cdn.com/app-logo.png',
|
|
40
|
+
sound: 'vuga_zing',
|
|
41
|
+
},
|
|
23
42
|
},
|
|
24
43
|
});
|
|
25
|
-
console.log(
|
|
44
|
+
console.log('sendMessageToTopic', sentMessage);
|
|
26
45
|
(0, chai_1.expect)(sentMessage).to.be.not.empty;
|
|
27
46
|
});
|
|
28
47
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Push.test.js","sourceRoot":"","sources":["../../src/push/Push.test.ts"],"names":[],"mappings":";;AAAA,4BAA0B;
|
|
1
|
+
{"version":3,"file":"Push.test.js","sourceRoot":"","sources":["../../src/push/Push.test.ts"],"names":[],"mappings":";;AAAA,iBAAe;AACf,4BAA0B;AAE1B,iDAAkD;AAElD,+BAA4B;AAC5B,sDAAsD;AAEtD,qBAAqB;AACrB,2CAA2C;AAC3C,MAAM;AAEN,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IAClB,4DAA4D;IAC5D,6DAA6D;IAC7D,4DAA4D;IAC5D,kBAAkB;IAClB,0BAA0B;IAC1B,aAAa;IACb,0BAA0B;IAC1B,2CAA2C;IAC3C,0EAA0E;IAC1E,2DAA2D;IAC3D,kCAAkC;IAClC,aAAa;IACb,UAAU;IAEV,oDAAoD;IAEpD,2CAA2C;IAC3C,MAAM;IAEN,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC;QACnB,MAAM,WAAW,GAAG,MAAM,IAAA,iCAAkB,EAAC;YACzC,KAAK;YACL,OAAO,EAAE;gBACL,IAAI,EAAE;oBACF,IAAI,EAAE,IAAI;iBACb;gBACD,YAAY,EAAE;oBACV,KAAK,EAAE,mBAAmB;oBAC1B,IAAI,EAAE,mBAAmB;oBACzB,+CAA+C;oBAC/C,KAAK,EAAE,WAAW;iBACrB;aACJ;SACJ,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;QAE/C,IAAA,aAAM,EAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC;IACxC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { FirebaseProject } from '@roadmanjs/firebase-admin';
|
|
2
|
+
import { MessagingDevicesResponse, MessagingOptions, MessagingPayload, MessagingTopicResponse } from 'firebase-admin/messaging';
|
|
3
|
+
export interface PushOptions {
|
|
4
|
+
options?: MessagingOptions;
|
|
5
|
+
payload: MessagingPayload;
|
|
6
|
+
}
|
|
7
|
+
export interface SendToTopic extends PushOptions {
|
|
8
|
+
topic: string;
|
|
9
|
+
client: FirebaseProject;
|
|
10
|
+
}
|
|
11
|
+
export declare const sendToTopic: (args: SendToTopic) => Promise<MessagingTopicResponse | null>;
|
|
12
|
+
export interface SendMessageToTopic extends PushOptions {
|
|
13
|
+
topic: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const sendMessageToTopic: (args: SendMessageToTopic) => Promise<MessagingTopicResponse[] | null>;
|
|
16
|
+
export interface SendNotification {
|
|
3
17
|
options?: MessagingOptions;
|
|
4
18
|
payload: MessagingPayload;
|
|
5
19
|
iosTokens: string[];
|
|
@@ -12,5 +26,4 @@ export declare const sendNotification: (args: SendNotification) => Promise<Messa
|
|
|
12
26
|
* @param payload
|
|
13
27
|
* @param options
|
|
14
28
|
*/
|
|
15
|
-
export declare const sendMessageToUser: (owner: string, payload: MessagingPayload, options?: MessagingOptions) => Promise<MessagingDevicesResponse[]>;
|
|
16
|
-
export {};
|
|
29
|
+
export declare const sendMessageToUser: (owner: string, payload: MessagingPayload, options?: MessagingOptions) => Promise<MessagingDevicesResponse[] | null>;
|
|
@@ -3,13 +3,64 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.sendMessageToUser = exports.sendNotification = void 0;
|
|
6
|
+
exports.sendMessageToUser = exports.sendNotification = exports.sendMessageToTopic = exports.sendToTopic = void 0;
|
|
7
|
+
const firebase_admin_1 = require("@roadmanjs/firebase-admin");
|
|
7
8
|
const user_1 = require("../user");
|
|
9
|
+
const config_1 = require("../config");
|
|
8
10
|
const auth_1 = require("@roadmanjs/auth");
|
|
9
11
|
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
10
12
|
const logs_1 = require("@roadmanjs/logs");
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
+
const sendToTopic = async (args) => {
|
|
14
|
+
try {
|
|
15
|
+
const { client, options, payload, topic } = args;
|
|
16
|
+
const sentToTopic = await client.messaging().sendToTopic(topic, payload, options);
|
|
17
|
+
(0, logs_1.log)('messaging().sendToTopic', JSON.stringify(sentToTopic));
|
|
18
|
+
return sentToTopic;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
(0, logs_1.log)('messaging().sendToTopic', error);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.sendToTopic = sendToTopic;
|
|
26
|
+
const sendMessageToTopic = async (args) => {
|
|
27
|
+
const { payload, topic } = args;
|
|
28
|
+
const response = [];
|
|
29
|
+
const options = args.options || {
|
|
30
|
+
// Required for background/quit data-only messages on iOS
|
|
31
|
+
contentAvailable: true,
|
|
32
|
+
// Required for background/quit data-only messages on Android
|
|
33
|
+
priority: 'high',
|
|
34
|
+
};
|
|
35
|
+
try {
|
|
36
|
+
const iosClient = await (0, firebase_admin_1.configureFirebase)(config_1.firebaseIos);
|
|
37
|
+
const androidClient = await (0, firebase_admin_1.configureFirebase)(config_1.firebaseAndroid);
|
|
38
|
+
if (iosClient) {
|
|
39
|
+
const iosSent = await (0, exports.sendToTopic)({
|
|
40
|
+
client: iosClient,
|
|
41
|
+
options,
|
|
42
|
+
payload,
|
|
43
|
+
topic,
|
|
44
|
+
});
|
|
45
|
+
response.push(iosSent);
|
|
46
|
+
}
|
|
47
|
+
if (androidClient) {
|
|
48
|
+
const androidSent = await (0, exports.sendToTopic)({
|
|
49
|
+
client: androidClient,
|
|
50
|
+
options,
|
|
51
|
+
payload,
|
|
52
|
+
topic,
|
|
53
|
+
});
|
|
54
|
+
response.push(androidSent);
|
|
55
|
+
}
|
|
56
|
+
return response;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
(0, logs_1.log)('error sending notification to topic', error);
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.sendMessageToTopic = sendMessageToTopic;
|
|
13
64
|
const sendNotification = async (args) => {
|
|
14
65
|
const { payload, iosTokens = [], androidTokens = [] } = args;
|
|
15
66
|
const response = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.methods.js","sourceRoot":"","sources":["../../src/push/push.methods.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"push.methods.js","sourceRoot":"","sources":["../../src/push/push.methods.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6E;AAO7E,kCAAwD;AACxD,sCAAuD;AAEvD,0CAA0C;AAC1C,6DAAqC;AACrC,0CAAoC;AAY7B,MAAM,WAAW,GAAG,KAAK,EAAE,IAAiB,EAA0C,EAAE;IAC3F,IAAI,CAAC;QACD,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC;QAC/C,MAAM,WAAW,G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AAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,KAAK,KAAK,CAAC;qBAC/C,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;gBAE/C,OAAO,MAAM,IAAA,wBAAgB,EAAC;oBAC1B,aAAa;oBACb,SAAS;oBACT,OAAO;oBACP,OAAO;iBACV,CAAC,CAAC;YACP,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC3D,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAA,UAAG,EAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;AACL,CAAC,CAAC;AApCW,QAAA,iBAAiB,qBAoC5B"}
|
package/dist/roadman.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roadman.js","sourceRoot":"","sources":["../src/roadman.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AAGvB,qCAA8D;AAE9D;;;GAGG;AACI,MAAM,WAAW,GAAY,KAAK,EAAE,IAAkB,EAAyB,EAAE;IACpF,IAAI,CAAC,4BAAmB,IAAI,CAAC,wBAAe,EAAE;
|
|
1
|
+
{"version":3,"file":"roadman.js","sourceRoot":"","sources":["../src/roadman.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AAGvB,qCAA8D;AAE9D;;;GAGG;AACI,MAAM,WAAW,GAAY,KAAK,EAAE,IAAkB,EAAyB,EAAE;IACpF,IAAI,CAAC,4BAAmB,IAAI,CAAC,wBAAe,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AALW,QAAA,WAAW,eAKtB;AAEF,kBAAe,mBAAW,CAAC"}
|
|
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.UserDeviceModel = exports.allUserDeviceModelKeys = exports.UserDeviceType = exports.userDeviceModelName = void 0;
|
|
10
|
+
const type_graphql_1 = require("type-graphql");
|
|
10
11
|
const couchset_1 = require("couchset");
|
|
11
12
|
exports.userDeviceModelName = 'UserDevice';
|
|
12
13
|
/**
|
|
@@ -30,46 +31,46 @@ let UserDeviceType = class UserDeviceType {
|
|
|
30
31
|
this.updatedAt = new Date();
|
|
31
32
|
}
|
|
32
33
|
};
|
|
34
|
+
exports.UserDeviceType = UserDeviceType;
|
|
33
35
|
__decorate([
|
|
34
|
-
(0,
|
|
36
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
35
37
|
], UserDeviceType.prototype, "id", void 0);
|
|
36
38
|
__decorate([
|
|
37
|
-
(0,
|
|
39
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
38
40
|
], UserDeviceType.prototype, "unique", void 0);
|
|
39
41
|
__decorate([
|
|
40
|
-
(0,
|
|
42
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
41
43
|
], UserDeviceType.prototype, "owner", void 0);
|
|
42
44
|
__decorate([
|
|
43
|
-
(0,
|
|
45
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
44
46
|
], UserDeviceType.prototype, "countryCode", void 0);
|
|
45
47
|
__decorate([
|
|
46
|
-
(0,
|
|
48
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
47
49
|
], UserDeviceType.prototype, "pushtoken", void 0);
|
|
48
50
|
__decorate([
|
|
49
|
-
(0,
|
|
51
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
50
52
|
], UserDeviceType.prototype, "appversion", void 0);
|
|
51
53
|
__decorate([
|
|
52
|
-
(0,
|
|
54
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
53
55
|
], UserDeviceType.prototype, "imei", void 0);
|
|
54
56
|
__decorate([
|
|
55
|
-
(0,
|
|
57
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
56
58
|
], UserDeviceType.prototype, "osid", void 0);
|
|
57
59
|
__decorate([
|
|
58
|
-
(0,
|
|
60
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
59
61
|
], UserDeviceType.prototype, "osName", void 0);
|
|
60
62
|
__decorate([
|
|
61
|
-
(0,
|
|
63
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
62
64
|
], UserDeviceType.prototype, "clientType", void 0);
|
|
63
65
|
__decorate([
|
|
64
|
-
(0,
|
|
66
|
+
(0, type_graphql_1.Field)(() => Date, { nullable: true })
|
|
65
67
|
], UserDeviceType.prototype, "createdAt", void 0);
|
|
66
68
|
__decorate([
|
|
67
|
-
(0,
|
|
69
|
+
(0, type_graphql_1.Field)(() => Date, { nullable: true })
|
|
68
70
|
], UserDeviceType.prototype, "updatedAt", void 0);
|
|
69
|
-
UserDeviceType = __decorate([
|
|
70
|
-
(0,
|
|
71
|
+
exports.UserDeviceType = UserDeviceType = __decorate([
|
|
72
|
+
(0, type_graphql_1.ObjectType)('UserDeviceType')
|
|
71
73
|
], UserDeviceType);
|
|
72
|
-
exports.UserDeviceType = UserDeviceType;
|
|
73
74
|
exports.allUserDeviceModelKeys = Object.getOwnPropertyNames(new UserDeviceType());
|
|
74
75
|
exports.UserDeviceModel = new couchset_1.Model(exports.userDeviceModelName);
|
|
75
76
|
exports.default = exports.UserDeviceModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserDevice.model.js","sourceRoot":"","sources":["../../src/user/UserDevice.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"UserDevice.model.js","sourceRoot":"","sources":["../../src/user/UserDevice.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAA+C;AAC/C,uCAA+B;AAElB,QAAA,mBAAmB,GAAG,YAAY,CAAC;AAChD;;GAEG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C,CAAC;4CAC5B;AAGV;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;4CAC5B;AAGV;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;8CACjB;AAIrB;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;kDACb;AAGzB;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;iDACN;AAG9B;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;iDACN;yBArCrB,cAAc;IAD1B,IAAA,yBAAU,EAAC,gBAAgB,CAAC;GAChB,cAAc,CAsC1B;AAEY,QAAA,sBAAsB,GAAa,MAAM,CAAC,mBAAmB,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC;AAEpF,QAAA,eAAe,GAAU,IAAI,gBAAK,CAAC,2BAAmB,CAAC,CAAC;AAErE,kBAAe,uBAAe,CAAC"}
|
package/docs/roadman.png
ADDED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roadmanjs/push",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "An roadman for push notifications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
"private": false,
|
|
20
20
|
"scripts": {
|
|
21
21
|
"lint": "tslint \"src/**/*.ts\" --project tsconfig.json",
|
|
22
|
-
"build": "rm -rf dist &&
|
|
22
|
+
"build": "rm -rf dist && tsc --skipLibCheck",
|
|
23
23
|
"push": "mocha src/push/*test.ts --exit",
|
|
24
24
|
"users": "mocha src/user/*test.ts --exit",
|
|
25
|
-
"eslint": "eslint ./src --fix --ext=ts"
|
|
25
|
+
"eslint": "eslint ./src --fix --ext=ts",
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
26
27
|
},
|
|
27
28
|
"lint-staged": {
|
|
28
29
|
"*.{ts,tsx}": [
|
|
@@ -35,49 +36,12 @@
|
|
|
35
36
|
}
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@types/chai": "^4.2.14",
|
|
40
|
-
"@types/chalk": "^2.2.0",
|
|
41
|
-
"@types/debug": "^4.1.5",
|
|
42
|
-
"@types/dotenv": "^8.2.0",
|
|
43
|
-
"@types/jsonwebtoken": "^8.5.8",
|
|
44
|
-
"@types/lodash": "^4.14.168",
|
|
45
|
-
"@types/mocha": "^8.2.0",
|
|
46
|
-
"@types/node": "^10.0.3",
|
|
47
|
-
"@types/source-map-support": "^0.4.0",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^3.4.0",
|
|
49
|
-
"@typescript-eslint/parser": "^3.4.0",
|
|
50
|
-
"chai": "^4.2.0",
|
|
51
|
-
"eslint": "7.32.0",
|
|
52
|
-
"eslint-config-prettier": "^6.11.0",
|
|
53
|
-
"eslint-loader": "^4.0.2",
|
|
54
|
-
"eslint-plugin-import": "^2.20.2",
|
|
55
|
-
"eslint-plugin-json": "^2.1.1",
|
|
56
|
-
"eslint-plugin-prettier": "^3.1.4",
|
|
57
|
-
"eslint-plugin-simple-import-sort": "^5.0.2",
|
|
58
|
-
"eslint-plugin-typescript": "^0.14.0",
|
|
59
|
-
"husky": "^4.2.5",
|
|
60
|
-
"lint-staged": "^10.1.7",
|
|
61
|
-
"mocha": "^9.2.0",
|
|
62
|
-
"prettier": "^2.0.5",
|
|
63
|
-
"rimraf": "^2.5.4",
|
|
64
|
-
"ts-node": "^9.1.1",
|
|
65
|
-
"tslint": "^5.11.0",
|
|
66
|
-
"tslint-config-standard": "^8.0.1",
|
|
67
|
-
"typescript": "^4.4.3"
|
|
68
|
-
},
|
|
69
|
-
"peerDependencies": {
|
|
70
|
-
"@roadmanjs/auth": ">=0.0.27",
|
|
71
|
-
"@roadmanjs/couchset": ">=0.0.3",
|
|
72
|
-
"@roadmanjs/firebase-admin": ">=0.0.17",
|
|
73
|
-
"@roadmanjs/logs": ">=0.0.1",
|
|
74
|
-
"typescript": ">=2.0"
|
|
39
|
+
"@roadmanjs/eslint-config": "*"
|
|
75
40
|
},
|
|
76
41
|
"dependencies": {
|
|
77
|
-
"@roadmanjs/auth": "
|
|
78
|
-
"@roadmanjs/couchset": "
|
|
79
|
-
"@roadmanjs/firebase-admin": "
|
|
80
|
-
"@roadmanjs/logs": "
|
|
81
|
-
"@roadmanjs/utils": "^0.0.4"
|
|
42
|
+
"@roadmanjs/auth": "*",
|
|
43
|
+
"@roadmanjs/couchset": "*",
|
|
44
|
+
"@roadmanjs/firebase-admin": "*",
|
|
45
|
+
"@roadmanjs/logs": "*"
|
|
82
46
|
}
|
|
83
47
|
}
|