mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-26 22:47:49 +02:00
refactor(v2): shift generated files out of core into website dir
This commit is contained in:
parent
d5722f0a54
commit
211e04f409
8 changed files with 37 additions and 11 deletions
|
@ -10,14 +10,11 @@ const fm = require('front-matter');
|
|||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
const fs = require('fs-extra');
|
||||
|
||||
const genPath = path.resolve(__dirname, '../core/__generated__');
|
||||
fs.ensureDirSync(genPath);
|
||||
|
||||
const genCache = new Map();
|
||||
async function generate(file, content) {
|
||||
async function generate(generatedFilesDir, file, content) {
|
||||
const cached = genCache.get(file);
|
||||
if (cached !== content) {
|
||||
await fs.writeFile(path.join(genPath, file), content);
|
||||
await fs.writeFile(path.join(generatedFilesDir, file), content);
|
||||
genCache.set(file, content);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue