Added babel for ES6 functionality. In this case the new import statements
This commit is contained in:
		| @@ -7,8 +7,8 @@ | |||||||
|   }, |   }, | ||||||
|   "main": "webserver/server.js", |   "main": "webserver/server.js", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "start": "cross-env SEASONED_CONFIG=conf/development.json PROD=true NODE_PATH=. node src/webserver/server.js", |     "start": "cross-env SEASONED_CONFIG=conf/development.json PROD=true NODE_PATH=. babel-node src/webserver/server.js", | ||||||
|     "test": "cross-env SEASONED_CONFIG=conf/test.json NODE_PATH=. mocha --recursive test/unit test/system", |     "test": "cross-env SEASONED_CONFIG=conf/test.json NODE_PATH=. mocha --require @babel/register --recursive test/unit test/system", | ||||||
|     "coverage": "cross-env SEASONED_CONFIG=conf/test.json NODE_PATH=. nyc mocha --recursive test && nyc report --reporter=text-lcov | coveralls", |     "coverage": "cross-env SEASONED_CONFIG=conf/test.json NODE_PATH=. nyc mocha --recursive test && nyc report --reporter=text-lcov | coveralls", | ||||||
|     "lint": "./node_modules/.bin/eslint src/", |     "lint": "./node_modules/.bin/eslint src/", | ||||||
|     "update": "cross-env SEASONED_CONFIG=conf/development.json NODE_PATH=. node src/plex/updateRequestsInPlex.js", |     "update": "cross-env SEASONED_CONFIG=conf/development.json NODE_PATH=. node src/plex/updateRequestsInPlex.js", | ||||||
| @@ -32,6 +32,10 @@ | |||||||
|     "sqlite3": "^4.0.0" |     "sqlite3": "^4.0.0" | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|  |     "@babel/core": "^7.5.5", | ||||||
|  |     "@babel/node": "^7.5.5", | ||||||
|  |     "@babel/preset-env": "^7.5.5", | ||||||
|  |     "@babel/register": "^7.5.5", | ||||||
|     "coveralls": "^3.0.0", |     "coveralls": "^3.0.0", | ||||||
|     "documentation": "^12.0.3", |     "documentation": "^12.0.3", | ||||||
|     "eslint": "^4.9.0", |     "eslint": "^4.9.0", | ||||||
|   | |||||||
| @@ -25,7 +25,7 @@ class SqliteDatabase { | |||||||
|    * @param {Array} parameters in the SQL query |    * @param {Array} parameters in the SQL query | ||||||
|    * @returns {Promise} |    * @returns {Promise} | ||||||
|    */ |    */ | ||||||
|    async run(sql, parameters) { |    run(sql, parameters) { | ||||||
|       return new Promise((resolve, reject) => { |       return new Promise((resolve, reject) => { | ||||||
|          this.connection.run(sql, parameters, (error, result) => { |          this.connection.run(sql, parameters, (error, result) => { | ||||||
|             if (error) |             if (error) | ||||||
| @@ -41,7 +41,7 @@ class SqliteDatabase { | |||||||
|    * @param {Array} parameters in the SQL query |    * @param {Array} parameters in the SQL query | ||||||
|    * @returns {Promise} |    * @returns {Promise} | ||||||
|    */ |    */ | ||||||
|    async all(sql, parameters) { |    all(sql, parameters) { | ||||||
|       return new Promise((resolve, reject) => { |       return new Promise((resolve, reject) => { | ||||||
|          this.connection.all(sql, parameters, (err, rows) => { |          this.connection.all(sql, parameters, (err, rows) => { | ||||||
|             if (err) { |             if (err) { | ||||||
| @@ -58,7 +58,7 @@ class SqliteDatabase { | |||||||
|    * @param {Array} parameters in the SQL query |    * @param {Array} parameters in the SQL query | ||||||
|    * @returns {Promise} |    * @returns {Promise} | ||||||
|    */ |    */ | ||||||
|    async get(sql, parameters) { |    get(sql, parameters) { | ||||||
|       return new Promise((resolve, reject) => { |       return new Promise((resolve, reject) => { | ||||||
|          this.connection.get(sql, parameters, (err, rows) => { |          this.connection.get(sql, parameters, (err, rows) => { | ||||||
|             if (err) { |             if (err) { | ||||||
| @@ -75,7 +75,7 @@ class SqliteDatabase { | |||||||
|    * @param {Array} parameters in the SQL query |    * @param {Array} parameters in the SQL query | ||||||
|    * @returns {Promise} |    * @returns {Promise} | ||||||
|    */ |    */ | ||||||
|    async execute(sql) { |    execute(sql) { | ||||||
|       return new Promise(resolve => { |       return new Promise(resolve => { | ||||||
|          this.connection.exec(sql, (err, database) => { |          this.connection.exec(sql, (err, database) => { | ||||||
|              if (err) { |              if (err) { | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								seasoned_api/src/tmdb/.babelrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								seasoned_api/src/tmdb/.babelrc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | { | ||||||
|  |   "presets": ["@babel/preset-env"] | ||||||
|  | } | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| const Movie = require('src/tmdb/types/movie'); | import { Movie } from './types' | ||||||
|  |  | ||||||
| const tmdbSwitcher = (tmdbMovie, property) => tmdbMovie[property] | const tmdbSwitcher = (tmdbMovie, property) => tmdbMovie[property] | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| const Person = require('src/tmdb/types/person'); | import { Person } from './types' | ||||||
| const convertTmdbToMovie = require('src/tmdb/convertTmdbToMovie'); | const convertTmdbToMovie = require('src/tmdb/convertTmdbToMovie'); | ||||||
|  |  | ||||||
| function convertTmdbToPerson(tmdbPerson, cast=undefined) { | function convertTmdbToPerson(tmdbPerson, cast=undefined) { | ||||||
|   | |||||||
| @@ -1,5 +1,4 @@ | |||||||
| const TMDB = require('src/media_classes/tmdb'); | const TMDB = require('src/media_classes/tmdb'); | ||||||
| const Movie = require('src/types/movie'); |  | ||||||
|  |  | ||||||
| function translateYear(tmdbReleaseDate) { | function translateYear(tmdbReleaseDate) { | ||||||
|    return new Date(tmdbReleaseDate).getFullYear(); |    return new Date(tmdbReleaseDate).getFullYear(); | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| const Show = require('src/tmdb/types/show'); | import { Show } from './types' | ||||||
|  |  | ||||||
| function convertTmdbToShow(tmdbShow, credits=undefined) { | function convertTmdbToShow(tmdbShow, credits=undefined) { | ||||||
|   const show = new Show(tmdbShow.id, tmdbShow.name) |   const show = new Show(tmdbShow.id, tmdbShow.name) | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ const moviedb = require('km-moviedb'); | |||||||
| const convertTmdbToMovie = require('src/tmdb/convertTmdbToMovie'); | const convertTmdbToMovie = require('src/tmdb/convertTmdbToMovie'); | ||||||
| const convertTmdbToShow = require('src/tmdb/convertTmdbToShow'); | const convertTmdbToShow = require('src/tmdb/convertTmdbToShow'); | ||||||
| const convertTmdbToPerson = require('src/tmdb/convertTmdbToPerson'); | const convertTmdbToPerson = require('src/tmdb/convertTmdbToPerson'); | ||||||
| const { tmdbInfo } = require('src/tmdb/types') | // const { tmdbInfo } = require('src/tmdb/types') | ||||||
|  |  | ||||||
| class TMDB { | class TMDB { | ||||||
|   constructor(cache, apiKey, tmdbLibrary) { |   constructor(cache, apiKey, tmdbLibrary) { | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								seasoned_api/src/tmdb/types.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								seasoned_api/src/tmdb/types.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | import Movie from './types/movie.js' | ||||||
|  | import Show from './types/show.js' | ||||||
|  | import Person from './types/person.js' | ||||||
|  |  | ||||||
|  | module.exports = { Movie, Show, Person } | ||||||
		Reference in New Issue
	
	Block a user