@tizentv/wits
Advanced tools
Comparing version 2.4.8 to 2.5.0
@@ -77,3 +77,3 @@ const fs = require('fs'); | ||
} catch (error) { | ||
logger.error(chalk.red(`Failed to makeWitsignoreFile ${error}`)); | ||
logger.log(`[Warning] Failed to makeWitsignoreFile ${error}`); | ||
} | ||
@@ -91,3 +91,3 @@ } | ||
} catch (error) { | ||
logger.error(chalk.red(`Failed to makeWitsconfigFile ${error}`)); | ||
logger.log(`[Warning] Failed to makeWitsconfigFile ${error}`); | ||
} | ||
@@ -94,0 +94,0 @@ } |
@@ -79,2 +79,5 @@ const chalk = require('chalk'); | ||
data.deviceIp = optionDeviceIp; | ||
logger.log( | ||
chalk.cyanBright(`WITs tries connecting with ${optionDeviceIp}\n`) | ||
); | ||
await userInfoHelper.updateLatestUserAnswer({ | ||
@@ -81,0 +84,0 @@ deviceIp: optionDeviceIp |
@@ -62,2 +62,5 @@ const userInfoHelper = require('../lib/userInfoHelper.js'); | ||
data.deviceIp = optionDeviceIp; | ||
logger.log( | ||
chalk.cyanBright(`WITs tries connecting with ${optionDeviceIp}\n`) | ||
); | ||
await userInfoHelper.updateLatestUserAnswer({ | ||
@@ -64,0 +67,0 @@ deviceIp: optionDeviceIp |
@@ -35,3 +35,2 @@ /* | ||
var DISCONNECTED = 'Disconnected'; | ||
var HOST_BASE_CONTENT_PATH = '{{HOST_BASE_CONTENT_PATH}}'; | ||
@@ -205,4 +204,3 @@ window.onload = function () { | ||
socket.emit('watch_request', { | ||
destPath: CONTENT_PATH, | ||
basePath: HOST_BASE_CONTENT_PATH | ||
destPath: CONTENT_PATH | ||
}); | ||
@@ -209,0 +207,0 @@ } |
@@ -25,6 +25,15 @@ const path = require('path'); | ||
execSync(WGT_FILE_PUSH_COMMAND, { silent: true }); | ||
const result = execSync(APP_INSTALL_COMMAND).toString(); | ||
const pushResult = execSync(WGT_FILE_PUSH_COMMAND, { | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
}); | ||
util.displayOutput(pushResult); | ||
if (result.includes('failed[')) { | ||
const installResult = execSync(APP_INSTALL_COMMAND, { | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
}); | ||
util.displayOutput(installResult); | ||
if (installResult.includes('failed[')) { | ||
logger.error(chalk.red(`\nFailed to install Wits`)); | ||
@@ -37,4 +46,6 @@ util.exit(); | ||
const result = execSync(APP_UNINSTALL_COMMAND, { | ||
silent: true | ||
}).toString(); | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
}); | ||
util.displayOutput(result); | ||
@@ -48,3 +59,8 @@ if (result.includes('failed[')) { | ||
const result = execSync(APP_LAUNCH_COMMAND).toString(); | ||
const result = execSync(APP_LAUNCH_COMMAND, { | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
}); | ||
util.displayOutput(result); | ||
if (result === null || result.includes('failed[')) { | ||
@@ -61,4 +77,12 @@ throw new Error( | ||
const result = | ||
execSync(APP_LAUNCH_DEBUG_MODE_COMMAND).toString() || | ||
execSync(APP_LAUNCH_DEBUG_MODE_COMMAND_TIMEOUT).toString(); | ||
execSync(APP_LAUNCH_DEBUG_MODE_COMMAND, { | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
}) || | ||
execSync(APP_LAUNCH_DEBUG_MODE_COMMAND_TIMEOUT, { | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
}); | ||
util.displayOutput(result); | ||
if (result === null || result.includes('failed')) { | ||
@@ -92,3 +116,7 @@ throw new Error( | ||
const APP_TERMINATE_COMMAND = `${util.TOOLS_SDB_PATH} -s ${deviceName} shell 0 was_kill ${hostAppId}`; | ||
execSync(APP_TERMINATE_COMMAND, { silent: true }); | ||
const result = execSync(APP_TERMINATE_COMMAND, { | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
}); | ||
util.displayOutput(result); | ||
} | ||
@@ -99,8 +127,19 @@ }; | ||
const LOCAL_HOST = '127.0.0.1'; | ||
execSync( | ||
`${util.TOOLS_SDB_PATH} -s ${deviceName} forward --remove tcp:${port}` | ||
const removeResult = execSync( | ||
`${util.TOOLS_SDB_PATH} -s ${deviceName} forward --remove tcp:${port}`, | ||
{ | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
} | ||
); | ||
execSync( | ||
`${util.TOOLS_SDB_PATH} -s ${deviceName} forward tcp:${port} tcp:${port}` | ||
util.displayOutput(removeResult); | ||
const tcpResult = execSync( | ||
`${util.TOOLS_SDB_PATH} -s ${deviceName} forward tcp:${port} tcp:${port}`, | ||
{ | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
} | ||
); | ||
util.displayOutput(tcpResult); | ||
try { | ||
@@ -107,0 +146,0 @@ launchChrome(LOCAL_HOST + ':' + port); |
@@ -67,2 +67,6 @@ const inquirer = require('inquirer'); | ||
async function getTizenCertificationData() { | ||
const privilegeInfo = []; | ||
privilegeInfo.push(getPrivilegeLevel()); | ||
const privilegeAnswer = await inquirer.prompt(privilegeInfo); | ||
const profileInfo = []; | ||
@@ -90,11 +94,7 @@ profileInfo.push(getProfileName()); | ||
const privilegeInfo = []; | ||
privilegeInfo.push(getPrivilegeLevel()); | ||
const privilegeAnswer = await inquirer.prompt(privilegeInfo); | ||
return Object.assign( | ||
privilegeAnswer, | ||
profileAnswer, | ||
authorAnswer, | ||
detailAnswer, | ||
privilegeAnswer | ||
detailAnswer | ||
); | ||
@@ -240,5 +240,6 @@ } | ||
message: 'Select privilege Level : ', | ||
choices: [PRIVILEGE_LEVEL.public, PRIVILEGE_LEVEL.partner], | ||
default: PRIVILEGE_LEVEL.partner | ||
// choices: [PRIVILEGE_LEVEL.public, PRIVILEGE_LEVEL.partner], | ||
choices: [PRIVILEGE_LEVEL.public], | ||
default: PRIVILEGE_LEVEL.public | ||
}; | ||
} |
@@ -6,2 +6,3 @@ #!/usr/bin/env node | ||
const package = require('../package.json'); | ||
const { logger } = require('./logger'); | ||
@@ -19,18 +20,20 @@ const util = require('./util.js'); | ||
program.version(`wits v${package.version}`); | ||
program.option('-i, --init', 'Set configuration for running WITs'); | ||
program.version(`wits v${package.version}`, '-v, --version', 'WITs version'); | ||
program.allowUnknownOption(); | ||
program.option('-i, --init', 'Set configuration for running WITs.'); | ||
program.option( | ||
'-c, --certificate', | ||
'Generate a certification for signing Tizen web app' | ||
'Generate a certification for signing Tizen web app. You can set a log level for debugging. ex) wits -c --verbose' | ||
); | ||
program.option( | ||
'-s, --start [deviceIp]', | ||
'Install, launch app and enable live reload feature in a sequence.' | ||
'Install, launch app and enable live reload feature in a sequence. ex) wits -s / wits -s deviceIp=192.168.250.250 / wits -s --verbose' | ||
); | ||
program.option( | ||
'-w, --watch [deviceIp]', | ||
'Launch app and enable live reload feature without reinstalling.' | ||
'Launch app and enable live reload feature without reinstalling. ex) wits -w / wits -w deviceIp=192.168.250.250 / wits -w --verbose' | ||
); | ||
program.parse(process.argv); | ||
util.ISVERVOSE = checkVerbose(process.argv); | ||
@@ -42,3 +45,3 @@ if (program.init) { | ||
const certificateCommand = require('../command/certificate.js'); | ||
certificateCommand.run(); | ||
certificateCommand.run(program.certificate); | ||
} else if (program.start) { | ||
@@ -53,1 +56,14 @@ const startCommand = require('../command/start.js'); | ||
} | ||
function checkVerbose(arguments) { | ||
const last = arguments.length - 1; | ||
if (arguments.includes('--verbose')) { | ||
if (arguments[last] !== '--verbose') { | ||
logger.log( | ||
`[Warning] Please check the options' order. "--verbose" should be at the end of command.` | ||
); | ||
} | ||
return true; | ||
} | ||
return false; | ||
} |
@@ -31,3 +31,7 @@ const chalk = require('chalk'); | ||
const CONNECT_TV_COMMAND = `${util.TOOLS_SDB_PATH} connect ${deviceIpAddress}:${TV_CONNECT_PORT}`; | ||
const connectResult = execSync(CONNECT_TV_COMMAND).toString(); | ||
const connectResult = execSync(CONNECT_TV_COMMAND, { | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
}); | ||
util.displayOutput(connectResult); | ||
@@ -71,7 +75,7 @@ if (connectResult.includes('connected')) { | ||
`${util.TOOLS_SDB_PATH} -s ${deviceName} capability`, | ||
{ silent: true } | ||
) | ||
.toString() | ||
.split('\n'); | ||
{ encoding: 'utf-8', stdio: 'pipe' } | ||
).split('\n'); | ||
capability.forEach(value => { | ||
util.displayOutput(value); | ||
if (value.indexOf('sdk_toolpath') !== -1) { | ||
@@ -88,4 +92,7 @@ appInstallPath = | ||
const devices = execSync(`${util.TOOLS_SDB_PATH} devices`, { | ||
silent: true | ||
}).toString(); | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
}); | ||
util.displayOutput(devices); | ||
let devicesInfo = []; | ||
@@ -92,0 +99,0 @@ let deviceNameList = []; |
@@ -22,2 +22,3 @@ const os = require('os'); | ||
PLATFORM: platform, | ||
ISVERVOSE: false, | ||
initTools: async () => { | ||
@@ -139,2 +140,7 @@ module.exports.TOOLS_SDB_PATH = await tools.getSdbPath(); | ||
displayOutput: logs => { | ||
if (module.exports.ISVERVOSE === true) { | ||
logger.log(logs); | ||
} | ||
}, | ||
getSocketPort: () => { | ||
@@ -141,0 +147,0 @@ const REMIND_SOCKET_PORT_LEN = 3; |
@@ -67,3 +67,3 @@ const fs = require('fs'); | ||
logger.log(`socket on::::watch_request`); | ||
watchAppCode(path.basePath, path.destPath); | ||
watchAppCode(data.baseAppPath, path.destPath); | ||
}); | ||
@@ -168,4 +168,7 @@ }); | ||
async: true, | ||
silent: true | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
}); | ||
// util.displayOutput(pushResult); | ||
pushResult.stderr.on('data', data => { | ||
@@ -230,15 +233,21 @@ const COMPATIBILITY_ERROR = 'version compatibility problems'; | ||
const UPDATE_FILE_PUSH_COMMAND = `${util.TOOLS_SDB_PATH} -s ${deviceName} push "${fileFullPath}" "${destPath}${filePath}"`; | ||
exec(UPDATE_FILE_PUSH_COMMAND, (code, stdout, stderr) => { | ||
if (stderr) { | ||
const COMPATIBILITY_ERROR = 'version compatibility problems'; | ||
if (!stderr.includes(COMPATIBILITY_ERROR)) { | ||
logger.log(`Failed ${stderr}`); | ||
util.exit(); | ||
const result = exec( | ||
UPDATE_FILE_PUSH_COMMAND, | ||
{ encoding: 'utf-8', stdio: 'pipe' }, | ||
(code, stdout, stderr) => { | ||
if (stderr) { | ||
const COMPATIBILITY_ERROR = 'version compatibility problems'; | ||
if (!stderr.includes(COMPATIBILITY_ERROR)) { | ||
logger.log(`Failed ${stderr}`); | ||
util.exit(); | ||
} | ||
} | ||
logger.log(`Program output : ${stdout}`); | ||
if (stdout.includes('file(s) pushed')) { | ||
mediator.emit('changed'); | ||
} | ||
} | ||
logger.log(`Program output : ${stdout}`); | ||
if (stdout.includes('file(s) pushed')) { | ||
mediator.emit('changed'); | ||
} | ||
}); | ||
); | ||
// util.displayOutput(result); | ||
} | ||
@@ -275,6 +284,8 @@ | ||
const WRAPPER_FILE_PUSH_COMMAND = `${util.TOOLS_SDB_PATH} -s ${deviceName} push "${WRAPPER_FILE_PATH}" "${hostAppPath}/${WRAPPER_FILE}"`; | ||
exec(WRAPPER_FILE_PUSH_COMMAND, { | ||
const result = exec(WRAPPER_FILE_PUSH_COMMAND, { | ||
async: true, | ||
silent: true | ||
encoding: 'utf-8', | ||
stdio: 'pipe' | ||
}); | ||
// util.displayOutput(result); | ||
} | ||
@@ -281,0 +292,0 @@ |
{ | ||
"name": "@tizentv/wits", | ||
"version": "2.4.8", | ||
"version": "2.5.0", | ||
"description": "Instant live reload tool for Tizen Web Application development", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -78,3 +78,3 @@ # WITs | ||
Install the latest version of [Atom](https://atom.io/). | ||
And download the package "atom-tizentv" | ||
And download the package "atom-tizentv-2" | ||
@@ -119,2 +119,13 @@ `Using WITs` | ||
```sh | ||
# Run wits --start | ||
$ wits -s | ||
# Run wits --start with deviceIp. Available to switch the device Ip easily. | ||
$ wits -s deviceIp=192.168.250.250 | ||
# Run wits --start with deviceIp. Available to switch the device Ip easily. For debugging, add --verbose option. It should be at the end of command. | ||
$ wits -s deviceIp=192.168.250.250 --verbose | ||
``` | ||
![witss](https://user-images.githubusercontent.com/1733182/77503927-420b1000-6ea2-11ea-88f5-49ab0c5fc227.gif) | ||
@@ -127,2 +138,13 @@ | ||
```sh | ||
# Run wits --watch | ||
$ wits -w | ||
# Run wits --watch with deviceIp. Available to switch the device Ip easily. | ||
$ wits -w deviceIp=192.168.250.250 | ||
# Run wits --watch with deviceIp. Available to switch the device Ip easily. For debugging, add --verbose option. It should be at the end of command. | ||
$ wits -w deviceIp=192.168.250.250 --verbose | ||
``` | ||
![witsw](https://user-images.githubusercontent.com/1733182/77503928-43d4d380-6ea2-11ea-8ece-4f5182cb7d6d.gif) | ||
@@ -129,0 +151,0 @@ |
412582
9141
203