File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env tsx
2
2
/* eslint-disable max-len */
3
+ import path from 'path' ;
3
4
import yargs from 'yargs' ;
4
5
import { hideBin } from 'yargs/helpers' ;
5
6
import * as fs from 'fs' ;
@@ -19,7 +20,7 @@ const argv = yargs(hideBin(process.argv))
19
20
} ,
20
21
config : {
21
22
description : 'Path to custom git-proxy configuration file.' ,
22
- default : 'proxy.config.json' ,
23
+ default : path . join ( __dirname , 'proxy.config.json' ) ,
23
24
required : false ,
24
25
alias : 'c' ,
25
26
type : 'string' ,
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { readFileSync } from 'fs';
2
2
import { join } from 'path' ;
3
3
import { validate as jsonSchemaValidate } from 'jsonschema' ;
4
4
5
- export let configFile : string = join ( process . cwd ( ) , 'proxy.config.json' ) ;
5
+ export let configFile : string = join ( __dirname , '../../ proxy.config.json' ) ;
6
6
7
7
/**
8
8
* Set the config file path.
@@ -20,7 +20,7 @@ export function setConfigFile(file: string) {
20
20
*/
21
21
export function validate ( configFilePath : string = configFile ! ) : boolean {
22
22
const config = JSON . parse ( readFileSync ( configFilePath , 'utf-8' ) ) ;
23
- const schemaPath = join ( process . cwd ( ) , 'config.schema.json' ) ;
23
+ const schemaPath = join ( __dirname , '../../ config.schema.json' ) ;
24
24
const schema = JSON . parse ( readFileSync ( schemaPath , 'utf-8' ) ) ;
25
25
jsonSchemaValidate ( config , schema , { required : true , throwError : true } ) ;
26
26
return true ;
You can’t perform that action at this time.
0 commit comments