1
1
import path from 'path'
2
2
import fs from 'fs'
3
- import { WebConfigSchema , WebStaticConfigSchema } from '../types.js'
3
+ import { Config , WebStaticConfig } from '../types.js'
4
4
5
- export const DEFAULT_WEB_STATIC_CONFIG : WebStaticConfigSchema = [
5
+ export const DEFAULT_WEB_STATIC_CONFIG : WebStaticConfig = [
6
6
{
7
7
"name" : "lambdatest-home-page" ,
8
8
"url" : "https://www.lambdatest.com" ,
@@ -14,7 +14,7 @@ export const DEFAULT_WEB_STATIC_CONFIG: WebStaticConfigSchema = [
14
14
}
15
15
]
16
16
17
- export const DEFAULT_WEB_CONFIG : WebConfigSchema = {
17
+ export const DEFAULT_CONFIG : Config = {
18
18
web : {
19
19
browsers : [
20
20
'chrome' ,
@@ -27,13 +27,13 @@ export const DEFAULT_WEB_CONFIG: WebConfigSchema = {
27
27
[ 1366 , 768 ] ,
28
28
[ 360 , 640 ] ,
29
29
] ,
30
- waitForTimeout : 0 ,
30
+ waitForTimeout : 1000 ,
31
31
}
32
32
} ;
33
33
34
- export function createWebConfig ( filepath : string ) {
34
+ export function createConfig ( filepath : string ) {
35
35
// default filepath
36
- filepath = filepath || 'smartui-web .json' ;
36
+ filepath = filepath || '. smartui.json' ;
37
37
let filetype = path . extname ( filepath ) ;
38
38
if ( filetype != '.json' ) {
39
39
console . log ( 'Error: Config file must have .json extension' ) ;
@@ -42,15 +42,15 @@ export function createWebConfig(filepath: string) {
42
42
43
43
// verify the file does not already exist
44
44
if ( fs . existsSync ( filepath ) ) {
45
- console . log ( `Error: SmartUI Web Config already exists: ${ filepath } ` ) ;
46
- console . log ( `To create a new file, please specify the file name like: 'smartui config:create-web webConfig .json'` ) ;
45
+ console . log ( `Error: SmartUI Config already exists: ${ filepath } ` ) ;
46
+ console . log ( `To create a new file, please specify the file name like: 'smartui config:create .smartui-config .json'` ) ;
47
47
return
48
48
}
49
49
50
50
// write stringified default config options to the filepath
51
51
fs . mkdirSync ( path . dirname ( filepath ) , { recursive : true } ) ;
52
- fs . writeFileSync ( filepath , JSON . stringify ( DEFAULT_WEB_CONFIG , null , 2 ) + '\n' ) ;
53
- console . log ( `Created SmartUI Web Config: ${ filepath } ` ) ;
52
+ fs . writeFileSync ( filepath , JSON . stringify ( DEFAULT_CONFIG , null , 2 ) + '\n' ) ;
53
+ console . log ( `Created SmartUI Config: ${ filepath } ` ) ;
54
54
} ;
55
55
56
56
export function createWebStaticConfig ( filepath : string ) {
@@ -65,7 +65,7 @@ export function createWebStaticConfig(filepath: string) {
65
65
// verify the file does not already exist
66
66
if ( fs . existsSync ( filepath ) ) {
67
67
console . log ( `Error: web-static config already exists: ${ filepath } ` ) ;
68
- console . log ( `To create a new file, please specify the file name like: 'smartui config:create-web links.json'` ) ;
68
+ console . log ( `To create a new file, please specify the file name like: 'smartui config:create-web-static links.json'` ) ;
69
69
return
70
70
}
71
71
0 commit comments