-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,744 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import {cp} from "node:fs/promises"; | ||
import {deleteAsync} from "del"; | ||
import {$} from "execa"; | ||
import gulp from "gulp"; | ||
import replace from "gulp-replace"; | ||
import pkg from "./package.json" with {type: "json"}; | ||
|
||
// Builds the project. | ||
export async function build() { | ||
return $`tsc --project src`; | ||
} | ||
|
||
// Deletes all generated files. | ||
export function clean() { | ||
return deleteAsync(["lib", "var/**/*"]); | ||
} | ||
|
||
// Builds the documentation. | ||
export async function doc() { | ||
await build(); | ||
await $`typedoc --options etc/typedoc.js`; | ||
for (const file of ["CHANGELOG.md", "LICENSE.md"]) await cp(file, `docs/${file.toLowerCase()}`); | ||
return cp("docs/favicon.ico", "docs/api/favicon.ico"); | ||
} | ||
|
||
// Performs the static analysis of source code. | ||
export async function lint() { | ||
await build(); | ||
await $`tsc --project .`; | ||
return $`eslint --config=etc/eslint.config.js gulpfile.js etc 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() { | ||
await build(); | ||
return $`node --test --test-reporter=spec`; | ||
} | ||
|
||
// Updates the version number in the sources. | ||
export function version() { | ||
return gulp.src("src/client.ts") | ||
.pipe(replace(/#version = "\d+(\.\d+){2}"/, `#version = "${pkg.version}"`)) | ||
.pipe(gulp.dest("src")); | ||
} | ||
|
||
// The default task. | ||
export default gulp.series( | ||
clean, | ||
version, | ||
build | ||
); |
Oops, something went wrong.