From ac44e7a430f18ecad9e44f9d436375a0059a9571 Mon Sep 17 00:00:00 2001 From: Quentin Laffont Date: Tue, 22 Aug 2017 19:34:37 +0200 Subject: [PATCH] Fix --- file-tools.js | 3 --- index.js => fvm | 32 ++++++++++++++++---------------- package.json | 13 ++++++++++--- 3 files changed, 26 insertions(+), 22 deletions(-) rename index.js => fvm (87%) diff --git a/file-tools.js b/file-tools.js index 98f9d6b..b1847dd 100644 --- a/file-tools.js +++ b/file-tools.js @@ -12,8 +12,5 @@ module.exports = { }, set_config_file: function(data){ fs.writeFileSync(process.cwd() + "\\scripts.json", data); - }, - remove_resource_folder: function(resourcename){ - } }; diff --git a/index.js b/fvm similarity index 87% rename from index.js rename to fvm index 06b4b6c..e2bb597 100644 --- a/index.js +++ b/fvm @@ -50,14 +50,14 @@ if(arguments.length == 2){ promiseArray = []; - resourcestoinstall.forEach(resource => { + resourcestoinstall.forEach(function(resource){ if(resource == "--save"){ save = true; } }); //Can give multiple resources to install - resourcestoinstall.forEach(resource => { + resourcestoinstall.forEach(function(resource){ if(resource != "--save"){ if(tools.check_resource_format(resource)){ promiseArray.push(tools.download_resource(resource, dataConfigFile, save)); @@ -69,11 +69,11 @@ if(arguments.length == 2){ } }); - Promise.all(promiseArray).then(values => { + Promise.all(promiseArray).then(function(values) { console.log("\n"); console.log(chalk.green("Installation Successful !")); - }).catch(data => { + }).catch(function(data) { process.exit(0); }); @@ -83,7 +83,7 @@ if(arguments.length == 2){ promiseArray = []; - Object.keys(dataConfigFile.resources).forEach(key => { + Object.keys(dataConfigFile.resources).forEach(function(key) { var resource = key + "@" +dataConfigFile.resources[key]; if(tools.check_resource_format(resource)){ promiseArray.push(tools.download_resource(resource, dataConfigFile, save)); @@ -91,11 +91,11 @@ if(arguments.length == 2){ } ); - Promise.all(promiseArray).then(values => { + Promise.all(promiseArray).then(function(values) { console.log("\n"); console.log(chalk.green("Installation Successful !")); - }).catch(data => { + }).catch(function(data) { process.exit(0); }); } @@ -111,14 +111,14 @@ if(arguments.length == 2){ promiseArray = []; - resourcestoupdate.forEach(resource => { + resourcestoupdate.forEach(function(resource){ if(resource == "--save"){ save = true; } }); //Can give multiple resources to install - resourcestoupdate.forEach(resource => { + resourcestoupdate.forEach(function(resource){ if(resource != "--save"){ if(tools.check_resource_format(resource)){ @@ -131,9 +131,9 @@ if(arguments.length == 2){ } }); - Promise.all(promiseArray).then(values => { + Promise.all(promiseArray).then(function(values) { console.log(chalk.green("Update Successful !")); - }).catch(data => { + }).catch(function(data) { process.exit(0); }); } else { @@ -141,13 +141,13 @@ if(arguments.length == 2){ promiseArray = []; - Object.keys(dataConfigFile.resources).forEach(key => { + Object.keys(dataConfigFile.resources).forEach(function(key) { promiseArray.push(tools.check_update_resource(key, dataConfigFile.resources[key])); }); - Promise.all(promiseArray).then(values => { + Promise.all(promiseArray).then(function(values) { console.log("To upgrade packages, do " + chalk.green("fvm update ")); - }).catch(data => { + }).catch(function(data) { process.exit(0); }); } @@ -178,14 +178,14 @@ if(arguments.length == 2){ promiseArray = []; - resourcestodelete.forEach(resource => { + resourcestodelete.forEach(function(resource){ if(resource == "--save"){ save = true; } }); //Can give multiple resources to install - resourcestodelete.forEach(resource => { + resourcestodelete.forEach(function(resource){ if(resource != "--save"){ if(tools.check_resource_format(resource)){ tools.deleteresource(resource, save, dataConfigFile) diff --git a/package.json b/package.json index 01c8dc2..498ecb3 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "fvm-installer", - "version": "1.0.0", + "version": "1.0.4", "description": "Resource Installer for FiveM", - "main": "index.js", + "main": "./fvm", "repository": { "type": "git", "url": "git+https://github.com/qlaffont/fvm-installer.git" @@ -18,7 +18,14 @@ }, "homepage": "https://github.com/qlaffont/fvm-installer#readme", "bin": { - "fvm": "./index.js" + "fvm": "./fvm" + }, + "scripts": { + "fvm": "./fvm" + }, + "preferGlobal": true, + "engines": { + "node": ">=0.12" }, "dependencies": { "adm-zip": "^0.4.7",