preact-material-components
Version:
preact wrapper for "Material Components for the web"
40 lines (36 loc) • 911 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = printVersion;
/**
* @author Toru Nagashima
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
// In tests, `../../package.json` is correct.
var version = read("../package.json") || read("../../package.json");
/**
* Reads the version of `npm-run-all`.
*
* @param {string} path - A path to `package.json`.
* @returns {string|null} A version text.
*/
function read(path) {
try {
return require(path).version;
} catch (err) {
return null;
}
}
/**
* Print a version text.
*
* @param {stream.Writable} output - A writable stream to print.
* @returns {Promise} Always a fulfilled promise.
* @private
*/
function printVersion(output) {
output.write("v" + version + "\n");
return Promise.resolve(null);
}