-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathindex.js
93 lines (82 loc) · 2.39 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
const util = require('./lib/util.js');
const userInfoHelper = require('./lib/userInfoHelper.js');
const {
setOutputChannel,
unsetOutputChannel,
logger
} = require('./lib/logger');
const setWitsconfigInfo = async data => {
try {
const initCommand = require('./command/init.js');
logger.log('WITs::setWitsconfigInfo');
if (data.hasOwnProperty('baseAppPath')) {
util.CURRENT_PROJECT_PATH = userInfoHelper.getBaseAppPath(
data.baseAppPath
);
}
if (data.hasOwnProperty('profilePath')) {
if (!(await initCommand.isVaildProfile(data.profilePath))) {
throw new Error(
'There is invalid profile. Please create a profile or active the profile.'
);
}
}
await initCommand.prepareConfigure();
await userInfoHelper.updateLatestUserAnswer(data);
return;
/**
{
width: '1920',
deviceIp: '192.168.250.250',
hostIp: '192.168.250.250',
baseAppPath: 'E:/dev/workspace/test',
isDebugMode: false,
profilePath: 'C:/tizen-studio-data/profile/profiles.xml',
}
*/
} catch (error) {
logger.log(`setWitsconfigInfo:::${error}`);
}
};
const start = async () => {
try {
if (!userInfoHelper.WITS_USER_DATA) {
throw new Error('There is invalid WITS_USER_DATA');
}
const startCommand = require('./command/start.js');
logger.log('WITs::start');
await startCommand.run();
return;
} catch (error) {
logger.log(`start:::${error}`);
}
};
const watch = async () => {
try {
if (!userInfoHelper.WITS_USER_DATA) {
throw new Error('There is invalid WITS_USER_DATA');
}
const watchCommand = require('./command/watch.js');
logger.log('WITs::watch');
await watchCommand.run();
return;
} catch (error) {
logger.log(`watch:::${error}`);
}
};
const disconnect = () => {
const watchHelper = require('./lib/watchHelper.js');
try {
watchHelper.closeSocketServer();
} catch (error) {
logger.log(`disconnect:::${error}`);
}
};
module.exports = {
setWitsconfigInfo,
start,
watch,
disconnect,
setOutputChannel,
unsetOutputChannel
};