UNPKG

@lipemat/js-boilerplate

Version:

Dependencies and scripts for a no config JavaScript app

49 lines 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPackageConfig = getPackageConfig; const path_1 = require("path"); const node_fs_1 = require("node:fs"); const workingDirectory = (0, node_fs_1.realpathSync)(process.cwd()); /** * @todo In version 11 change default values * 1. brotliFiles: true * 2. cssTsFiles: true * 3. shortCssClasses: true * 4. jsPath: './js' * * @note Must be coordinated with version 5 of postcss-boilerplate * * Update Readme.md to reflect these changes. */ const defaults = { brotliFiles: false, cssTsFiles: false, jsPath: './', packageDirectory: workingDirectory, shortCssClasses: false, url: 'http://localhost', }; let packageConfig = require((0, path_1.resolve)(workingDirectory, 'package.json')); packageConfig = { ...defaults, ...packageConfig }; packageConfig.workingDirectory = packageConfig.jsPath !== '' ? (0, path_1.resolve)(packageConfig.jsPath) : workingDirectory; try { const localConfig = require((0, path_1.resolve)(workingDirectory, './local-config.json')); packageConfig = { ...packageConfig, ...localConfig }; } catch (e) { } /** * Helper function to get the results of `packageConfig`. * * - Allows mocking the results of `packageConfig` for testing. * - Allows getting the config through a callback instead of an import. * * @since 10.3.0 */ function getPackageConfig() { return packageConfig; } packageConfig.getPackageConfig = getPackageConfig; packageConfig.default = packageConfig; module.exports = packageConfig; //# sourceMappingURL=package-config.js.map