Skip to content

Commit

Permalink
Hack around node_modules issue by moving them to a non-mounted location
Browse files Browse the repository at this point in the history
  • Loading branch information
keynmol committed Jun 26, 2024
1 parent ff59c0e commit 45cdad9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
6 changes: 1 addition & 5 deletions dev/Dockerfile.bindings
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ RUN asdf install && \

WORKDIR /src

# We're doing it to circumvent issues with Yarn not being able to write to
# node_modules under this root (in some circumstances, on CI only)
RUN chown -R asdf:asdf /src && chmod -R 0666 /src

CMD ["bash", "-c", "./dev/proto-generate.sh && ./cmd/scip/tests/reprolang/generate-tree-sitter-parser.sh"]
CMD ["./dev/docker-entrypoint.sh"]


16 changes: 16 additions & 0 deletions dev/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -xeuo pipefail

# We're explicitly overriding the node_modules location used by Yarn because
# of issues when mounting node_modules inside the docker container AND running
# it under non-root user.

echo "--modules-folder $HOME/my-node-modules" > .yarnrc

export PATH="$PATH:$HOME/my-node-modules/.bin"
export NODE_PATH="$HOME/my-node-modules"

./dev/proto-generate.sh

./cmd/scip/tests/reprolang/generate-tree-sitter-parser.sh
2 changes: 1 addition & 1 deletion dev/generate-all-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ cd "$(dirname "${BASH_SOURCE[0]}")/.." # cd to repo root dir

IMAGE_NAME=$(./dev/build-docker-environment.sh)

docker run -v $(pwd):/src $IMAGE_NAME
docker run -v $(pwd):/src -v /src/node_modules $IMAGE_NAME

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"author": "SCIP authors",
"license": "MIT",
"scripts": {
"build": "./node_modules/.bin/tsc --build --force bindings/typescript",
"prettier": "./node_modules/.bin/prettier --write --list-different '**/*.{ts,js(on)?,md,yml}'",
"prettier-check": "./node_modules/.bin/prettier --check '**/*.{ts,js(on)?,md,yml}'"
"build": "tsc --build --force bindings/typescript",
"prettier": "prettier --write --list-different '**/*.{ts,js(on)?,md,yml}'",
"prettier-check": "prettier --check '**/*.{ts,js(on)?,md,yml}'"
},
"workspaces": {
"packages": [
Expand Down

0 comments on commit 45cdad9

Please sign in to comment.