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

Fix: npm prepare script on Windows (refs #166) #168

Merged
merged 4 commits into from
Dec 20, 2020
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ jobs:

test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
node-version: ["8.10.0", 8.x, 10.x, 12.x, 13.x, 14.x]
include:
- os: windows-latest
node: "12.x"
- os: macOS-latest
node: "12.x"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
20 changes: 20 additions & 0 deletions npm-prepare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* @fileoverview Install examples' dependencies as part of local npm install for
* development and CI.
* @author btmills
*/

"use strict";
btmills marked this conversation as resolved.
Show resolved Hide resolved

const childProcess = require("child_process");
const fs = require("fs");
const path = require("path");

const examplesDir = path.resolve(__dirname, "examples");
const examples = fs.readdirSync(examplesDir);

for (const example of examples) {
childProcess.execSync("npm install", {
cwd: path.resolve(examplesDir, example)
});
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
],
"scripts": {
"lint": "eslint --ext js,md .",
"prepare": "for example in examples/*; do (cd \"$example\" && npm install); done",
"prepare": "node ./npm-prepare.js",
"test": "npm run lint && npm run test-cov",
"test-cov": "nyc _mocha -- -c tests/{examples,lib}/**/*.js",
"generate-release": "eslint-generate-release",
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("recommended config", () => {
// hook-level timeouts uses `this`, so disable the rule.
// https://mochajs.org/#hook-level
// eslint-disable-next-line no-invalid-this
this.timeout(9999);
this.timeout(30000);

execSync("npm link && npm link eslint-plugin-markdown");
} else {
Expand Down