Skip to content

Commit

Permalink
Merge pull request #954 from y-lohse/issue/rename-inklecate.js
Browse files Browse the repository at this point in the history
Rename inklecate to inkjs-compiler
  • Loading branch information
smwhr authored Oct 18, 2022
2 parents 6a590f2 + cb62a2d commit 1a79adf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <options> <ink file>
Usage: inkjs-compiler <options> <ink file>
-o <filename>: Output file name
-c: Count all visits to knots, stitches and weave points, not
just those referenced by TURNS_SINCE and read counts.
Expand Down
6 changes: 3 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
},
Expand Down
6 changes: 4 additions & 2 deletions script/inklecate.ts → script/inkjs-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <options> <ink file>
Usage: inkjs-compiler <options> <ink file>
-o <filename>: Output file name
-c: Count all visits to knots, stitches and weave points, not
just those referenced by TURNS_SINCE and read counts.
Expand All @@ -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(
Expand Down
11 changes: 7 additions & 4 deletions src/tests/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 1a79adf

Please sign in to comment.