From 5b8c8c33ede7db9d75069d0d2fd0fa917c4df9f4 Mon Sep 17 00:00:00 2001 From: Sadegh Hayeri Date: Thu, 12 Mar 2020 22:02:52 +0330 Subject: [PATCH] Use app-data-folder --- package-lock.json | 54 ++++++++++++++++++++++++------------------ package.json | 2 +- src/utils/analytics.js | 6 ++--- 3 files changed, 34 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index e5164fe..c6c17a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,6 +74,14 @@ "color-convert": "^1.9.0" } }, + "app-data-folder": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/app-data-folder/-/app-data-folder-1.0.0.tgz", + "integrity": "sha1-/m3/QSDV7xc2FQh1aptT+pu2E/c=", + "requires": { + "path": "^0.12.7" + } + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -131,14 +139,6 @@ "tweetnacl": "^0.14.3" } }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "boxen": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz", @@ -729,11 +729,6 @@ "flat-cache": "^2.0.1" } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", @@ -932,8 +927,7 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { "version": "1.3.5", @@ -1487,6 +1481,15 @@ "callsites": "^3.0.0" } }, + "path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", + "requires": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -1518,14 +1521,6 @@ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" }, - "platform-folders": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/platform-folders/-/platform-folders-0.4.1.tgz", - "integrity": "sha512-5F2ppTf4AOiJ5uiSwGWFJwZHikZOXdqzaYXtz4Lv9jyCcOYHd1i+60Mruhid194Fx/QHyfIFZ5J+UdEPDqpv5g==", - "requires": { - "bindings": "^1.5.0" - } - }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -1537,6 +1532,11 @@ "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" + }, "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -1994,6 +1994,14 @@ "prepend-http": "^1.0.1" } }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "requires": { + "inherits": "2.0.3" + } + }, "uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", diff --git a/package.json b/package.json index 60e68d4..8f11cb8 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { + "app-data-folder": "^1.0.0", "chalk": "^2.4.2", "clear": "^0.1.0", "consola": "^2.11.0", @@ -41,7 +42,6 @@ "lru-cache": "^5.1.1", "node-localstorage": "^2.1.5", "ora": "^3.2.0", - "platform-folders": "^0.4.1", "std-env": "^2.2.1", "universal-analytics": "^0.4.20", "update-notifier": "^2.5.0", diff --git a/src/utils/analytics.js b/src/utils/analytics.js index de1f05e..6a21af3 100644 --- a/src/utils/analytics.js +++ b/src/utils/analytics.js @@ -1,11 +1,9 @@ import ua from 'universal-analytics'; import uuid from 'uuid/v4'; import { JSONStorage } from 'node-localstorage'; -import path from 'path'; +import appData from 'app-data-folder'; -import getPath from 'platform-folders'; -const configFolder = path.join(getPath('appData'), 'greentunnel'); -const nodeStorage = new JSONStorage(configFolder); +const nodeStorage = new JSONStorage(appData('greentunnel')); const userId = nodeStorage.getItem('userid') || uuid(); nodeStorage.setItem('userid', userId);