Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript: Fix KaitaiStream module not found error #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions run-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ if [ "$OS" = "Windows_NT" ]; then
DIVIDER=";"
fi

# The `iconv-lite` package is assumed to be installed globally in the Docker
# image, but in Node.js 10 and older, you can only `require()` local packages,
# not global packages. `npm link` creates a symbolic link in the local
# `node_modules/` directory pointing to the globally installed package.
npm link iconv-lite

# Symlinks fresh KS JavaScript runtime into node_modules dir
# Symlink the folder after npm link, as npm might remove the folder
mkdir -p "$JAVASCRIPT_MODULES_DIR"
if [ ! -e "$JAVASCRIPT_MODULES_DIR/kaitai-struct" ]; then
ABS_JS_RUNTIME=$(pwd)/$JAVASCRIPT_RUNTIME_DIR
ln -s "$ABS_JS_RUNTIME" "$JAVASCRIPT_MODULES_DIR/kaitai-struct"
fi
# The `iconv-lite` package is assumed to be installed globally in the Docker
# image, but in Node.js 10 and older, you can only `require()` local packages,
# not global packages. `npm link` creates a symbolic link in the local
# `node_modules/` directory pointing to the globally installed package.
npm link iconv-lite

NODE_PATH="compiled/javascript${DIVIDER}helpers/javascript${DIVIDER}$JAVASCRIPT_MODULES_DIR" \
mocha spec/javascript