1
0
mirror of https://github.com/nttgin/BGPalerter.git synced 2024-05-19 06:50:08 +00:00

ugraded to babel 7

This commit is contained in:
Massimo Candela
2019-07-09 22:37:30 +02:00
parent f3e8e8c00b
commit 1f7b96709d
5 changed files with 1877 additions and 1066 deletions

View File

@@ -1,8 +1,20 @@
{
"presets": ["env"],
"plugins": [
"transform-class-properties",
"transform-async-to-generator",
"transform-object-rest-spread"
]
}
{
"presets": [
"@babel/preset-env"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-async-to-generator",
"@babel/plugin-proposal-object-rest-spread"
],
"ignore": [
"./node_modules",
"./assets",
"./view",
"./tests",
"./logs",
"./build",
"./bin.js"
]
}

1
bin.js
View File

@@ -1 +0,0 @@
console.log(require('.')(process.argv[2]));

View File

@@ -1,65 +0,0 @@
import { config, logger } from "./env";
import winston from 'winston';
require('winston-daily-rotate-file');
const { combine, timestamp, label, printf } = winston.format;
const environment = "dev"; // Get the real one later
const formatLine = printf(({ level, message, label, timestamp }) => {
return `${timestamp} [${label}] ${level}: ${message}`;
});
const verboseFilter = winston.format((info, opts) => {
return info.level === 'verbose' ? info : false
});
const transportError = new (winston.transports.DailyRotateFile)({
filename: config.logging.directory + '/error-%DATE%.log',
datePattern: config.logging.logRotatePattern,
zippedArchive: config.logging.zippedArchive,
maxSize: config.logging.maxSize,
maxFiles: config.logging.maxFiles,
level: 'error',
timestamp: true,
eol: '\n',
json: false,
format: combine(
label({ label: environment}),
timestamp(),
formatLine
)
});
const transportReports = new (winston.transports.DailyRotateFile)({
filename: config.logging.directory + '/reports-%DATE%.log',
datePattern: config.logging.logRotatePattern,
zippedArchive: config.logging.zippedArchive,
maxSize: config.logging.maxSize,
maxFiles: config.logging.maxFiles,
level: 'verbose',
timestamp: true,
eol: '\n',
json: false,
format: combine(
verboseFilter(),
label({ label: environment}),
timestamp(),
formatLine
)
});
const logger = winston.createLogger({
level: 'info',
transports: [
transportError,
transportReports
]
});
if (environment === 'prod') {
logger.remove(logger.transports.Console);
}
module.exports = logger;

View File

@@ -1,46 +1,63 @@
{
"name": "bgpalerter",
"version": "1.0.0",
"description": "",
"main": "index.js",
"bin": "bin.js",
"scripts": {
"test": "./node_modules/.bin/mocha tests --require babel-core/register",
"build": "",
"watch-and-serve": "nodemon --inspect --exec babel-node index.js",
"serve": "nodemon --exec babel-node index.js"
},
"author": "Massimo Candela",
"license": "ISC",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"chai": "^4.2.0",
"chai-subset": "^1.6.0",
"mocha": "^6.1.4",
"nodemon": "^1.19.1",
"read-last-lines": "^1.7.1"
},
"dependencies": {
"babel-core": "^6.26.3",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"brembo": "^2.0.3",
"event-stream": "^4.0.1",
"ip": "https://github.com/MaxCam/node-ip.git#contains-prefix",
"js-yaml": "^3.13.1",
"nodemailer": "^6.2.1",
"path": "^0.12.7",
"pkg": "^4.4.0",
"pubsub-js": "^1.7.0",
"websocket-stream": "^5.5.0",
"winston": "^3.2.1",
"winston-daily-rotate-file": "^3.9.0",
"ws": "^7.0.0",
"yarn": "^1.16.0"
}
}
{
"name": "bgpalerter",
"version": "1.0.0",
"description": "",
"main": "index.js",
"bin": "index.js",
"scripts": {
"babel": "./node_modules/.bin/babel",
"test": "./node_modules/.bin/mocha tests --require babel-core/register",
"build": "babel src -d build",
"watch-and-serve": "nodemon --inspect --exec babel-node index.js",
"serve": "nodemon --exec babel-node index.js"
},
"author": "Massimo Candela",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/node": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"chai": "^4.2.0",
"chai-subset": "^1.6.0",
"mocha": "^6.1.4",
"nodemon": "^1.19.1",
"read-last-lines": "^1.7.1"
},
"dependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-upgrade": "^1.0.1",
"brembo": "^2.0.3",
"event-stream": "^4.0.1",
"ip": "https://github.com/MaxCam/node-ip.git#contains-prefix",
"js-yaml": "^3.13.1",
"nodemailer": "^6.2.1",
"path": "^0.12.7",
"pubsub-js": "^1.7.0",
"websocket-stream": "^5.5.0",
"winston": "^3.2.1",
"winston-daily-rotate-file": "^3.9.0",
"ws": "^7.0.0",
"yarn": "^1.16.0",
"pkg": "^4.4.0"
},
"pkg": {
"scripts": [
"./inputs/*.js",
"./monitors/*.js",
"./reports/*.js",
"./connectors/*.js"
],
"assets": [
"./bin/config.yml"
],
"targets": [
"node10"
]
}
}

2740
yarn.lock

File diff suppressed because it is too large Load Diff