From fbd24320648d33a99b0512954079870a88dfe1e0 Mon Sep 17 00:00:00 2001 From: Chaitanya Bankanhal Date: Sun, 14 Jun 2020 12:21:27 +0530 Subject: [PATCH 1/2] Use babel presets --- .babelrc | 30 ------------------------------ babel.config.json | 6 ++++++ src/axiosInstance.js | 9 ++++----- src/index.js | 10 +++++++--- 4 files changed, 17 insertions(+), 38 deletions(-) delete mode 100644 .babelrc create mode 100644 babel.config.json diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 1447af2..0000000 --- a/.babelrc +++ /dev/null @@ -1,30 +0,0 @@ -{ - "plugins": [ - "check-es2015-constants", - "transform-es2015-arrow-functions", - "transform-es2015-block-scoping", - "transform-es2015-function-name", - "transform-es2015-parameters", - "transform-es2015-spread", - "transform-es2015-template-literals" - ], - "env": { - "commonjs": { - "plugins": [ - ["transform-es2015-modules-commonjs", { "loose": true }] - ] - }, - "umd": { - "plugins": [ - ["transform-es2015-modules-umd", { "loose": true }] - ], - "moduleId": "Reselect" - }, - "test": { - "plugins": [ - ["transform-es2015-modules-commonjs", { "loose": true }], - "transform-es2015-shorthand-properties" - ] - } - } -} \ No newline at end of file diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 0000000..900d6c4 --- /dev/null +++ b/babel.config.json @@ -0,0 +1,6 @@ +{ + "presets": [ + "stage-2", + "react" + ] +} \ No newline at end of file diff --git a/src/axiosInstance.js b/src/axiosInstance.js index 9b1be6f..c76afbd 100644 --- a/src/axiosInstance.js +++ b/src/axiosInstance.js @@ -1,6 +1,5 @@ -const axios = require("axios"); - -const constants = require("./constants"); +import axios from "axios"; +import {AUTH_KEY, IP_ADDRESS_KEY} from "./constants"; /** * Global level axios configuration. These settings are automatically used in other places by using an axiosInstance instead of axios directly @@ -15,9 +14,9 @@ export let axiosInstance = axios.create({ */ axiosInstance.interceptors.request.use( config => { - config.baseURL = localStorage.getItem(constants.IP_ADDRESS_KEY); + config.baseURL = localStorage.getItem(IP_ADDRESS_KEY); - config.headers.Authorization = 'Basic ' + localStorage.getItem(constants.AUTH_KEY); + config.headers.Authorization = 'Basic ' + localStorage.getItem(AUTH_KEY); return config; }, error => Promise.reject(error) diff --git a/src/index.js b/src/index.js index d1dc2f6..8139c19 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,10 @@ -const axiosInstance = require('./axiosInstance'); -const urls = require('./endpoint'); -const tools = require('./Tools') +import {axiosInstance} from "./axiosInstance"; +import urls from "./endpoint"; +import {addColonAtLast, isLocalRemoteName} from "./Tools"; + +// const axiosInstance = require('./axiosInstance'); +// const urls = require('./endpoint'); +// const tools = require('./Tools') /** * getStats returns the current rclone stats. From 37127d6d8085c5eb39c5da558a91b8d9a79c241d Mon Sep 17 00:00:00 2001 From: Chaitanya Bankanhal Date: Sun, 14 Jun 2020 12:21:51 +0530 Subject: [PATCH 2/2] 1.0.7-2 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6d471d1..9589755 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "rclone-api", - "version": "1.0.7-1", + "version": "1.0.7-2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 134a3d7..ad5ba1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rclone-api", - "version": "1.0.7-1", + "version": "1.0.7-2", "description": "Java Script bindings for rclone rc api", "main": "lib/index.js", "scripts": {