greybel-js
Version:
Transpiler/Interpreter for GreyScript. (GreyHack)
14 lines • 677 B
JavaScript
import fs from 'fs/promises';
import { mkdirpNative } from 'mkdirp';
import path from 'path';
import { createBasePath } from './create-base-path.js';
export const createParseResult = async (rootDir, buildPath, result) => {
const relativePathFactory = (filePath) => createBasePath(rootDir, filePath);
await Promise.all(Object.entries(result).map(async ([file, code]) => {
const relativePath = relativePathFactory(file);
const fullPath = path.resolve(buildPath, relativePath);
await mkdirpNative(path.dirname(fullPath));
await fs.writeFile(fullPath, code, { encoding: 'utf-8' });
}));
};
//# sourceMappingURL=create-parse-result.js.map