From d9f4c21ff9802ecb9d09bdf7b113cddb8ca5952e Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sat, 7 May 2022 15:32:08 +0200 Subject: [PATCH] rename inklecate to inkjs-compiler --- README.md | 6 +++--- package.json | 4 ++-- rollup.config.js | 8 ++++---- script/{inklecate.ts => inkjs-compiler.ts} | 6 ++++-- src/tests/compile.js | 11 +++++++---- 5 files changed, 20 insertions(+), 15 deletions(-) rename script/{inklecate.ts => inkjs-compiler.ts} (95%) diff --git a/README.md b/README.md index 69cc788b..d614680a 100644 --- a/README.md +++ b/README.md @@ -124,11 +124,11 @@ 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/package.json b/package.json index 863db937..1e279f78 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,8 @@ "devDependencies": { "@babel/core": "7.17.10", "@babel/preset-env": "7.17.10", + "@rollup/plugin-babel": "5.3.1", + "@rollup/plugin-node-resolve": "13.2.1", "@types/jest": "26.0.24", "@typescript-eslint/eslint-plugin": "4.28.5", "@typescript-eslint/eslint-plugin-tslint": "4.28.5", @@ -40,8 +42,6 @@ "prettier": "2.2.1", "remap-istanbul": "0.13.0", "rollup": "2.71.1", - "@rollup/plugin-babel": "5.3.1", - "@rollup/plugin-node-resolve": "13.2.1", "rollup-plugin-sourcemaps": "0.6.3", "rollup-plugin-terser": "7.0.2", "rollup-plugin-typescript2": "0.31.2", diff --git a/rollup.config.js b/rollup.config.js index 575400e1..d645ef73 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -7,7 +7,7 @@ import { babel } from '@rollup/plugin-babel'; const moduleName = 'inkjs'; const engineOnlyInputFile = 'src/engine/Story.ts'; const fullfeatureInputFile = 'src/compiler/Compiler.ts'; -const inklecateInputFile = 'script/inklecate.ts'; +const inklecateInputFile = 'script/inkjs-compiler.ts'; const format = 'umd'; const tsconfig = { tsconfig: "tsconfig.json", @@ -111,10 +111,10 @@ export default [ ] }, { - input: 'script/inklecate.ts', + 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";