@tizentv/wits
Advanced tools
Comparing version 2.5.2 to 2.5.3
@@ -0,0 +0,0 @@ const certificationHelper = require('../lib/certificationHelper.js'); |
@@ -0,0 +0,0 @@ const fs = require('fs'); |
@@ -0,0 +0,0 @@ const chalk = require('chalk'); |
@@ -0,0 +0,0 @@ const userInfoHelper = require('../lib/userInfoHelper.js'); |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ # WITs |
@@ -0,0 +0,0 @@ # WITs |
@@ -0,0 +0,0 @@ const util = require('./lib/util.js'); |
@@ -0,0 +0,0 @@ const path = require('path'); |
@@ -0,0 +0,0 @@ const inquirer = require('inquirer'); |
@@ -0,0 +0,0 @@ #!/usr/bin/env node |
@@ -0,0 +0,0 @@ const chalk = require('chalk'); |
@@ -0,0 +0,0 @@ const fs = require('fs'); |
@@ -0,0 +0,0 @@ const outputChannel = []; |
@@ -0,0 +0,0 @@ module.exports = { |
@@ -0,0 +0,0 @@ const inquirer = require('inquirer'); |
358
lib/util.js
@@ -16,204 +16,208 @@ const os = require('os'); | ||
module.exports = { | ||
WITS_BASE_PATH: __dirname, | ||
CURRENT_PROJECT_PATH: CURRENT_PROJECT_PATH, | ||
PROXY: '', | ||
RESOURCE_PATH: path.resolve(__dirname, '../', 'resource'), | ||
TOOLS_SDB_PATH: '', | ||
PLATFORM: platform, | ||
ISVERVOSE: false, | ||
initTools: async () => { | ||
module.exports.TOOLS_SDB_PATH = await tools.getSdbPath(); | ||
}, | ||
isIpAddress: ip => { | ||
return regExp.IP_ADDRESS.test(ip); | ||
}, | ||
WITS_BASE_PATH: __dirname, | ||
CURRENT_PROJECT_PATH: CURRENT_PROJECT_PATH, | ||
PROXY: '', | ||
RESOURCE_PATH: (() => { | ||
if (platform === 'win32') { | ||
return path.resolve(__dirname, '../', 'resource'); | ||
} else { | ||
return path.resolve(os.homedir(), '.wits', 'resource'); | ||
} | ||
})(), | ||
TOOLS_SDB_PATH: '', | ||
PLATFORM: platform, | ||
ISVERVOSE: false, | ||
initTools: async () => { | ||
module.exports.TOOLS_SDB_PATH = await tools.getSdbPath(); | ||
}, | ||
isIpAddress: ip => { | ||
return regExp.IP_ADDRESS.test(ip); | ||
}, | ||
isRemoteUrl: url => { | ||
return regExp.REMOTE_URI.test(url); | ||
}, | ||
isRemoteUrl: url => { | ||
return regExp.REMOTE_URI.test(url); | ||
}, | ||
isProxy: address => { | ||
return regExp.PROXY.test(address); | ||
}, | ||
isProxy: address => { | ||
return regExp.PROXY.test(address); | ||
}, | ||
getAbsolutePath: inputPath => { | ||
return path | ||
.join(CURRENT_PROJECT_PATH, inputPath) | ||
.replace(regExp.BACKSLASH, '/'); | ||
}, | ||
getAbsolutePath: inputPath => { | ||
return path | ||
.join(CURRENT_PROJECT_PATH, inputPath) | ||
.replace(regExp.BACKSLASH, '/'); | ||
}, | ||
createEmptyFile: (filepath, content) => { | ||
if (content === undefined) { | ||
content = ''; | ||
} | ||
try { | ||
fs.accessSync(path.join(filepath)); | ||
} catch (e) { | ||
try { | ||
fs.writeFileSync(path.join(filepath), content, 'utf8'); | ||
fs.chmodSync(path.join(filepath), '0775'); | ||
} catch (error) { | ||
logger.error( | ||
chalk.red(`Failed to createEmptyFile ${filepath} ${error}`) | ||
); | ||
process.exit(0); | ||
} | ||
} | ||
}, | ||
createEmptyFile: (filepath, content) => { | ||
if (content === undefined) { | ||
content = ''; | ||
} | ||
try { | ||
fs.accessSync(path.join(filepath)); | ||
} catch (e) { | ||
try { | ||
fs.writeFileSync(path.join(filepath), content, 'utf8'); | ||
fs.chmodSync(path.join(filepath), '0775'); | ||
} catch (error) { | ||
logger.error( | ||
chalk.red(`Failed to createEmptyFile ${filepath} ${error}`) | ||
); | ||
process.exit(0); | ||
} | ||
} | ||
}, | ||
createEmptyDirectory: dirname => { | ||
try { | ||
mkdirp.sync(dirname); | ||
} catch (error) { | ||
logger.error( | ||
chalk.red(`Failed to createEmptyDirectory ${dirname} ${error}`) | ||
); | ||
} | ||
}, | ||
createEmptyDirectory: dirname => { | ||
try { | ||
mkdirp.sync(dirname); | ||
} catch (error) { | ||
logger.error( | ||
chalk.red(`Failed to createEmptyDirectory ${dirname} ${error}`) | ||
); | ||
} | ||
}, | ||
removeFile: filepath => { | ||
if (fs.existsSync(filepath)) { | ||
try { | ||
fs.unlinkSync(filepath); | ||
} catch (e) { | ||
logger.error( | ||
chalk.red(`Failed to removeFile ${filepath} ${e}`) | ||
); | ||
throw e; | ||
} | ||
} | ||
}, | ||
removeFile: filepath => { | ||
if (fs.existsSync(filepath)) { | ||
try { | ||
fs.unlinkSync(filepath); | ||
} catch (e) { | ||
logger.error(chalk.red(`Failed to removeFile ${filepath} ${e}`)); | ||
throw e; | ||
} | ||
} | ||
}, | ||
moveFile: (src, dest) => { | ||
try { | ||
if (module.exports.isFileExist(src)) { | ||
module.exports.copyFile(src, dest); | ||
module.exports.removeFile(src); | ||
} | ||
} catch (e) { | ||
logger.error(chalk.red(`Failed to moveFile: ${e}`)); | ||
throw e; | ||
} | ||
}, | ||
moveFile: (src, dest) => { | ||
try { | ||
if (module.exports.isFileExist(src)) { | ||
module.exports.copyFile(src, dest); | ||
module.exports.removeFile(src); | ||
} | ||
} catch (e) { | ||
logger.error(chalk.red(`Failed to moveFile: ${e}`)); | ||
throw e; | ||
} | ||
}, | ||
copyFile: (src, dest) => { | ||
try { | ||
if (module.exports.isFileExist(src)) { | ||
fs.createReadStream(src).pipe(fs.createWriteStream(dest)); | ||
} | ||
} catch (e) { | ||
logger.error(chalk.red(`Failed to copyFile: ${e}`)); | ||
throw e; | ||
} | ||
}, | ||
copyFile: (src, dest) => { | ||
try { | ||
if (module.exports.isFileExist(src)) { | ||
fs.createReadStream(src).pipe(fs.createWriteStream(dest)); | ||
} | ||
} catch (e) { | ||
logger.error(chalk.red(`Failed to copyFile: ${e}`)); | ||
throw e; | ||
} | ||
}, | ||
setCurrentAppPath: path => { | ||
if (path !== '.') { | ||
module.exports.CURRENT_PROJECT_PATH = path; | ||
} | ||
}, | ||
setCurrentAppPath: path => { | ||
if (path !== '.') { | ||
module.exports.CURRENT_PROJECT_PATH = path; | ||
} | ||
}, | ||
isFileExist: filePath => { | ||
try { | ||
fs.accessSync(filePath); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
}, | ||
isFileExist: filePath => { | ||
try { | ||
fs.accessSync(filePath); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
}, | ||
isPropertyExist: (data, propertyName) => { | ||
if ( | ||
data !== null && | ||
typeof data === 'object' && | ||
data.hasOwnProperty(propertyName) | ||
) { | ||
return true; | ||
} | ||
return false; | ||
}, | ||
isPropertyExist: (data, propertyName) => { | ||
if ( | ||
data !== null && | ||
typeof data === 'object' && | ||
data.hasOwnProperty(propertyName) | ||
) { | ||
return true; | ||
} | ||
return false; | ||
}, | ||
clearComment: data => { | ||
return data.replace(regExp.COMMENT, ''); | ||
}, | ||
clearComment: data => { | ||
return data.replace(regExp.COMMENT, ''); | ||
}, | ||
displayOutput: logs => { | ||
if (module.exports.ISVERVOSE === true) { | ||
logger.log(logs); | ||
} | ||
}, | ||
getSocketPort: () => { | ||
const REMIND_SOCKET_PORT_LEN = 3; | ||
const MAX_DIGIT = 9; | ||
let port = Math.floor(Math.random() * MAX_DIGIT) + 1 + ''; | ||
for (let i = 0; i < REMIND_SOCKET_PORT_LEN; i++) { | ||
port += Math.floor(Math.random() * MAX_DIGIT) + ''; | ||
} | ||
return Number(port); | ||
}, | ||
displayOutput: logs => { | ||
if (module.exports.ISVERVOSE === true) { | ||
logger.log(logs); | ||
} | ||
}, | ||
getSocketPort: () => { | ||
const REMIND_SOCKET_PORT_LEN = 3; | ||
const MAX_DIGIT = 9; | ||
let port = Math.floor(Math.random() * MAX_DIGIT) + 1 + ''; | ||
for (let i = 0; i < REMIND_SOCKET_PORT_LEN; i++) { | ||
port += Math.floor(Math.random() * MAX_DIGIT) + ''; | ||
} | ||
return Number(port); | ||
}, | ||
getValidHostIp: (cInfo, answer) => { | ||
let hostIp = ip.address(); | ||
if (module.exports.isPropertyExist(cInfo, 'hostIp')) { | ||
hostIp = cInfo.hostIp; | ||
} | ||
if (module.exports.isPropertyExist(answer, 'hostIp')) { | ||
hostIp = answer.hostIp; | ||
} | ||
return hostIp; | ||
}, | ||
getValidHostIp: (cInfo, answer) => { | ||
let hostIp = ip.address(); | ||
if (module.exports.isPropertyExist(cInfo, 'hostIp')) { | ||
hostIp = cInfo.hostIp; | ||
} | ||
if (module.exports.isPropertyExist(answer, 'hostIp')) { | ||
hostIp = answer.hostIp; | ||
} | ||
return hostIp; | ||
}, | ||
getHostIpAddresses: () => { | ||
const networkInterfaces = os.networkInterfaces(); | ||
const ipAddresses = []; | ||
getHostIpAddresses: () => { | ||
const networkInterfaces = os.networkInterfaces(); | ||
const ipAddresses = []; | ||
for (var eth in networkInterfaces) { | ||
var interfaces = networkInterfaces[eth]; | ||
for (var i = 0; i < interfaces.length; i++) { | ||
var network = interfaces[i]; | ||
if (isIpv4Address(network)) { | ||
ipAddresses.push(network.address); | ||
} | ||
} | ||
for (var eth in networkInterfaces) { | ||
var interfaces = networkInterfaces[eth]; | ||
for (var i = 0; i < interfaces.length; i++) { | ||
var network = interfaces[i]; | ||
if (isIpv4Address(network)) { | ||
ipAddresses.push(network.address); | ||
} | ||
return ipAddresses; | ||
}, | ||
} | ||
} | ||
return ipAddresses; | ||
}, | ||
displayBanner() { | ||
logger.log(' _ ____________ '); | ||
logger.log('| | /| / / _/_ __/__'); | ||
logger.log('| |/ |/ // / / / (_-<'); | ||
logger.log('|__/|__/___/ /_/ /___/\n'); | ||
}, | ||
displayBanner() { | ||
logger.log(' _ ____________ '); | ||
logger.log('| | /| / / _/_ __/__'); | ||
logger.log('| |/ |/ // / / / (_-<'); | ||
logger.log('|__/|__/___/ /_/ /___/\n'); | ||
}, | ||
chmodAll(path) { | ||
try { | ||
fs.accessSync(path, fs.constants.S_IXUSR); | ||
} catch (e) { | ||
fs.chmodSync(path, fs.constants.S_IRWXU | fs.constants.S_IRWXG); | ||
} | ||
}, | ||
chmodAll(path) { | ||
try { | ||
fs.accessSync(path, fs.constants.S_IXUSR); | ||
} catch (e) { | ||
fs.chmodSync(path, fs.constants.S_IRWXU | fs.constants.S_IRWXG); | ||
} | ||
}, | ||
exit: () => { | ||
process.exit(0); | ||
}, | ||
exit: () => { | ||
process.exit(0); | ||
}, | ||
parseDeviceIp: option => { | ||
if (typeof option !== 'string') { | ||
return null; | ||
} | ||
const deviceIp = option.split('deviceIp=')[1]; | ||
if (module.exports.isIpAddress(deviceIp)) { | ||
return deviceIp; | ||
} | ||
return null; | ||
parseDeviceIp: option => { | ||
if (typeof option !== 'string') { | ||
return null; | ||
} | ||
const deviceIp = option.split('deviceIp=')[1]; | ||
if (module.exports.isIpAddress(deviceIp)) { | ||
return deviceIp; | ||
} | ||
return null; | ||
} | ||
}; | ||
function isIpv4Address(eth) { | ||
if (eth.family === 'IPv4' && eth.address !== '127.0.0.1' && !eth.internal) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
if (eth.family === 'IPv4' && eth.address !== '127.0.0.1' && !eth.internal) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} |
@@ -0,0 +0,0 @@ const fs = require('fs'); |
@@ -0,0 +0,0 @@ var fsWrappingAPIList = [ |
{ | ||
"name": "@tizentv/wits", | ||
"version": "2.5.2", | ||
"version": "2.5.3", | ||
"description": "Instant live reload tool for Tizen Web Application development", | ||
@@ -17,3 +17,3 @@ "main": "index.js", | ||
"@tizentv/tools": "^1.1.3", | ||
"@tizentv/webide-common-tizentv": "^1.0.12", | ||
"@tizentv/webide-common-tizentv": "^1.0.13", | ||
"chalk": "^4.1.0", | ||
@@ -20,0 +20,0 @@ "chrome-launcher": "^0.13.2", |
@@ -133,3 +133,3 @@ # WITs | ||
For conneting to TV, using Live Reload | ||
For connecting to TV, using Live Reload | ||
After connecting, every time you make changes on `your tizen app project`, It is reflected to TV device instantly. | ||
@@ -136,0 +136,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
552061
13363
5
+ Added@types/node@20.12.8(transitive)
- Removed@types/node@20.12.7(transitive)