@@ -6,7 +6,7 @@ import pkg from "./package.json" with {type: "json"};
6
6
7
7
/** Builds the project. */
8
8
export async function build ( ) {
9
- await npx ( "tsc" , "--build" , "src/tsconfig.json" ) ;
9
+ await run ( "npx" , "tsc" , "--build" , "src/tsconfig.json" ) ;
10
10
}
11
11
12
12
/** Deletes all generated files. */
@@ -17,41 +17,31 @@ export async function clean() {
17
17
18
18
/** Builds the documentation. */
19
19
export async function doc ( ) {
20
- await npx ( "typedoc" , "--options" , "etc/typedoc.js" ) ;
20
+ await run ( "npx" , "typedoc" , "--options" , "etc/typedoc.js" ) ;
21
21
}
22
22
23
23
/** Performs the static analysis of source code. */
24
24
export async function lint ( ) {
25
- await npx ( "tsc" , "--build" , "tsconfig.json" , "--noEmit" ) ;
26
- await npx ( "eslint" , "--config=etc/eslint.js" , "gulpfile.js" , "example" , "src" , "test" ) ;
25
+ await run ( "npx" , "tsc" , "--build" , "tsconfig.json" , "--noEmit" ) ;
26
+ await run ( "npx" , "eslint" , "--config=etc/eslint.js" , "gulpfile.js" , "example" , "src" , "test" ) ;
27
27
}
28
28
29
29
/** Publishes the package. */
30
30
export async function publish ( ) {
31
- await npx ( "gulp" ) ;
31
+ await run ( "npx" , "gulp" ) ;
32
32
for ( const registry of [ "https://registry.npmjs.org" , "https://npm.pkg.github.com" ] ) await run ( "npm" , "publish" , `--registry=${ registry } ` ) ;
33
33
for ( const action of [ [ "tag" ] , [ "push" , "origin" ] ] ) await run ( "git" , ...action , `v${ pkg . version } ` ) ;
34
34
}
35
35
36
36
/** Runs the test suite. */
37
37
export async function test ( ) {
38
- await npx ( "tsc" , "--build" , "src/tsconfig.json" , "--sourceMap" ) ;
38
+ await run ( "npx" , "tsc" , "--build" , "src/tsconfig.json" , "--sourceMap" ) ;
39
39
await run ( "node" , "--enable-source-maps" , "--test" ) ;
40
40
}
41
41
42
42
/** The default task. */
43
43
export default gulp . series ( clean , build ) ;
44
44
45
- /**
46
- * Executes a command from a local package.
47
- * @param {string } command The command to run.
48
- * @param {...string } args The command arguments.
49
- * @return {Promise<void> } Resolves when the command is terminated.
50
- */
51
- function npx ( command , ...args ) {
52
- return run ( "npm" , "exec" , "--" , command , ...args ) ;
53
- }
54
-
55
45
/**
56
46
* Spawns a new process using the specified command.
57
47
* @param {string } command The command to run.
0 commit comments