1.3.3 • Published 3 years ago
@lugia/mega-config v1.3.3
@lugia/mega-config
Usage
import getUserConfig, {
watchConfigs,
unwatchConfigs,
} from '@lugia/mega-config';
// get user config
let config = null;
let userPKG = null;
let returnedWatchConfig = null;
try {
({ config, userPKG, watch: returnedWatchConfig } = getUserConfig({
cwd,
configFileName: configFile || CONFIG_FILE_NAME,
}));
debug(`user config: ${JSON.stringify(config)}`);
} catch (e) {
console.error(chalk.red(e.message));
debug(`Get ${CONFIG_FILE_NAME} config failed, watch config and reload`);
// 监听配置项变更,然后重新执行 dev 逻辑
watchConfigs({ cwd, configFileName: CONFIG_FILE_NAME }).on(
'all',
(event, path) => {
debug(`[${event}] ${path}, unwatch and reload`);
bs && bs.active && bs.exit(); // eslint-disable-line
bs = null;
unwatchConfigs();
runDev(opts);
},
);
return;
}
1.3.3
3 years ago
1.3.3-alpha.0
3 years ago
1.3.3-alpha.1
3 years ago
1.3.2
3 years ago
1.3.1
3 years ago
1.3.0
4 years ago
1.3.0-alpha.0
4 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.0
5 years ago
1.0.15
5 years ago