refactor(v2): shift plugin cache generation into its own dir

This commit is contained in:
Yangshun Tay 2019-03-02 20:29:49 -08:00
parent 92c7e1f44b
commit 95ca07a646
3 changed files with 9 additions and 5 deletions

View file

@ -99,10 +99,12 @@ module.exports = async function load(siteDir) {
contents,
};
contentsStore[options.contentKey] = pluginContents;
const pluginCacheDir = path.join(generatedFilesDir, name);
fs.ensureDirSync(pluginCacheDir);
await generate(
generatedFilesDir,
options.cachePath,
`export default ${JSON.stringify(contents, null, 2)};`,
pluginCacheDir,
options.cacheFileName,
JSON.stringify(contents, null, 2),
);
}),
);
@ -141,5 +143,7 @@ module.exports = async function load(siteDir) {
const routesConfig = await genRoutesConfig(props);
await generate(generatedFilesDir, 'routes.js', routesConfig);
await generate(generatedFilesDir, 'routes.js', routesConfig);
return props;
};