Skip to content

Commit

Permalink
Friggin Node.js 10
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Dec 18, 2020
1 parent 911dd5f commit 7713ebb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
NO_ELM_TOOLING_INSTALL: 1

- name: elm-tooling install
run: npx --no-install elm-tooling install
run: npm run prepare

- name: Flow
run: npx --no-install flow check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
NO_ELM_TOOLING_INSTALL: 1

- name: elm-tooling install
run: npx --no-install elm-tooling install
run: npm run prepare

- name: Mocha
run: npx --no-install mocha tests
Expand Down
11 changes: 11 additions & 0 deletions elm-tooling-polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Only `elm-tooling/getExecutable` supports Node.js 10, the rest of it is
// Node.js 12+. Luckily, all that’s needed is to polyfill `.flatMap`.
// We can get rid of this when Node.js 10 becomes EOL 2021-04-30 and support for
// Node.js 10 is dropped.
// Note: This is only used during development and CI of node-test-runner, not
// for users of the npm package.
if (Array.prototype.flatMap === undefined) {
Array.prototype.flatMap = function flatMap(...args) {
return [].concat(...this.map(...args));
};
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"check": "flow check && npm run lint && npm run format:check && npm run review",
"format:check": "prettier --check . && elm-format elm --validate",
"format:write": "prettier --write . && elm-format elm --yes",
"prepare": "elm-tooling install"
"prepare": "node -r ./elm-tooling-polyfill.js node_modules/elm-tooling/index.js install"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 7713ebb

Please sign in to comment.