mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-06-27 16:10:30 +08:00
candidate platform agnostic solution
This commit is contained in:
@@ -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
|
||||
|
||||
Executable
+24
@@ -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();
|
||||
Reference in New Issue
Block a user