UNPKG

preact-material-components

Version:
40 lines (36 loc) 911 B
"use strict"; 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); }