diff --git a/lib/utils/colors.js b/lib/utils/colors.js index 1abb049207..9df8f8ae69 100644 --- a/lib/utils/colors.js +++ b/lib/utils/colors.js @@ -1,6 +1,12 @@ 'use strict'; const colors = { + /** + * info color Method + * @param {?boolean} useColor - use color with message + * @param {string} msg - log message + * @returns {string} + */ info(useColor, msg) { if (useColor) { // Make text blue and bold, so it *pops* @@ -9,6 +15,12 @@ const colors = { return msg; }, + /** + * error color Method + * @param {?boolean} useColor - use color with message + * @param {string} msg - log message + * @returns {string} + */ error(useColor, msg) { if (useColor) { // Make text red and bold, so it *pops* diff --git a/lib/utils/createCertificate.js b/lib/utils/createCertificate.js index e701f8d559..c58cbdd4bb 100644 --- a/lib/utils/createCertificate.js +++ b/lib/utils/createCertificate.js @@ -1,7 +1,20 @@ 'use strict'; const selfsigned = require('selfsigned'); +/** + * Pem Type generated by the generatePem method of selfsigned package + * @typedef {Object} pemType + * @property {string} private - privateKeyToPem + * @property {string} public - publicKeyToPem + * @property {string} cert - certificateToPem + * @property {string} fingerprint + */ +/** + * Create Certificate Method + * @param {Object} attributes - selfsigned attributes refs : https://github.com/digitalbazaar/forge/blob/0.7.5/lib/x509.js#L129 + * @returns {pemType} + */ function createCertificate(attributes) { return selfsigned.generate(attributes, { algorithm: 'sha256', diff --git a/lib/utils/createConfig.js b/lib/utils/createConfig.js index 5c15b35c39..d25cf0768e 100644 --- a/lib/utils/createConfig.js +++ b/lib/utils/createConfig.js @@ -4,6 +4,24 @@ const path = require('path'); const isAbsoluteUrl = require('is-absolute-url'); const defaultTo = require('./defaultTo'); +/** + * Webpack-dev-server options + * @typedef {Object} WDSOptions - refs https://github.com/webpack/webpack-dev-server/blob/master/bin/options.js#L14 + */ + +/** + * Custom Configs passed as third argument to createConfig method + * @typedef {Object} customConfigs + * @property {number} port - port to listen + */ + +/** + * Create Config Method + * @param {Object} config - Webpack config, refs https://webpack.js.org/configuration/ + * @param {Object} argv - WDS CLI Arguments passed, refs https://github.com/webpack/webpack-dev-server/blob/master/bin/options.js#L14 + * @param {customConfigs} customArgs + * @returns {WDSOptions} + */ function createConfig(config, argv, { port }) { const firstWpOpt = Array.isArray(config) ? config[0] : config; const options = firstWpOpt.devServer || {}; diff --git a/tsconfig.json b/tsconfig.json index 8e65f3f910..77e038bcc7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,5 +12,10 @@ "types": ["node"], "esModuleInterop": true }, - "include": ["lib/utils/addEntries.js"] + "include": [ + "lib/utils/addEntries.js", + "lib/utils/colors.js", + "lib/utils/createCertificate.js", + "lib/utils/createConfig.js" + ] }