UNPKG

wux-weapp

Version:

一套组件化、可复用、易扩展的微信小程序 UI 组件库

29 lines (25 loc) 726 B
/* eslint global-require: "off" */ /* eslint no-console: ["error", { allow: ["log"] }] */ const path = require('path'); let config = require('./config.json'); let logged = false; function getConfig() { const args = process.argv; let configArgIndex; let configPath; args.forEach((arg, argIndex) => { if (arg === '--config') configArgIndex = argIndex; }); if (configArgIndex && args[configArgIndex + 1]) { configPath = path.resolve(args[configArgIndex + 1]); } if (configPath) { config = require(configPath); // eslint-disable-line if (!logged) { console.log(`Building using custom config from ${configPath}`); } logged = true; } return config; } module.exports = getConfig;