Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
join(paths.absPagesPath, `${path}.${jsxExt}`),
context,
);
this.fs.copyTpl(
this.templatePath('page.css.tpl'),
join(paths.absPagesPath, `${path}.${cssExt}`),
context,
);
if (config.routes) {
writeNewRoute(
{
path: `/${path === 'index' ? '' : path}`,
component: `./${path}`,
},
getConfigFile(cwd),
paths.absSrcPath,
);
// log.warn(
// `You should config the routes in config.routes manunally since ${chalk.red(
// 'config.routes',
// )} exists`,
// );
console.log();
}
}
};
getConfig(opts = {}) {
const { paths, cwd } = this.service;
const { force, setConfig } = opts;
const defaultConfig = this.service.applyPlugins('modifyDefaultConfig', {
initialValue: {},
});
const file = getConfigFile(cwd);
this.file = file;
if (!file) {
return defaultConfig;
}
// 强制读取,不走 require 缓存
if (force) {
cleanConfigRequireCache(cwd);
}
let config = null;
const relativeFile = file.replace(`${paths.cwd}/`, '');
this.relativeFile = relativeFile;
const onError = (e, file) => {
const msg = `配置文件 "${file.replace(`${paths.cwd}/`, '')}" 解析出错,请检查语法。