This repository was archived by the owner on Aug 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33# Lints Markdown files using Mobify's `.remarkrc` configuration.
44BIN=" ${BASH_SOURCE[0]} "
5- BIN_DIR=" $( cd " $( dirname " $BIN " ) " && pwd) "
65
76# We jump through some hoops here because we symlink the node module's
87# bin into the docs/bin/ directory and we want to support invoking
98# via the symlink and directly via `/docs/bin/lint-md`
10- if [ -h " $BIN " ]; then
9+ while [ -h " $BIN " ]; do
1110 # Dereference the symlink
12- BIN=" $BIN_DIR /$( readlink " $BIN " ) "
13- fi
14- BIN_DIR=" $( cd " $( dirname " $BIN " ) " && pwd) "
11+ BIN=" $( cd " $( dirname " $BIN " ) " && pwd) /$( readlink " $BIN " ) "
12+ done
1513
16- REMARK_RC=" $BIN_DIR /../remarkrc"
17- REMARK_CLI=" $( npm bin) /remark"
14+ DOCS_DIR=" $( cd " $( dirname " $BIN " ) /.." && pwd) "
15+ REMARK_RC=" $DOCS_DIR /remarkrc"
16+
17+ # This is tricky. `remark` is a dep of mobify-code-style
18+ # and so won't show up in `node_modules/.bin` of a project
19+ # that uses mobify-code-style. We have to move into the
20+ # the mobify-code-style /docs directory and find the npm
21+ # bin directory relative that _that_ to find remark!
22+ REMARK_CLI=" $( cd " $DOCS_DIR " && npm bin) /remark"
1823
1924$REMARK_CLI --rc-path $REMARK_RC " $@ "
You can’t perform that action at this time.
0 commit comments