Adding some typings in npm scripts

This commit is contained in:
Matt Bierner 2018-10-15 17:24:11 -07:00
parent 63d0559cff
commit a3fa7ad178
4 changed files with 17 additions and 2 deletions

View file

@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"jsx": "preserve"
"jsx": "preserve",
"checkJs": true
},
"include": [
"**/*.js"

View file

@ -8,6 +8,10 @@ const path = require('path');
const fs = require('fs');
const yarn = process.platform === 'win32' ? 'yarn.cmd' : 'yarn';
/**
* @param {string} location
* @param {*} [opts]
*/
function yarnInstall(location, opts) {
opts = opts || {};
opts.cwd = location;

View file

@ -7,6 +7,9 @@ const cp = require('child_process');
const fs = require('fs');
const path = require('path');
/**
* @param {string} location
*/
function updateGrammar(location) {
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
const result = cp.spawnSync(npm, ['run', 'update-grammar'], {

View file

@ -12,6 +12,9 @@ var cson = require('cson-parser');
var https = require('https');
var url = require('url');
/**
* @param {string} urlString
*/
function getOptions(urlString) {
var _url = url.parse(urlString);
var headers = {
@ -19,7 +22,7 @@ function getOptions(urlString) {
};
var token = process.env['GITHUB_TOKEN'];
if (token) {
headers['Authorization'] = 'token ' + token
headers['Authorization'] = 'token ' + token;
}
return {
protocol: _url.protocol,
@ -30,6 +33,10 @@ function getOptions(urlString) {
};
}
/**
* @param {string} url
* @param {number} redirectCount
*/
function download(url, redirectCount) {
return new Promise((c, e) => {
var content = '';