Skip to content

Commit

Permalink
Bugfix: Runtime extract ignores global flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmasoldi3r committed Jul 26, 2020
1 parent 63ea7e0 commit 38b5ff7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "charon",
"version": "0.11.0",
"version": "0.11.1",
"preview": true,
"description": "Charon language compiler",
"main": "dist/index.js",
Expand Down
8 changes: 7 additions & 1 deletion src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ export default class Main {
.argv;
if (args["extract-runtime"]) {
console.log('Extracting runtime to current working directory...');
writeFileSync('charon-runtime.lua', readFileSync('charon-runtime.lua'));
let src: Buffer | string = readFileSync('charon-runtime.lua');
if (args["global-export"]) {
src = src.toString()
.replace(/local (charon.+?\n)/, '$1')
.replace(/(return charon;)/, '-- $1');
}
writeFileSync('charon-runtime.lua', src);
// Prevent error when using only extract runtime.
if (args._.length === 0) return 0;
}
Expand Down

0 comments on commit 38b5ff7

Please sign in to comment.