@joystick.js/node-canary 0.0.0-canary.419 → 0.0.0-canary.420
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/dist/app/push_logs.js +1 -0
- package/dist/index.js +2 -2
- package/package.json +2 -1
- package/src/app/push_logs.js +36 -0
- package/src/index.js +5 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"winston";const e=t.createLogger({format:t.format.combine(t.format.timestamp(),t.format.json()),transports:[new t.transports.File({filename:"/push/logs/app.log",maxsize:1024*1024*20,maxFiles:1,tailable:!0})]}),r=()=>{process.stdout.write=o=>{e.debug(o)},process.stderr.write=o=>{e.error(o)},process.on("uncaughtException",o=>{e.error(o instanceof Error?o?.toString():o)}),process.on("unhandledRejection",o=>{e.error(o instanceof Error?o?.toString():o)})};var n=r;export{n as default};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import s from"fs";import t from"./app/accounts/index.js";import i from"./action/index.js";import n from"./lib/escape_html.js";import
|
|
1
|
+
import s from"fs";import t from"./app/accounts/index.js";import i from"./action/index.js";import n from"./lib/escape_html.js";import p from"./app/fixture/index.js";import a from"./app/databases/sql.js";import c from"./app/api/validate_input.js";import m from"./app/websockets/index.js";import l from"./app/index.js";import _ from"./lib/generate_id.js";import f from"./lib/get_origin.js";import u from"./app/settings/load.js";import d from"./lib/node_path_polyfills.js";import o from"./lib/path_exists.js";import x from"./app/email/send.js";import w from"./app/push_logs.js";const{readFile:e}=s.promises;process.env.NODE_ENV!=="development"&&process.env.IS_PUSH_DEPLOYED&&w();const v={...t,deleteUser:t.delete_user,recoverPassword:t.recover_password,resetPassword:t.reset_password,sendEmailVerification:t.send_email_verification,setPassword:t.set_password,verifyEmail:t.verify_email},h=i,g={send:x},k=n,E=p,y=f(),P={continent:await o("/root/push/continent.txt")?(await e("/root/push/continent.txt","utf-8"))?.replace(`
|
|
2
2
|
`,""):null,instance_token:await o("/root/push/instance_token.txt")?(await e("/root/push/instance_token.txt","utf-8"))?.replace(`
|
|
3
3
|
`,""):null,current_version:await o("/root/push/versions/current")?(await e("/root/push/versions/current","utf-8"))?.replace(`
|
|
4
|
-
`,""):null},
|
|
4
|
+
`,""):null},b=u(),D=a,j=c,q=m,r={app:l,accounts:v,action:h,email:g,emitters:{},escape_html:k,fixture:E,id:_,origin:y,push:P,settings:b,sql:D,validate_input:j,websockets:q,...d};global.joystick=r;var K=r;export{v as accounts,h as action,K as default,g as email,k as escape_html,E as fixture,y as origin,P as push,b as settings,D as sql,j as validate_input,q as websockets};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joystick.js/node-canary",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-canary.
|
|
4
|
+
"version": "0.0.0-canary.420",
|
|
5
5
|
"description": "The Node.js framework for Joystick.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"scripts": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"process": "^0.11.10",
|
|
37
37
|
"query-string": "^8.1.0",
|
|
38
38
|
"serve-favicon": "^2.5.0",
|
|
39
|
+
"winston": "^3.12.0",
|
|
39
40
|
"ws": "^8.15.1"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import winston from 'winston';
|
|
2
|
+
|
|
3
|
+
const logger = winston.createLogger({
|
|
4
|
+
format: winston.format.combine(
|
|
5
|
+
winston.format.timestamp(),
|
|
6
|
+
winston.format.json(),
|
|
7
|
+
),
|
|
8
|
+
transports: [
|
|
9
|
+
new winston.transports.File({
|
|
10
|
+
filename: '/push/logs/app.log',
|
|
11
|
+
maxsize: 1024 * 1024 * 20, // 20MB,
|
|
12
|
+
maxFiles: 1,
|
|
13
|
+
tailable: true,
|
|
14
|
+
})
|
|
15
|
+
],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const push_logs = () => {
|
|
19
|
+
process.stdout.write = (data) => {
|
|
20
|
+
logger.debug(data);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
process.stderr.write = (data) => {
|
|
24
|
+
logger.error(data);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
process.on('uncaughtException', (error) => {
|
|
28
|
+
logger.error(error instanceof Error ? error?.toString() : error);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
process.on('unhandledRejection', (error) => {
|
|
32
|
+
logger.error(error instanceof Error ? error?.toString() : error);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default push_logs;
|
package/src/index.js
CHANGED
|
@@ -13,9 +13,14 @@ import load_settings from './app/settings/load.js';
|
|
|
13
13
|
import node_path_polyfills from './lib/node_path_polyfills.js';
|
|
14
14
|
import path_exists from './lib/path_exists.js';
|
|
15
15
|
import send_email from './app/email/send.js';
|
|
16
|
+
import push_logs from './app/push_logs.js';
|
|
16
17
|
|
|
17
18
|
const { readFile } = fs.promises;
|
|
18
19
|
|
|
20
|
+
if (process.env.NODE_ENV !== "development" && process.env.IS_PUSH_DEPLOYED) {
|
|
21
|
+
push_logs();
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
// NOTE: Ensure backwards compatibility for existing apps by offering
|
|
20
25
|
// original camelCase versions of methods.
|
|
21
26
|
export const accounts = {
|