From ff1c73b47332b7144d6d12044dcf824344a5d4b1 Mon Sep 17 00:00:00 2001 From: Chaitanya Bankanhal Date: Sun, 14 Jun 2020 12:11:36 +0530 Subject: [PATCH 1/2] Use require instead of import --- .gitignore | 4 +++- package.json | 5 ++--- src/axiosInstance.js | 10 ++++++---- src/index.js | 15 ++++++++------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index bef66f1..5a9968d 100644 --- a/.gitignore +++ b/.gitignore @@ -196,4 +196,6 @@ temp/ # End of https://www.gitignore.io/api/node,intellij+all -/lib/ \ No newline at end of file +/lib/ + +/.idea/ diff --git a/package.json b/package.json index 811db11..686b0ea 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,8 @@ "main": "lib/index.js", "scripts": { "test": "echo \"Skipping tests for now TODO\"", - "compile:commonjs": "better-npm-run compile:commonjs", - "compile:es": "babel -d es/ src/", - "compile": "babel src --out-dir lib", + "compile:es": "babel src --out-dir lib", + "compile": "npm run compile:es ", "prepare": "npm run compile" }, "babel": { diff --git a/src/axiosInstance.js b/src/axiosInstance.js index e3d5d1c..9b1be6f 100644 --- a/src/axiosInstance.js +++ b/src/axiosInstance.js @@ -1,5 +1,6 @@ -import axios from "axios"; -import {AUTH_KEY, IP_ADDRESS_KEY} from "./constants"; +const axios = require("axios"); + +const constants = require("./constants"); /** * Global level axios configuration. These settings are automatically used in other places by using an axiosInstance instead of axios directly @@ -14,11 +15,12 @@ export let axiosInstance = axios.create({ */ axiosInstance.interceptors.request.use( config => { - config.baseURL = localStorage.getItem(IP_ADDRESS_KEY); + config.baseURL = localStorage.getItem(constants.IP_ADDRESS_KEY); - config.headers.Authorization = 'Basic ' + localStorage.getItem(AUTH_KEY); + config.headers.Authorization = 'Basic ' + localStorage.getItem(constants.AUTH_KEY); return config; }, error => Promise.reject(error) ); +export default axiosInstance; \ No newline at end of file diff --git a/src/index.js b/src/index.js index f4fae94..d1dc2f6 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ -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. @@ -52,7 +52,7 @@ export const setCurrentBandwidthSetting = (newRate) => { * @returns {Function} */ export const createNewPublicLink = (remoteName, remotePath) => { - remoteName = addColonAtLast(remoteName); + remoteName = tools.addColonAtLast(remoteName); return new Promise((resolve, reject) => { axiosInstance.post(urls.createPublicLink, {fs: remoteName, remote: remotePath}).then(res => { resolve(res.data); @@ -209,8 +209,9 @@ export const getJobStatus = (jobId) => { } /** - * purgeDir returns the status of a job with jobId - * @param jobId {number} Valid job id + * purgeDir deletes the directory with given fs and remote + * @param fs {string} Name of fs + * @param remote {string} path remoteName * @return {Promise} */ export const purgeDir = (fs , remote) => { @@ -248,7 +249,7 @@ export const deleteFile = (fs , remote) => { } /** - * cleanTrashForRemote returns the status of a job with jobId + * cleanTrashForRemote cleans the trash for the remote with remote fs * @param fs {string} Remote Name * @return {Promise} */ From 6755f42fc47fc9e115b276210a5eff3cf2322b2c Mon Sep 17 00:00:00 2001 From: Chaitanya Bankanhal Date: Sun, 14 Jun 2020 12:12:58 +0530 Subject: [PATCH 2/2] 1.0.7-1 --- 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 8062666..6d471d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "rclone-api", - "version": "1.0.7-0", + "version": "1.0.7-1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 686b0ea..134a3d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rclone-api", - "version": "1.0.7-0", + "version": "1.0.7-1", "description": "Java Script bindings for rclone rc api", "main": "lib/index.js", "scripts": {