File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 1
- import { writeFile } from "../../../src/utils/fileSystem" ;
2
- import { HttpClient } from "../../../src/HttpClient" ;
1
+ import { writeFileSync } from "fs" ;
3
2
import { StructuredOptions } from "../from_spec" ;
4
3
4
+ /**
5
+ * Copy of the src/HttpClient.ts file
6
+ */
7
+ export enum HttpClient {
8
+ FETCH = 'fetch' ,
9
+ XHR = 'xhr' ,
10
+ NODE = 'node' ,
11
+ }
12
+
5
13
export const generateDefaultConfig = async ( path ) => {
6
14
console . log ( 'Generating default files to: ' , path ) ;
7
15
const default_config = getDefaultConfig ( ) ;
8
16
const raw_string = JSON . stringify ( default_config , undefined , 2 ) ;
9
- await writeFile ( path , raw_string ) ;
17
+ writeFileSync ( path , raw_string , { encoding : "utf8" } ) ;
10
18
}
11
19
12
20
function getDefaultConfig ( ) : StructuredOptions {
Original file line number Diff line number Diff line change @@ -2,7 +2,25 @@ import { Command } from "commander";
2
2
import { default_config_path , StructuredOptions } from "./from_spec" ;
3
3
import { existsSync , readFileSync } from "fs" ;
4
4
import { resolve } from "path" ;
5
- import { GenerationOptions } from "../../src/types/default" ;
5
+ import { HttpClient } from "./FromSpec/generateDefaultConfig" ;
6
+
7
+ /**
8
+ * Copy from src/types/default.src
9
+ */
10
+ export type GenerationOptions = {
11
+ input : string | Record < string , any > ;
12
+ output : string ;
13
+ httpClient ?: HttpClient ;
14
+ useOptions ?: boolean ;
15
+ useUnionTypes ?: boolean ;
16
+ exportCore ?: boolean ;
17
+ exportServices ?: boolean ;
18
+ exportModels ?: boolean ;
19
+ exportSchemas ?: boolean ;
20
+ request ?: string ;
21
+ write ?: boolean ;
22
+ } ;
23
+
6
24
7
25
const pkg = require ( '../../package.json' ) ;
8
26
You can’t perform that action at this time.
0 commit comments