Skip to content

Commit

Permalink
fix compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Jun 6, 2022
1 parent b8cb024 commit 2b7f55f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*~
src
examples
.*
assets
Expand Down
18 changes: 12 additions & 6 deletions bin/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ const escodegen = require('escodegen');
const json = require('../package.json');
const fs = require('fs');

const { readFile, writeFile, stat, mkdir } = fs.promises;
const { writeFile, stat, mkdir } = fs.promises;

function readFile(filepath) {
const abs_path = require.resolve(filepath);
return fs.promises.readFile(abs_path);
}


const options = lily(process.argv.slice(2), { boolean: ['debug', 'raw'] });
const executable = path.basename(process.argv[1]);
Expand All @@ -18,7 +24,7 @@ if (options.v || options.version) {
} else if (options._.length !== 1) {
console.error(`usage: ${executable} -v | -o <output directory> <input.gs>`);
} else {
readFile(options._[0]).then(async buffer => {
fs.promises.readFile(options._[0]).then(async buffer => {
const source = buffer.toString();
try {
const ast = parser.parse(source);
Expand Down Expand Up @@ -86,15 +92,15 @@ async function directory_exists(path) {
}

async function wrap_code(code) {
var prefx = await readFile('./src/prefix.js');
var postfix = await readFile('./src/postfix.js');
var prefx = await readFile('../src/prefix.js');
var postfix = await readFile('../src/postfix.js');
var result = [prefx, code, postfix].join('\n');
return add_version(result);
}

async function get_terminal(mapping) {
const html = (await readFile('./src/terminal.html')).toString();
const css = (await readFile('./src/terminal.css')).toString();
const html = (await readFile('../src/terminal.html')).toString();
const css = (await readFile('../src/terminal.css')).toString();
return template(html, Object.assign({
STYLE: css,
HTML: '<div id="term"></div>',
Expand Down

0 comments on commit 2b7f55f

Please sign in to comment.