@@ -4,7 +4,7 @@ import { join } from "path"
4
4
/**
5
5
* Minify all the given JSON files in place. It minifies the files in parallel.
6
6
*
7
- * @param files The paths to the files
7
+ * @param files an array of paths to the files
8
8
* @returns {Promise<void> } Returns a void promise that resolves when all the files are minified
9
9
* @throws {Promise<string | Error> } The promise is rejected with the reason for failure
10
10
*/
@@ -36,18 +36,19 @@ export async function minifyString(jsonString: string): Promise<string> {
36
36
return ( await spawnMinijson ( [ "--string" , jsonString ] ) ) . trim ( )
37
37
}
38
38
39
+ const exeExtention = process . platform === "win32" ? ".exe" : ""
40
+ const binName = `minijson${ exeExtention } `
41
+
42
+ const minijsonBin = join ( __dirname , `${ process . platform } -${ process . arch } ` , binName )
43
+
39
44
/**
40
45
* Spawn minijson with the given arguments
41
46
*
47
+ * @param args an array of arguments
42
48
* @returns {Promise<string> } Returns a promise that resolves to stdout output string when the operation finishes
43
49
* @throws {Promise<string | Error> } The promise is rejected with the reason for failure
44
50
*/
45
51
export function spawnMinijson ( args : string [ ] ) : Promise < string > {
46
- const exeExtention = process . platform === "win32" ? ".exe" : ""
47
- const binName = `minijson${ exeExtention } `
48
-
49
- const minijsonBin = join ( __dirname , `${ process . platform } -${ process . arch } ` , binName )
50
-
51
52
return new Promise < string > ( ( resolve , reject ) => {
52
53
execFile ( minijsonBin , args , ( err , stdout , stderr ) => {
53
54
if ( err ) {
0 commit comments