Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJaredWilcurt committed Dec 17, 2023
1 parent 8e5d00b commit f90d3ad
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 33 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ nwSplasherAutoUpdate.downloadLatestAppAndOpenWindowInBackground({
* @return {string} The new version number (continue to download zip), or false (open current version)
*/
confirmNewVersion: function (response, latestLocal) {
//This is just an example, you can put any logic you want here
// This is just an example, you can put any logic you want here
response = JSON.parse(response);
const latestRemote = response.latest.version;
const updateAvailable = require('semver').gt(latestRemote, latestLocal);
Expand All @@ -75,13 +75,13 @@ nwSplasherAutoUpdate.downloadLatestAppAndOpenWindowInBackground({
},
/**
* Called after hitting the versionUrl with the response.
* Must return a url to a ZIP file to be downloaded/extracted
* 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) {
//This is just an example, you can put any logic you want here
// This is just an example, you can put any logic you want here
response = JSON.parse(response);
return response.latest.downloadUrl;
},
Expand All @@ -96,7 +96,7 @@ nwSplasherAutoUpdate.downloadLatestAppAndOpenWindowInBackground({
* @param {number} update.extractProgress The extract progress percent
*/
onUpdate: function ({ downloadProgress, extractProgress }) {
//This is just an example, you can put any logic you want here
// This is just an example, you can put any logic you want here
if (downloadProgress) {
console.log('Download progress: ' + downloadProgress + '%');
}
Expand All @@ -111,10 +111,10 @@ nwSplasherAutoUpdate.downloadLatestAppAndOpenWindowInBackground({
* nwSplasherAutoUpdate will retry or stop running.
*
* @param {string} pathToZip File path to the downloaded zip file
* @return {Boolean} true = continue, false = retry/stop
* @return {boolean} true = continue, false = retry/stop
*/
validateZip: function (pathToZip) {
//This is just an example, you can put any logic you want here
// This is just an example, you can put any logic you want here
return true;
},
/**
Expand All @@ -124,10 +124,10 @@ nwSplasherAutoUpdate.downloadLatestAppAndOpenWindowInBackground({
* then nwSplasherAutoUpdate will retry or stop running.
*
* @param {string} pathToExtract File path to the downloaded zip file
* @return {Boolean} true = continue, false = retry/stop
* @return {boolean} true = continue, false = retry/stop
*/
validateExtract: function (pathToExtract) {
//This is just an example, you can put any logic you want here
// This is just an example, you can put any logic you want here
return true;
},
/**
Expand All @@ -137,7 +137,7 @@ nwSplasherAutoUpdate.downloadLatestAppAndOpenWindowInBackground({
* @param {string} message Human readable warning message
*/
onRetry: function (message) {
//This is just an example, you can put any logic you want here
// This is just an example, you can put any logic you want here
console.log(message);
},
/**
Expand All @@ -149,7 +149,7 @@ nwSplasherAutoUpdate.downloadLatestAppAndOpenWindowInBackground({
* @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
// This is just an example, you can put any logic you want here
console.log(errorMessage, error);
},
/**
Expand Down
25 changes: 13 additions & 12 deletions manual-testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* @file Used for manually testing the code
*/

const library = require('./index.js');
const semver = require('semver');

const library = require('./index.js');

let options = {
autoUpdate: {
versionUrl: 'https://api.github.com/repos/scout-app/scout-app/releases',
Expand Down Expand Up @@ -83,14 +84,14 @@ options = {
},
/**
* Called after hitting the versionUrl with the response.
* Must return a url to a ZIP file to be downloaded/extracted
* 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
// This is just an example, you can put any logic you want here
response = JSON.parse(response);
return response.latest.downloadUrl;
},
Expand All @@ -106,7 +107,7 @@ options = {
*/
onUpdate: function ({ downloadProgress, extractProgress }) {
console.log('onUpdate');
//This is just an example, you can put any logic you want here
// This is just an example, you can put any logic you want here
if (downloadProgress) {
console.log('Download progress: ' + downloadProgress + '%');
}
Expand All @@ -121,11 +122,11 @@ options = {
* nwSplasherAutoUpdate will retry or stop running.
*
* @param {string} pathToZip File path to the downloaded zip file
* @return {Boolean} true = continue, false = retry/stop
* @return {boolean} true = continue, false = retry/stop
*/
validateZip: function (pathToZip) {
console.log('validateZip');
//This is just an example, you can put any logic you want here
console.log('validateZip', pathToZip);
// This is just an example, you can put any logic you want here
return true;
},
/**
Expand All @@ -135,11 +136,11 @@ options = {
* then nwSplasherAutoUpdate will retry or stop running.
*
* @param {string} pathToExtract File path to the downloaded zip file
* @return {Boolean} true = continue, false = retry/stop
* @return {boolean} true = continue, false = retry/stop
*/
validateExtract: function (pathToExtract) {
console.log('validateExtract');
//This is just an example, you can put any logic you want here
console.log('validateExtract', pathToExtract);
// This is just an example, you can put any logic you want here
return true;
},
/**
Expand All @@ -149,7 +150,7 @@ options = {
* @param {string} message Human readable warning message
*/
onRetry: function (message) {
//This is just an example, you can put any logic you want here
// This is just an example, you can put any logic you want here
console.log('onRetry', message);
},
/**
Expand All @@ -161,7 +162,7 @@ options = {
* @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
// This is just an example, you can put any logic you want here
console.log('onError', errorMessage, error);
},
/**
Expand Down
24 changes: 13 additions & 11 deletions src/getLatestLocal.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@ const { OPTIONS } = require('../api-type-definitions.js');
const helpers = require('./helpers.js');

/**
*
* Checks the previously downloaded app versions to find
* the most recenter version number. If no local versions
* are found, returns false.
*
* @param {OPTIONS} options User's validated options
* @return {Promise} .
* @return {string} The most recent local version number, or false
*/
async function getLatestLocal (options) {
return new Promise((resolve, reject) => {
let latestLocal = '0.0.0';
if (latestLocal) {
resolve(latestLocal);
} else {
helpers.throwError(options, 'Error getting latest local version number', error);
reject();
}
});
console.log('Th getLatestLocal function is a stub and needs implemented');
let latestLocal = '0.0.0';
if (latestLocal) {
return latestLocal;
} else {
let error;
helpers.throwError(options, 'Error getting latest local version number', error);
}
return false;
};

module.exports = getLatestLocal;

0 comments on commit f90d3ad

Please sign in to comment.