11import path from 'path'
22import fs from 'fs'
3- import { WebConfigSchema , WebStaticConfigSchema } from '../types.js'
3+ import { Config , WebStaticConfig } from '../types.js'
44
5- export const DEFAULT_WEB_STATIC_CONFIG : WebStaticConfigSchema = [
5+ export const DEFAULT_WEB_STATIC_CONFIG : WebStaticConfig = [
66 {
77 "name" : "lambdatest-home-page" ,
88 "url" : "https://www.lambdatest.com" ,
@@ -14,7 +14,7 @@ export const DEFAULT_WEB_STATIC_CONFIG: WebStaticConfigSchema = [
1414 }
1515]
1616
17- export const DEFAULT_WEB_CONFIG : WebConfigSchema = {
17+ export const DEFAULT_CONFIG : Config = {
1818 web : {
1919 browsers : [
2020 'chrome' ,
@@ -27,13 +27,13 @@ export const DEFAULT_WEB_CONFIG: WebConfigSchema = {
2727 [ 1366 , 768 ] ,
2828 [ 360 , 640 ] ,
2929 ] ,
30- waitForTimeout : 0 ,
30+ waitForTimeout : 1000 ,
3131 }
3232} ;
3333
34- export function createWebConfig ( filepath : string ) {
34+ export function createConfig ( filepath : string ) {
3535 // default filepath
36- filepath = filepath || 'smartui-web .json' ;
36+ filepath = filepath || '. smartui.json' ;
3737 let filetype = path . extname ( filepath ) ;
3838 if ( filetype != '.json' ) {
3939 console . log ( 'Error: Config file must have .json extension' ) ;
@@ -42,15 +42,15 @@ export function createWebConfig(filepath: string) {
4242
4343 // verify the file does not already exist
4444 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'` ) ;
4747 return
4848 }
4949
5050 // write stringified default config options to the filepath
5151 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 } ` ) ;
5454} ;
5555
5656export function createWebStaticConfig ( filepath : string ) {
@@ -65,7 +65,7 @@ export function createWebStaticConfig(filepath: string) {
6565 // verify the file does not already exist
6666 if ( fs . existsSync ( filepath ) ) {
6767 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'` ) ;
6969 return
7070 }
7171
0 commit comments