diff --git a/manual-testing.js b/manual-testing.js deleted file mode 100644 index fb9d244..0000000 --- a/manual-testing.js +++ /dev/null @@ -1,188 +0,0 @@ -'use strict'; - -/** - * @file Used for manually testing the code - */ - -const semver = require('semver'); - -const library = require('./index.js'); - -let options = { - autoUpdate: { - versionUrl: 'https://api.github.com/repos/scout-app/scout-app/releases', - confirmNewVersion: function (response, latestLocal) { - response = JSON.parse(response); - const latestRemote = response.latest.version; - const updateAvailable = semver.gt(latestRemote, latestLocal); - if (updateAvailable) { - return latestRemote; - } - return false; - }, - downloadPath: function (response) { - response = JSON.parse(response); - return response.latest.downloadUrl; - } - } -}; - -options = { - // OPTIONAL: defaults to true - verbose: true, - /** - * OPTIONAL: console.error is called by default if verbose: true. - * - * Your own custom logging function called with helpful warning/error - * messages from the internal validators. Only used if verbose: true. - * - * @param {string} message The human readable warning/error message - * @param {object} error Sometimes an error or options object is passed - */ - customLogger: function (message, error) { - console.log('customLogger', message, error); - }, - splasher: { - /** - * The websocket port the splash screen window listens on. When your main app window - * loads, it will use the same port to signal the splash screen to close itself. - */ - port: 4443, - /** - * Time in ms to wait after the new window is launched before auto-closing - * splash screen if a signal is not recieved to close sooner. Send -1 to - * only close if signaled via the websocket port. - */ - closeSplashAfter: 3000 - }, - autoUpdate: { - /** - * NW.js Splasher Auto Update will make a network request to the versionUrl, - * then pass the response into the confirmNewVersion and downloadPath - * callback functions you provide. - */ - // This is an example, you can put whatever URL you want here - versionUrl: 'https://api.github.com/repos/scout-app/scout-app/releases', - /** - * Check if the latest remote version is newer than the latest local version. - * If a new version is available, return the new version number to begin the - * download/extract. If no new version exists, then return false and the latest - * local version will be opened in a new window and the splash screen closed. - * - * @param {string} response The network respone from versionUrl - * @param {string} latestLocal The latest downloaded version, or undefined if not present - * @return {string} The new version number (continue to download zip), or false (open current version) - */ - confirmNewVersion: function (response, latestLocal) { - console.log('confirmNewVersion'); - const latestRemote = response.data[0].tag_name.replace('v', ''); - const updateAvailable = semver.gt(latestRemote, latestLocal); - if (updateAvailable) { - return latestRemote; - } - return false; - }, - /** - * Called after hitting the versionUrl with the response. - * Must return a url to a ZIP file to be downloaded/extracted. - * - * @param {string} response The response body from the network request - * @return {string} A url to a ZIP file to be downloaded - */ - downloadPath: function (response) { - console.log('downloadPath'); - // This is just an example, you can put any logic you want here - response = JSON.parse(response); - return response.latest.downloadUrl; - }, - // If the download or extract fails, we will retry n times before stopping - downloadRetries: 3, - extractRetries: 3, - /** - * Called when an update occurs during download/extract. - * - * @param {object} update Object containing percents - * @param {number} update.downloadProgress The download progress percent - * @param {number} update.extractProgress The extract progress percent - */ - onUpdate: function ({ downloadProgress, extractProgress }) { - console.log('onUpdate'); - // This is just an example, you can put any logic you want here - if (downloadProgress) { - console.log('Download progress: ' + downloadProgress + '%'); - } - if (extractProgress) { - console.log('Unzipping: ' + downloadProgress + '%'); - } - }, - /** - * Optional function. You can run any code to validate - * that the downloaded zip matches expecations. - * If it does return true. If you return false, then - * nwSplasherAutoUpdate will retry or stop running. - * - * @param {string} pathToZip File path to the downloaded zip file - * @return {boolean} true = continue, false = retry/stop - */ - validateZip: function (pathToZip) { - console.log('validateZip', pathToZip); - // This is just an example, you can put any logic you want here - return true; - }, - /** - * Optional function. You can run any code to validate - * that the files extracted from the zip match your - * expecations. If they do return true. If you return false, - * then nwSplasherAutoUpdate will retry or stop running. - * - * @param {string} pathToExtract File path to the downloaded zip file - * @return {boolean} true = continue, false = retry/stop - */ - validateExtract: function (pathToExtract) { - console.log('validateExtract', pathToExtract); - // This is just an example, you can put any logic you want here - return true; - }, - /** - * When download or extract fails, but we haven't - * exhausted all retries yet, this is called. - * - * @param {string} message Human readable warning message - */ - onRetry: function (message) { - // This is just an example, you can put any logic you want here - console.log('onRetry', message); - }, - /** - * Called when an error is encountered that ended execution - * prematurely. Such as failing to download or extract after - * all retries were exhausted. - * - * @param {string} errorMessage Human readable error message - * @param {object} error Detailed error information if available - */ - onError: function (errorMessage, error) { - // This is just an example, you can put any logic you want here - console.log('onError', errorMessage, error); - }, - /** - * Called just prior to opening the new window - * and closing the splash screen. - */ - onComplete: function () { - console.log('onComplete'); - } - }, - newWindow: { - // The file from the extracted zip to load in the new window - entry: 'index.html', - // Any NW.js window subfield options: docs.nwjs.io/en/latest/References/Manifest%20Format/#window-subfields - window: { - min_width: 400, - min_height: 250 - } - } -}; - - -library.downloadLatestAppAndOpenWindowInBackground(options); diff --git a/nw-testing/index.html b/nw-testing/index.html new file mode 100644 index 0000000..28a9fe8 --- /dev/null +++ b/nw-testing/index.html @@ -0,0 +1,43 @@ + + + + Manual test + + + + + + + + diff --git a/nw-testing/manual-testing.js b/nw-testing/manual-testing.js new file mode 100644 index 0000000..0e8e535 --- /dev/null +++ b/nw-testing/manual-testing.js @@ -0,0 +1,182 @@ +'use strict'; + +/** + * @file Used for manually testing the code + */ + +const semver = require('semver'); + +const library = require('../index.js'); + +function manualTesting () { + let options = { + autoUpdate: { + versionUrl: 'https://api.github.com/repos/scout-app/scout-app/releases', + confirmNewVersion: function (response, latestLocal) { + response = JSON.parse(response); + const latestRemote = response.latest.version; + const updateAvailable = semver.gt(latestRemote, latestLocal); + if (updateAvailable) { + return latestRemote; + } + return false; + }, + downloadPath: function (response) { + response = JSON.parse(response); + return response.latest.downloadUrl; + } + } + }; + + options = { + // OPTIONAL: defaults to true + verbose: true, + splasher: { + /** + * The websocket port the splash screen window listens on. When your main app window + * loads, it will use the same port to signal the splash screen to close itself. + */ + port: 4443, + /** + * Time in ms to wait after the new window is launched before auto-closing + * splash screen if a signal is not recieved to close sooner. Send -1 to + * only close if signaled via the websocket port. + */ + closeSplashAfter: 3000 + }, + autoUpdate: { + /** + * NW.js Splasher Auto Update will make a network request to the versionUrl, + * then pass the response into the confirmNewVersion and downloadPath + * callback functions you provide. + */ + // This is an example, you can put whatever URL you want here + versionUrl: 'https://api.github.com/repos/scout-app/scout-app/releases', + /** + * Check if the latest remote version is newer than the latest local version. + * If a new version is available, return the new version number to begin the + * download/extract. If no new version exists, then return false and the latest + * local version will be opened in a new window and the splash screen closed. + * + * @param {string} response The network respone from versionUrl + * @param {string} latestLocal The latest downloaded version, or undefined if not present + * @return {string} The new version number (continue to download zip), or false (open current version) + */ + confirmNewVersion: function (response, latestLocal) { + console.log('confirmNewVersion'); + const latestRemote = response.data[0].tag_name.replace('v', ''); + const updateAvailable = semver.gt(latestRemote, latestLocal); + if (updateAvailable) { + return latestRemote; + } + return false; + }, + /** + * Called after hitting the versionUrl with the response. + * Must return a url to a ZIP file to be downloaded/extracted. + * + * @param {string} response The response body from the network request + * @return {string} A url to a ZIP file to be downloaded + */ + downloadPath: function (response) { + console.log('downloadPath'); + // This is just an example, you can put any logic you want here + response = JSON.parse(response); + return response.latest.downloadUrl; + }, + // If the download or extract fails, we will retry n times before stopping + downloadRetries: 3, + extractRetries: 3, + /** + * Called when an update occurs during download/extract. + * + * @param {object} update Object containing percents + * @param {number} update.downloadProgress The download progress percent + * @param {number} update.extractProgress The extract progress percent + */ + onUpdate: function ({ downloadProgress, extractProgress }) { + console.log('onUpdate'); + // This is just an example, you can put any logic you want here + if (downloadProgress) { + console.log('Download progress: ' + downloadProgress + '%'); + } + if (extractProgress) { + console.log('Unzipping: ' + downloadProgress + '%'); + } + }, + /** + * Optional function. You can run any code to validate + * that the downloaded zip matches expecations. + * If it does return true. If you return false, then + * nwSplasherAutoUpdate will retry or stop running. + * + * @param {string} pathToZip File path to the downloaded zip file + * @return {boolean} true = continue, false = retry/stop + */ + validateZip: function (pathToZip) { + console.log('validateZip', pathToZip); + // This is just an example, you can put any logic you want here + return true; + }, + /** + * Optional function. You can run any code to validate + * that the files extracted from the zip match your + * expecations. If they do return true. If you return false, + * then nwSplasherAutoUpdate will retry or stop running. + * + * @param {string} pathToExtract File path to the downloaded zip file + * @return {boolean} true = continue, false = retry/stop + */ + validateExtract: function (pathToExtract) { + console.log('validateExtract', pathToExtract); + // This is just an example, you can put any logic you want here + return true; + }, + /** + * When download or extract fails, but we haven't + * exhausted all retries yet, this is called. + * + * @param {string} message Human readable warning message + */ + onRetry: function (message) { + // This is just an example, you can put any logic you want here + console.log('onRetry', message); + }, + /** + * Called when an error is encountered that ended execution + * prematurely. Such as failing to download or extract after + * all retries were exhausted. + * + * @param {string} errorMessage Human readable error message + * @param {object} error Detailed error information if available + */ + onError: function (errorMessage, error) { + // This is just an example, you can put any logic you want here + console.log('onError', errorMessage, error); + }, + /** + * Called just prior to opening the new window + * and closing the splash screen. + */ + onComplete: function () { + console.log('onComplete'); + } + }, + newWindow: { + // The file from the extracted zip to load in the new window + entry: 'index.html', + // Any NW.js window subfield options: docs.nwjs.io/en/latest/References/Manifest%20Format/#window-subfields + window: { + min_width: 400, + min_height: 250 + } + } + }; + + + library.downloadLatestAppAndOpenWindowInBackground(options); +} + +module.exports = { + manualTesting +}; diff --git a/nw-testing/package-lock.json b/nw-testing/package-lock.json new file mode 100644 index 0000000..362d6bf --- /dev/null +++ b/nw-testing/package-lock.json @@ -0,0 +1,705 @@ +{ + "name": "nw-splasher-auto-update-manual-testing", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "nw-splasher-auto-update-manual-testing", + "devDependencies": { + "nw": "0.82.0-sdk" + } + }, + "node_modules/@eggjs/yauzl": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@eggjs/yauzl/-/yauzl-2.11.0.tgz", + "integrity": "sha512-Jq+k2fCZJ3i3HShb0nxLUiAgq5pwo8JTT1TrH22JoehZQ0Nm2dvByGIja1NYfNyuE4Tx5/Dns5nVsBN/mlC8yg==", + "dev": true, + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer2": "^1.2.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/bl": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", + "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", + "dev": true, + "dependencies": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==", + "dev": true + }, + "node_modules/camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha512-DLIsRzJVBQu72meAKPkWQOLcujdXT32hwdfnkI1frSiSRMK1MofjKHf+MEx0SB6fjEFXL8fBDv1dKymBlOp4Qw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cli-progress": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.12.0.tgz", + "integrity": "sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==", + "dev": true, + "dependencies": { + "string-width": "^4.2.3" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha512-0yayqDxWQbqk3ojkYqUKqaAQ6AfNKeKWRNA8kR0WXzAsdHpP4BIaOmMAG87JGuO6qcobyW4GjxHd9PmhEd+T9w==", + "dev": true, + "dependencies": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "dev": true, + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "dev": true, + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/compressing": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/compressing/-/compressing-1.10.0.tgz", + "integrity": "sha512-k2vpbZLaJoHe9euyUZjYYE8vOrbR19aU3HcWIYw5EBXiUs34ygfDVnXU+ubI41JXMriHutnoiu0ZFdwCkH6jPA==", + "dev": true, + "dependencies": { + "@eggjs/yauzl": "^2.11.0", + "flushwritable": "^1.0.0", + "get-ready": "^1.0.0", + "iconv-lite": "^0.5.0", + "mkdirp": "^0.5.1", + "pump": "^3.0.0", + "streamifier": "^0.1.1", + "tar-stream": "^1.5.2", + "yazl": "^2.4.2" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/fd-slicer2": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fd-slicer2/-/fd-slicer2-1.2.0.tgz", + "integrity": "sha512-3lBUNUckhMZduCc4g+Pw4Ve16LD9vpX9b8qUkkKq2mgDRLYWzblszZH2luADnJqjJe+cypngjCuKRm/IW12rRw==", + "dev": true, + "dependencies": { + "pend": "^1.2.0" + } + }, + "node_modules/flushwritable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/flushwritable/-/flushwritable-1.0.0.tgz", + "integrity": "sha512-3VELfuWCLVzt5d2Gblk8qcqFro6nuwvxwMzHaENVDHI7rxcBRtMCwTk/E9FXcgh+82DSpavPNDueA9+RxXJoFg==", + "dev": true + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, + "node_modules/get-ready": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-ready/-/get-ready-1.0.0.tgz", + "integrity": "sha512-mFXCZPJIlcYcth+N8267+mghfYN9h3EhsDa6JSnbA3Wrhh/XFpuowviFcsDeYZtKspQyWyJqfs4O6P8CHeTwzw==", + "dev": true + }, + "node_modules/iconv-lite": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.2.tgz", + "integrity": "sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha512-xgs2NH9AE66ucSq4cNG1nhSFghr5l6tdL15Pk+jl46bmmBapgoaY/AacXyaDznAqmGL99TiLSQgO/XazFSKYeQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, + "node_modules/lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha512-YiGkH6EnGrDGqLMITnGjXtGmNtjoXw9SVUzcaos8RBi7Ps0VBylkq+vOcY9QE5poLasPCR849ucFUkl0UzUyOw==", + "dev": true, + "dependencies": { + "invert-kv": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nw": { + "version": "0.82.0-sdk", + "resolved": "https://registry.npmjs.org/nw/-/nw-0.82.0-sdk.tgz", + "integrity": "sha512-0/2QjBbdHK+9IjnvlTT0AcUYBOHfjmgQg26hl4IUttR147Or1xTj3nx0VyMjmv8UTSp+Ane3kF3fa60LUrtKyw==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "cli-progress": "^3.12.0", + "compressing": "^1.10.0", + "semver": "^7.5.4", + "yargs": "^3.2.1" + }, + "bin": { + "nw": "bin/nw.js" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha512-PRT7ZORmwu2MEFt4/fv3Q+mEfN4zetKxufQrkShY2oGvUms9r8otu5HfdyIFHkYXjO7laNsoVGmM2MANfuTA8g==", + "dev": true, + "dependencies": { + "lcid": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/streamifier": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/streamifier/-/streamifier-0.1.1.tgz", + "integrity": "sha512-zDgl+muIlWzXNsXeyUfOk9dChMjlpkq0DRsxujtYPgyJ676yQ8jEm6zzaaWHFDg5BNcLuif0eD2MTyJdZqXpdg==", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "dev": true, + "dependencies": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/to-buffer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", + "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==", + "dev": true + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/window-size": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", + "integrity": "sha512-2thx4pB0cV3h+Bw7QmMXcEbdmOzv9t0HFplJH/Lz6yu60hXYy5RT8rUu+wlIreVxWsGN20mo+MHeCSfUpQBwPw==", + "dev": true, + "bin": { + "window-size": "cli.js" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha512-vAaEaDM946gbNpH5pLVNR+vX2ht6n0Bt3GXwVB1AuAqZosOvHNF3P7wDnh8KLkSqgUh0uh77le7Owgoz+Z9XBw==", + "dev": true, + "dependencies": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "dev": true, + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "dev": true, + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, + "engines": { + "node": ">=0.4" + } + }, + "node_modules/y18n": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==", + "dev": true + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yargs": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", + "integrity": "sha512-ONJZiimStfZzhKamYvR/xvmgW3uEkAUFSP91y2caTEPhzF6uP2JfPiVZcq66b/YR0C3uitxSV7+T1x8p5bkmMg==", + "dev": true, + "dependencies": { + "camelcase": "^2.0.1", + "cliui": "^3.0.3", + "decamelize": "^1.1.1", + "os-locale": "^1.4.0", + "string-width": "^1.0.1", + "window-size": "^0.1.4", + "y18n": "^3.2.0" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "dev": true, + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "dev": true, + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yazl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", + "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", + "dev": true, + "dependencies": { + "buffer-crc32": "~0.2.3" + } + } + } +} diff --git a/nw-testing/package.json b/nw-testing/package.json new file mode 100644 index 0000000..9f4b545 --- /dev/null +++ b/nw-testing/package.json @@ -0,0 +1,17 @@ +{ + "name": "nw-splasher-auto-update-manual-testing", + "main": "index.html", + "window": { + "width": 300, + "height": 150 + }, + "scripts": { + "start": "nw ." + }, + "devDependencies": { + "nw": "0.82.0-sdk" + }, + "volta": { + "node": "20.7.0" + } +} diff --git a/package.json b/package.json index d1a73ea..a27c8b3 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "lint": "eslint --config=.eslintrc.js index.js src tests manual-testing.js", "fix": "eslint --fix --config=.eslintrc.js index.js src tests manual-testing.js", - "manual": "node manual-testing.js", + "manual": "cd nw-testing && npm start", "test": "vitest --coverage" }, "dependencies": { @@ -45,6 +45,6 @@ }, "homepage": "https://github.com/nwutils/nw-splasher-auto-update#readme", "volta": { - "node": "20.10.0" + "node": "20.7.0" } } diff --git a/src/constants.js b/src/constants.js index e450419..bda4b63 100644 --- a/src/constants.js +++ b/src/constants.js @@ -4,15 +4,23 @@ * @file Defines shared constant variables */ +const path = require('path'); + +const LIBRARY_NAME = 'nw-splasher-auto-update'; + const DEFAULT_CLOSE_SPLASH_AFTER = 3000; const DEFAULT_PORT_NUMBER = 4443; const DEFAULT_DOWNLOAD_RETRIES = 3; const DEFAULT_EXTRACT_RETRIES = 3; +const STORAGE_LOCATION = path.join(nw.App.dataPath, LIBRARY_NAME); + module.exports = { DEFAULT_CLOSE_SPLASH_AFTER, DEFAULT_DOWNLOAD_RETRIES, DEFAULT_EXTRACT_RETRIES, - DEFAULT_PORT_NUMBER + DEFAULT_PORT_NUMBER, + LIBRARY_NAME, + STORAGE_LOCATION }; diff --git a/src/getLatestLocal.js b/src/getLatestLocal.js index 52f12be..ccdaec8 100644 --- a/src/getLatestLocal.js +++ b/src/getLatestLocal.js @@ -4,8 +4,11 @@ * @file Checks the most recent local version of the app */ +const fs = require('fs'); + const { OPTIONS } = require('../api-type-definitions.js'); +const { STORAGE_LOCATION } = require('./constants.js'); const helpers = require('./helpers.js'); /** @@ -17,8 +20,14 @@ const helpers = require('./helpers.js'); * @return {string} The most recent local version number, or false */ async function getLatestLocal (options) { - console.log('Th getLatestLocal function is a stub and needs implemented'); + console.log('The getLatestLocal function is a stub and needs implemented'); + let latestLocal = '0.0.0'; + + if (fs.existsSync(STORAGE_LOCATION)) { + console.log(fs.readdirSync(STORAGE_LOCATION)); + } + if (latestLocal) { return latestLocal; } else {