Remove .js suffix from node invocations

Remove the .js suffix from help texts of node invocations as well as
actual invocations as this is not necessary.  Removing it opens up the
possibility of restructuring the code into a directory with the same
name.
This commit is contained in:
Hornwitser committed 2019-10-28 19:45:32 +01:00
1 parent a9a382b993
commit 6bde8a2219
6 files changed
+34 -34

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@ const cli = require("cli");
const config = require("./../config.json");
let options = cli.parse()
cli.setUsage(`node cluster_rcon.js /c game.player.force = "player"`)
cli.setUsage(`node cluster_rcon /c game.player.force = "player"`)
if(process.argv.length < 3){
cli.getUsage()
process.exit(1)
+2 -2
View File
@@ -9,7 +9,7 @@ WORKDIR factorioClusterio
RUN mkdir instances sharedMods
RUN cp config.json.dist config.json
RUN node client.js download
RUN node client download
LABEL maintainer "Sir3lit@gmail.com"
@@ -18,4 +18,4 @@ VOLUME /factorioClusterio/instances
VOLUME /factorioClusterio/sharedMods
VOLUME /factorioClusterio/sharedPlugins
CMD RCONPORT="$RCONPORT" FACTORIOPORT="$FACTORIOPORT" MODE="$MODE" node $MODE\.js start $INSTANCE
CMD RCONPORT="$RCONPORT" FACTORIOPORT="$FACTORIOPORT" MODE="$MODE" node $MODE start $INSTANCE
+14 -14
View File
@@ -112,7 +112,7 @@ Master and all slaves:
tar -xf factorio.tar.gz
npm install --only=production
cp config.json.dist config.json
node ./lib/npmPostinstall.js
node ./lib/npmPostinstall
downloads and installs nodejs, git and clusterio. To specify a version, change "latest" in the link to a version number like 0.14.21.
@@ -131,26 +131,26 @@ Pretty much all the blank fields should be filled in, except on the master where
**Master**
node master.js
node master
Or with pm2 (it's recommened to run it without pm2 first):
pm2 start master.js --name master
pm2 start master --name master
**Server Host**
To download the mod for all its non vanilla features and items, (optional, but very recommended)
node client.js manage shared mods add clusterio
node client manage shared mods add clusterio
To create a new instance (its own save, set of mods and config files)
node client.js start [instancename]
node client start [instancename]
To launch an instance with pm2
pm2 start --name [instancename] client.js -- start [instancename]
pm2 start --name [instancename] client -- start [instancename]
use `nano config.json` to change settings.
@@ -196,9 +196,9 @@ reboot when you are done, then proceed to the next steps. *reboots matter*
3. Follow the instructions in the bat file
3. Some of the instructions are outdated. If you get stuck somewhere, look at the Ubuntu section.
4. Run `node client.js manage shared mods add clusterio`
4. Run `node client manage shared mods add clusterio`
5. type `node master.js` to start the server
5. type `node master` to start the server
**Server Host**
@@ -210,7 +210,7 @@ reboot when you are done, then proceed to the next steps. *reboots matter*
3.5 Some of the instructions are outdated. If you get stuck somewhere, look at the Ubuntu section.
4. Type `node client.js start [instancename]` to create a new instance.
4. Type `node client start [instancename]` to create a new instance.
To connect to a master server running on a remote machine, open config.json with your favourite text editor (notepad++). You can also set it up to use the official server browser.
@@ -268,19 +268,19 @@ TLDR: the tested fix is:
### Other fixes for other potential problems:
Sometimes the install fails. Try `node ./lib/npmPostinstall.js` to complete it.
Sometimes the install fails. Try `node ./lib/npmPostinstall` to complete it.
## Cheatsheet
**To create a new instance/start it**
node client.js start [instanceName]
node client start [instanceName]
**Other instance management tools:**
```
node client.js delete [instanceName]
node client.js list
node client delete [instanceName]
node client list
```
**To update clusterio to the latest version:**
@@ -296,5 +296,5 @@ npm install --only=production
3. Download the latest version of the factorioClusterioMod from its github repo
```
node client.js manage shared mods add clusterio
node client manage shared mods add clusterio
```
+12 -12
View File
@@ -105,15 +105,15 @@ function needleOptionsWithTokenAuthHeader(config) {
function printUsage() {
console.error("Usage: ");
console.error("node client.js start [instance name]");
console.error("node client.js list");
console.error("node client.js delete [instance]");
console.error("node client start [instance name]");
console.error("node client list");
console.error("node client delete [instance]");
console.error("To download the latest version of the Clusterio lua mod, do");
console.error("node client.js manage shared mods download clusterio");
console.error("node client manage shared mods download clusterio");
console.error("To download a clusterio plugin, do");
console.error("node client.js manage shared plugins install https://github.com/Danielv123/playerManager");
console.error("node client manage shared plugins install https://github.com/Danielv123/playerManager");
console.error("For more management options, do");
console.error("node client.js manage");
console.error("node client manage");
}
async function listInstances(config) {
@@ -133,14 +133,14 @@ async function listInstances(config) {
async function manage(config, instance) {
// console.log("Launching mod manager");
//const fullUsage = 'node client.js manage [instance, "shared"] ["mods", "config"] ...';
//const fullUsage = 'node client manage [instance, "shared"] ["mods", "config"] ...';
function usage(instance, tool, action){
if(tool && tool == "mods"){
console.log('node client.js manage '+instance.name+' '+tool+' ["list", "search", "add", "remove"]');
console.log('node client manage '+instance.name+' '+tool+' ["list", "search", "add", "remove"]');
} else if(tool && tool == "plugins") {
console.log(`node client.js manage ${instance.name} ${tool} ["list", "add", "remove"]`);
console.log(`node client manage ${instance.name} ${tool} ["list", "add", "remove"]`);
} else {
console.log('node client.js manage '+(instance && instance.name || '[instance, "shared"]') +' '+ (tool || '["mods", "plugins"]') + ' ...');
console.log('node client manage '+(instance && instance.name || '[instance, "shared"]') +' '+ (tool || '["mods", "plugins"]') + ' ...');
}
}
const tool = process.argv[4] || "";
@@ -197,7 +197,7 @@ async function manage(config, instance) {
async function deleteInstance(instance) {
if (instance === undefined) {
console.error("Usage: node client.js delete [instance]");
console.error("Usage: node client delete [instance]");
process.exit(1);
} else if (fs.existsSync(instance.path())) {
fileOps.deleteFolderRecursiveSync(instance.path()); // TODO: Check if this can cause i-craft users to format their server by using wrong paths
@@ -546,7 +546,7 @@ async function startClient() {
await downloadMod();
} else if (command == "start" && instance === undefined) {
console.error("ERROR: No instanceName provided!");
console.error("Usage: node client.js start [instanceName]");
console.error("Usage: node client start [instanceName]");
process.exit(0);
} else if (command == "start" && !fs.existsSync(instance.path())) {
await createInstance(config, args, instance);
+3 -3
View File
@@ -7,7 +7,7 @@ combinator signals.
@author Danielv123
@example
node master.js
node master
*/
// Attempt updating
@@ -421,7 +421,7 @@ POST endpoint for storing items in master's inventory.
@alias api/place
@param {itemStack} itemStack the number and type of items to store (see typedef)
@param {string} [itemStack.instanceID="unknown"] the unique/instanceID which is a numerical value for an instance
@param {string} [itemStack.instanceName="unknown"] the name of an instance for identification in statistics, as provided when launching it. ex node client.js start [name]
@param {string} [itemStack.instanceName="unknown"] the name of an instance for identification in statistics, as provided when launching it. ex node client start [name]
@returns {string} status either "success" or "failure"
*/
app.post("/api/place", authenticate.middleware, function(req, res) {
@@ -491,7 +491,7 @@ POST endpoint to remove items from DB when client orders items.
@alias api/remove
@param {itemStack} itemStack the name of and the number of items to remove (see typedef)
@param {string} [itemStack.instanceID="unknown"] the unique/instanceID which is a numerical value for an instance
@param {string} [itemStack.instanceName="unknown"] the name of an instance for identification in statistics, as provided when launching it. ex node client.js start [name]
@param {string} [itemStack.instanceName="unknown"] the name of an instance for identification in statistics, as provided when launching it. ex node client start [name]
@returns {itemStack} the number of items actually removed, may be lower than what was asked for due to shortages.
*/
app.post("/api/remove", authenticate.middleware, function(req, res) {
+2 -2
View File
@@ -10,8 +10,8 @@
"cover": "nyc npm test",
"fast-cover": "FAST_TEST=y nyc npm test",
"ci-cover": "nyc --reporter=lcovonly npm run-script test",
"start": "echo Run node client.js start [instance] to start slaves && node master.js",
"install": "node lib/npmPostinstall.js",
"start": "echo Run node client start [instance] to start slaves && node master",
"install": "node lib/npmPostinstall",
"bundle-dependencies": "bundle-dependencies"
},
"nyc": {