mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
chore: small cleanup of scripts in ./tools and run copyright checker in lint.js (#17393)
This commit is contained in:
parent
377f593273
commit
3d423e114e
8 changed files with 121 additions and 153 deletions
|
@ -7,6 +7,28 @@ import {
|
|||
join,
|
||||
ROOT_PATH,
|
||||
} from "./util.js";
|
||||
import { checkCopyright } from "./copyright_checker.js";
|
||||
|
||||
let didLint = false;
|
||||
|
||||
if (Deno.args.includes("--js")) {
|
||||
await dlint();
|
||||
await dlintPreferPrimordials();
|
||||
didLint = true;
|
||||
}
|
||||
|
||||
if (Deno.args.includes("--rs")) {
|
||||
await clippy();
|
||||
didLint = true;
|
||||
}
|
||||
|
||||
if (!didLint) {
|
||||
await dlint();
|
||||
await dlintPreferPrimordials();
|
||||
console.log("copyright checker");
|
||||
await checkCopyright();
|
||||
await clippy();
|
||||
}
|
||||
|
||||
async function dlint() {
|
||||
const configFile = join(ROOT_PATH, ".dlint.json");
|
||||
|
@ -44,6 +66,7 @@ async function dlint() {
|
|||
const chunks = splitToChunks(sourceFiles, `${execPath} run`.length);
|
||||
for (const chunk of chunks) {
|
||||
const cmd = new Deno.Command(execPath, {
|
||||
cwd: ROOT_PATH,
|
||||
args: ["run", "--config=" + configFile, ...chunk],
|
||||
stdout: "inherit",
|
||||
stderr: "inherit",
|
||||
|
@ -77,6 +100,7 @@ async function dlintPreferPrimordials() {
|
|||
const chunks = splitToChunks(sourceFiles, `${execPath} run`.length);
|
||||
for (const chunk of chunks) {
|
||||
const cmd = new Deno.Command(execPath, {
|
||||
cwd: ROOT_PATH,
|
||||
args: ["run", "--rule", "prefer-primordials", ...chunk],
|
||||
stdout: "inherit",
|
||||
stderr: "inherit",
|
||||
|
@ -116,6 +140,7 @@ async function clippy() {
|
|||
}
|
||||
|
||||
const cargoCmd = new Deno.Command("cargo", {
|
||||
cwd: ROOT_PATH,
|
||||
args: [
|
||||
...cmd,
|
||||
"--",
|
||||
|
@ -131,28 +156,3 @@ async function clippy() {
|
|||
throw new Error("clippy failed");
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await Deno.chdir(ROOT_PATH);
|
||||
|
||||
let didLint = false;
|
||||
|
||||
if (Deno.args.includes("--js")) {
|
||||
await dlint();
|
||||
await dlintPreferPrimordials();
|
||||
didLint = true;
|
||||
}
|
||||
|
||||
if (Deno.args.includes("--rs")) {
|
||||
await clippy();
|
||||
didLint = true;
|
||||
}
|
||||
|
||||
if (!didLint) {
|
||||
await dlint();
|
||||
await dlintPreferPrimordials();
|
||||
await clippy();
|
||||
}
|
||||
}
|
||||
|
||||
await main();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue