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

ci: Work around npm behavior changes to fix CI on main #206

Merged
merged 2 commits into from Jun 21, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 17 additions & 11 deletions npm-prepare.js
Expand Up @@ -6,17 +6,23 @@

"use strict";

const childProcess = require("child_process");
const fs = require("fs");
const path = require("path");
if (!process.env.NO_RECURSIVE_PREPARE) {
const childProcess = require("child_process");
const fs = require("fs");
const path = require("path");

const examplesDir = path.resolve(__dirname, "examples");
const examples = fs.readdirSync(examplesDir)
.filter(exampleDir => fs.statSync(path.join(examplesDir, exampleDir)).isDirectory())
.filter(exampleDir => fs.existsSync(path.join(examplesDir, exampleDir, "package.json")));
const examplesDir = path.resolve(__dirname, "examples");
const examples = fs.readdirSync(examplesDir)
.filter(exampleDir => fs.statSync(path.join(examplesDir, exampleDir)).isDirectory())
.filter(exampleDir => fs.existsSync(path.join(examplesDir, exampleDir, "package.json")));

for (const example of examples) {
childProcess.execSync("npm install", {
cwd: path.resolve(examplesDir, example)
});
for (const example of examples) {
childProcess.execSync("npm install", {
cwd: path.resolve(examplesDir, example),
env: {
...process.env,
NO_RECURSIVE_PREPARE: "true"
}
});
}
}
2 changes: 1 addition & 1 deletion tests/lib/plugin.js
Expand Up @@ -82,7 +82,7 @@ describe("recommended config", () => {
// eslint-disable-next-line no-invalid-this
this.timeout(30000);

execSync("npm link && npm link eslint-plugin-markdown");
execSync("npm link && npm link eslint-plugin-markdown --legacy-peer-deps");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to use --legacy-peer-deps because there is no version of eslint-plugin-jsdoc that supports ESLint 6, 7, and 8. --legacy-peer-deps disables additional peer dependency checks that were added in npm 8.6.0 and caused our CI to begin failing.

} else {
throw error;
}
Expand Down