mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-02-23 14:39:32 +08:00
fix(docs): Fix _ref resolver function example.
This commit is contained in:
parent
8a2b43f590
commit
0903094ce5
@ -176,12 +176,20 @@ _ref:
|
||||
|
||||
const readFilePromise = promisify(fs.readFile);
|
||||
|
||||
async function useLocalOrSharedConfig(path, vars, context) {
|
||||
const localFile = await readFilePromise(path.resolve(path), 'utf8');
|
||||
async function useLocalOrSharedConfig(refPath, vars, context) {
|
||||
let fileContent
|
||||
try {
|
||||
fileContent = await readFilePromise(path.resolve(refPath), 'utf8');
|
||||
return fileContent;
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
fileContent = readFilePromise(path.resolve('../shared', refPath), 'utf8');
|
||||
return fileContent;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (localFile) return localFile;
|
||||
|
||||
return readFilePromise(path.resolve('../shared', path), 'utf8');
|
||||
}
|
||||
|
||||
module.exports = useLocalOrSharedConfig;
|
||||
|
Loading…
Reference in New Issue
Block a user