Although, this can be dangerous if you forget the commas, as they can rise through the function to find a higher-level variable declaration, and become global in the process. You can read about that here You can read about that here.
Although, this can be dangerous if you forget the commas, as they can rise through the function to find a higher-level variable declaration, and become global in the process. You can read about that here.
Although, this can be dangerous if you forget the commas, as they can rise through the function to find a higher-level variable declaration, and become global in the process. You can read about that here.
Do you need to include the Content-Length
header in the API request?
Probably not.
config.headers["Content-Length"] = json.length;
The following could be a ternary:
if (err) {
reject(err);
} else {
resolve();
}
which can turn into:
err ? reject(err) : resolve();
Do you need to include the Content-Length
header in the API request?
Probably not.
config.headers["Content-Length"] = json.length;
The following could be a ternary:
if (err) {
reject(err);
} else {
resolve();
}
which can turn into:
err ? reject(err) : resolve();
There's a few points you could improve on, but for the most part, your code looks good.
Funny memes are funny, but, don't belong in comments :-(
* How to use:
* 1. Build the project and make sure that everything is in order.
* 2. Set up environment variables (see below).
* 3. Run `npm run deploy`.
* 4. Profit!
On a related note, this kinda thing probably belongs in one of the readme.md files, or a GitHub wiki page for the web client.
You can actually omit the var
s when you declare a few at once:
var copy = require('recursive-copy');
var FtpDeploy = require('ftp-deploy');
var path = require('path');
var request = require('request-promise');
var temp = require('temp').track();
Which can become:
var copy = require('recursive-copy'),
FtpDeploy = require('ftp-deploy'),
path = require('path'),
request = require('request-promise'),
temp = require('temp').track();
Although, this can be dangerous if you forget the commas, as they can rise through the function to find a higher-level variable declaration, and become global in the process. You can read about that here .
You shouldn't have random magic numbers/spells everywhere, use a spellbook (define them) instead.
host: "localhost",
port: 2121
roomId: 16134,
Or, make them parameters for input.
Remember that the chatrooms you're sending messages to support Markdown, it's best to use it.
text: "New web client version uploaded to http://play.cardshifter.com/."
into:
text: "New web client version uploaded to [play.cardshifter.com](http://play.cardshifter.com/)."
Consider using .join
s in future, also, JavaScript's string concatenation is a bit slow. Array joins run a bit faster, and let you use specified 'glue' also.
console.log("Deploying to ftp://" + config.host + ":" + config.port + "...");
There's a few points you could improve on, but for the most part, your code looks good.
Funny memes are funny, but, don't belong in comments :-(
* How to use:
* 1. Build the project and make sure that everything is in order.
* 2. Set up environment variables (see below).
* 3. Run `npm run deploy`.
* 4. Profit!
On a related note, this kinda thing probably belongs in one of the readme.md files, or a GitHub wiki page for the web client.
You can actually omit the var
s when you declare a few at once:
var copy = require('recursive-copy');
var FtpDeploy = require('ftp-deploy');
var path = require('path');
var request = require('request-promise');
var temp = require('temp').track();
Which can become:
var copy = require('recursive-copy'),
FtpDeploy = require('ftp-deploy'),
path = require('path'),
request = require('request-promise'),
temp = require('temp').track();
You shouldn't have random magic numbers/spells everywhere, use a spellbook (define them) instead.
host: "localhost",
port: 2121
roomId: 16134,
Or, make them parameters for input.
Remember that the chatrooms you're sending messages to support Markdown, it's best to use it.
text: "New web client version uploaded to http://play.cardshifter.com/."
into:
text: "New web client version uploaded to [play.cardshifter.com](http://play.cardshifter.com/)."
Consider using .join
s in future, also, JavaScript's string concatenation is a bit slow. Array joins run a bit faster, and let you use specified 'glue' also.
console.log("Deploying to ftp://" + config.host + ":" + config.port + "...");
There's a few points you could improve on, but for the most part, your code looks good.
Funny memes are funny, but, don't belong in comments :-(
* How to use:
* 1. Build the project and make sure that everything is in order.
* 2. Set up environment variables (see below).
* 3. Run `npm run deploy`.
* 4. Profit!
On a related note, this kinda thing probably belongs in one of the readme.md files, or a GitHub wiki page for the web client.
You can actually omit the var
s when you declare a few at once:
var copy = require('recursive-copy');
var FtpDeploy = require('ftp-deploy');
var path = require('path');
var request = require('request-promise');
var temp = require('temp').track();
Which can become:
var copy = require('recursive-copy'),
FtpDeploy = require('ftp-deploy'),
path = require('path'),
request = require('request-promise'),
temp = require('temp').track();
Although, this can be dangerous if you forget the commas, as they can rise through the function to find a higher-level variable declaration, and become global in the process. You can read about that here .
You shouldn't have random magic numbers/spells everywhere, use a spellbook (define them) instead.
host: "localhost",
port: 2121
roomId: 16134,
Or, make them parameters for input.
Remember that the chatrooms you're sending messages to support Markdown, it's best to use it.
text: "New web client version uploaded to http://play.cardshifter.com/."
into:
text: "New web client version uploaded to [play.cardshifter.com](http://play.cardshifter.com/)."
Consider using .join
s in future, also, JavaScript's string concatenation is a bit slow. Array joins run a bit faster, and let you use specified 'glue' also.
console.log("Deploying to ftp://" + config.host + ":" + config.port + "...");