New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

viewar-cli

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

viewar-cli - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

6

commands/deploy.js

@@ -7,3 +7,3 @@ const chalk = require('chalk')

module.exports = ({fs, shell, zipDirectory, uploadBundle, readJson, request}) => async (appId, version) => {
module.exports = ({fs, shell, zipDirectory, readJson, request}) => async (appId, version) => {
const appRoot = process.cwd()

@@ -15,2 +15,3 @@ const buildDir = path.resolve(appRoot, 'build') + '/'

console.log(chalk`Bundling app...`)
shell.exec('npm run build', {silent: true})

@@ -20,3 +21,3 @@ await zipDirectory(buildDir, bundlePath)

const {id, token} = readJson(appInfoPath)
const timestamp = Date.now()
const timestamp = new Date().toISOString().replace(/:/g, '-').replace('T', '--').replace(/\..*$/, '')

@@ -38,2 +39,3 @@ console.log(chalk`Uploading app bundle...`)

console.log(chalk`Activating bundle...`)
const info = await request.post(getAppConfigUrl(appId, version)).then(JSON.parse)

@@ -40,0 +42,0 @@

@@ -6,3 +6,2 @@ const fs = require('fs')

const uploadBundle = require('../common/upload-bundle')({request})
const zipDirectory = require('../common/zip-dir')({fs, archiver})

@@ -12,3 +11,3 @@ const {readJson, updateJson, writeJson} = require('../common/json')

const activate = require('./activate')({request, readJson})
const deploy = require('./deploy')({fs, shell, zipDirectory, uploadBundle, readJson, request})
const deploy = require('./deploy')({fs, shell, zipDirectory, readJson, request})
const init = require('./init')({shell, updateJson, writeJson, fs})

@@ -15,0 +14,0 @@ const list = require('./list')({request, readJson})

const crypto = require('crypto')
const hash = crypto.createHash('md5')
const prompt = require('prompt')
const { cliConfigPath } = require('../common/constants')
const { getLoginUrl } = require('../common/urls')
const {cliConfigPath} = require('../common/constants')
const {getLoginUrl} = require('../common/urls')
module.exports = ({request, updateJson}) => async (username, password) => {
module.exports = ({request, updateJson}) => async () => {
const passwordHash = hash.update(password).digest('hex')
try {
const {username, password} = await (new Promise((resolve, reject) => {
prompt.start()
prompt.message = ''
prompt.delimiter = ':'
const response = await request.post(getLoginUrl(username, passwordHash)).then(JSON.parse)
prompt.get([{
name: 'username',
description: 'Username',
pattern: /.+@.+\..+/,
required: true,
}, {
name: 'password',
description: 'Password',
hidden: true,
}], function (error, result) {
if (!error) {
resolve(result)
} else {
reject(error)
}
})
}))
const {status, message, userId, token} = response
const passwordHash = hash.update(password).digest('hex')
if (status === 'ok') {
updateJson(cliConfigPath, (config) => {
config.users = config.users || {}
config.users[userId] = {
id: userId,
name: username,
token
}
const response = await request.post(getLoginUrl(username, passwordHash)).then(JSON.parse)
return config
})
console.log(`User ${username} logged in.`)
} else {
throw new Error(message)
const {status, message, userId, token} = response
if (status === 'ok') {
updateJson(cliConfigPath, (config) => {
config.users = config.users || {}
config.users[userId] = {
id: userId,
name: username,
token,
}
return config
})
console.log(`User ${username} logged in.`)
} else {
throw new Error(message)
}
} catch (error) {
}
}
#!/usr/bin/env node
const program = require('commander')
const shell = require('shelljs')

@@ -8,2 +9,6 @@ const currentVersion = require('./package.json').version

if (!shell.test('-f', '~/.viewar-cli')) {
shell.exec('echo "{}" > ~/.viewar-cli')
}
program.version(currentVersion)

@@ -17,3 +22,3 @@

program
.command('login <username> <password>')
.command('login')
.description('Logs in user')

@@ -20,0 +25,0 @@ .action(login)

{
"name": "viewar-cli",
"version": "0.2.0",
"version": "0.2.1",
"description": "ViewAR SDK Command Line Interface",

@@ -29,2 +29,3 @@ "main": "index.js",

"commander": "^2.13.0",
"prompt": "^1.0.0",
"request": "^2.83.0",

@@ -31,0 +32,0 @@ "request-promise": "^4.2.2",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc