diff --git a/README.md b/README.md index 9dd82d97..979eeab9 100644 --- a/README.md +++ b/README.md @@ -124,12 +124,12 @@ var result = EvaluateFunction('my_ink_function', ['arg1', 'arg2'], true); ## Compiler -### inklecate.js +### inkjs-compiler.js ```shell -$ node inklecate.js -h +$ node inkjs-compiler.js -h -Usage: inklecate +Usage: inkjs-compiler -o : Output file name -c: Count all visits to knots, stitches and weave points, not just those referenced by TURNS_SINCE and read counts. diff --git a/rollup.config.js b/rollup.config.js index a8ec179e..5698d863 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -8,7 +8,7 @@ const moduleName = 'inkjs'; const engineOnlyInputFile = 'src/engine/Story.ts'; const fullfeatureInputFile = 'src/compiler/Compiler.ts'; const posixHandlerInputFile = 'src/compiler/FileHandler/PosixFileHandler.ts'; -const inklecateInputFile = 'script/inklecate.ts'; +const inklecateInputFile = 'script/inkjs-compiler.ts'; const format = 'umd'; const tsconfig = { tsconfig: "tsconfig.json", @@ -114,8 +114,8 @@ export default [ { input: inklecateInputFile, output: { - name: 'inklecate', - file: 'dist/inklecate.js', + name: 'inkjs-compiler', + file: 'dist/inkjs-compiler.js', format: 'commonjs', sourcemap: false }, diff --git a/script/inklecate.ts b/script/inkjs-compiler.ts similarity index 95% rename from script/inklecate.ts rename to script/inkjs-compiler.ts index 28a2606a..36da922a 100644 --- a/script/inklecate.ts +++ b/script/inkjs-compiler.ts @@ -3,12 +3,14 @@ import { CompilerOptions } from '../src/compiler/CompilerOptions'; import { Story } from '../src/engine/Story'; import { PosixFileHandler } from '../src/compiler/FileHandler/PosixFileHandler'; var readline = require('readline'); +var path = require('path'); + import * as fs from "fs"; const help = process.argv.includes("-h"); if(help){ process.stdout.write(` -Usage: inklecate +Usage: inkjs-compiler -o : Output file name -c: Count all visits to knots, stitches and weave points, not just those referenced by TURNS_SINCE and read counts. @@ -35,7 +37,7 @@ if(!inputFile){ } outputfile = outputfile || inputFile+".json"; -const fileHandler = new PosixFileHandler(inputFile); +const fileHandler = new PosixFileHandler(path.dirname(inputFile)); const mainInk = fileHandler.LoadInkFileContents(inputFile); const options = new CompilerOptions( diff --git a/src/tests/compile.js b/src/tests/compile.js index 2aa9963e..daf4efd7 100644 --- a/src/tests/compile.js +++ b/src/tests/compile.js @@ -3,8 +3,11 @@ // TODO: Fix this issue and refactor the entire file. /* eslint-disable @typescript-eslint/no-var-requires */ -// Recompile baseline ink files with the current version -// of inklecate available in $PATH. +// Recompile baseline ink files with specified cli compiler +// +// Usage +// node src/tests/compile.js # uses inklecate from $PATH +// node src/tests/compile.js "node dist/inkjs-compiler.js" # uses inkjs-compiler let childProcess = require("child_process"); let glob = require("glob"); @@ -101,11 +104,11 @@ async function compileInkFile(inklecate) { if (errors.length === 0) { console.log("Done."); } else { - errors.forEach((error) => console.error(`\n${error.reason.message}`)); + errors.forEach((error) => console.error(`\n${error.reason.message.substring(0,255)}`)); } } -let inklecate = process.argv[3]; +let inklecate = process.argv[2]; if (!inklecate || inklecate === "") { inklecate = "inklecate";