-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
44 lines (37 loc) · 1.13 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import {deleteAsync} from "del";
import {execa} from "execa";
import gulp from "gulp";
import {env} from "node:process";
import pkg from "./package.json" with {type: "json"};
// Runs a command.
const $ = execa({preferLocal: true, stdio: "inherit"});
// Builds the project.
export function build() {
return $`tsc --build src/tsconfig.json`;
}
// Deletes all generated files.
export function clean() {
return deleteAsync(["lib", "var/**/*"]);
}
// Performs the static analysis of source code.
export async function lint() {
await build();
await $`tsc --build tsconfig.json`;
return $`eslint --config=etc/eslint.js gulpfile.js example src test`;
}
// Publishes the package.
export async function publish() {
for (const registry of ["https://registry.npmjs.org", "https://npm.pkg.github.com"]) await $`npm publish --registry=${registry}`;
for (const action of [["tag"], ["push", "origin"]]) await $`git ${action} v${pkg.version}`;
}
// Runs the test suite.
export async function test() {
env.NODE_ENV = "test";
await build();
return $`node --test --test-reporter=spec`;
}
// The default task.
export default gulp.series(
clean,
build
);