candidate platform agnostic solution

This commit is contained in:
mattlongname
2022-12-31 22:11:10 -06:00
parent f09d4d33f1
commit 165a1c6b62
2 changed files with 27 additions and 2 deletions
+3 -2
View File
@@ -57,7 +57,8 @@ repos:
- id: next-lint-website
name: Lint website
files: ^website/
exclude: ^website/node_modules/
types_or: [javascript, jsx, ts, tsx]
language: system
language: node
pass_filenames: false
entry: bash -c "cd website && npm install && npm run lint"
entry: website/next-lint.js
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env node
const { spawnSync } = require("child_process");
async function npmLint() {
const spawnOption = {
shell: true,
env: process.env,
stdio: "inherit",
cwd: "./website",
};
let npmInstall;
let npmRunLint;
try {
npmInstall = await spawnSync("npm", ["install"], spawnOption);
if (npmInstall.status !== 0) {
process.exit(npmInstall.status);
}
npmRunLint = await spawnSync("npm", ["run lint"], spawnOption);
process.exit(npmRunLint.status);
} catch (error) {
console.error(error);
process.exit(1);
}
}
npmLint();