Skip to content

Commit 068b61d

Browse files
committed
chore: test all the things when not in ci
Signed-off-by: Logan McAnsh <[email protected]>
1 parent f2f8160 commit 068b61d

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

__scripts/test.mjs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,31 @@ import { detect, getCommand } from "@antfu/ni";
77
import PackageJson from "@npmcli/package-json";
88
import fse from "fs-extra";
99

10-
const TO_IGNORE = [".github", "scripts", "yarn.lock", "package.json"];
10+
const TO_IGNORE = [".github", "__scripts", "yarn.lock", "package.json"];
1111

12-
const { stderr, stdout, exitCode } = await execa(
13-
"git",
14-
["--no-pager", "diff", "--name-only", "HEAD~1"],
15-
{ cwd: process.cwd() }
16-
);
12+
let examples = [];
1713

18-
if (exitCode !== 0) {
19-
console.error(stderr);
20-
process.exit(exitCode);
21-
}
14+
if (process.env.CI) {
15+
const { stderr, stdout, exitCode } = await execa(
16+
"git",
17+
["--no-pager", "diff", "--name-only", "HEAD~1"],
18+
{ cwd: process.cwd() }
19+
);
2220

23-
const files = stdout.split("\n");
21+
if (exitCode !== 0) {
22+
console.error(stderr);
23+
process.exit(exitCode);
24+
}
2425

25-
const dirs = files.map((f) => f.split("/").at(0));
26+
const files = stdout.split("\n");
2627

27-
const examples = [...new Set(dirs)].filter((d) => !TO_IGNORE.includes(d));
28+
const dirs = files.map((f) => f.split("/").at(0));
29+
30+
examples = [...new Set(dirs)].filter((d) => !TO_IGNORE.includes(d));
31+
} else {
32+
examples = await fse.readdir(process.cwd());
33+
examples = examples.filter((d) => !TO_IGNORE.includes(d));
34+
}
2835

2936
const list = new Intl.ListFormat("en", { style: "long", type: "conjunction" });
3037

0 commit comments

Comments
 (0)