@chuva.io/less-cli
Advanced tools
Comparing version 1.0.0-beta.13 to 1.0.0-beta.14
@@ -12,2 +12,4 @@ #!/usr/bin/env node | ||
import create_account from '../commands/user/create_account.js'; | ||
import create_session from '../commands/user/create_session.js'; | ||
import { verify_auth_token } from '../commands/helpers/credentials.js'; | ||
@@ -20,3 +22,3 @@ const program = new Command(); | ||
.description('CLI to interact with Less') | ||
.version('1.0.0-beta.13') | ||
.version('1.0.0-beta.14') | ||
.usage('[COMMAND]'); | ||
@@ -28,7 +30,4 @@ | ||
.option('--static', 'Deploy your less static websites') | ||
.action((project_name, options) => { | ||
if (!process.env.LESS_TOKEN) { | ||
console.log(chalk.redBright('Error:'), 'Environment variable LESS_TOKEN must be defined'); | ||
process.exit(1); | ||
} | ||
.action(async (project_name, options) => { | ||
verify_auth_token(); | ||
@@ -61,2 +60,9 @@ if (!/^[a-z][-a-z0-9]*$/.test(project_name)) { | ||
program | ||
.command('login') | ||
.description('Log in with email and password.') | ||
.option('-u, --user <email>', 'User email address') | ||
.option('-p, --password <password>', 'User password', '*') | ||
.action(create_session); | ||
const template = program | ||
@@ -63,0 +69,0 @@ .command('template') |
@@ -11,2 +11,5 @@ import AdmZip from 'adm-zip'; | ||
import { get_less_token } from '../helpers/credentials.js'; | ||
const spinner = ora({ text: '' }); | ||
@@ -87,4 +90,6 @@ | ||
const LESS_TOKEN = await get_less_token(); | ||
const headers = { | ||
Authorization: `Bearer ${process.env.LESS_TOKEN}`, | ||
Authorization: `Bearer ${LESS_TOKEN}`, | ||
'connection_id': connectionId, | ||
@@ -91,0 +96,0 @@ ...formData.getHeaders(), |
@@ -12,2 +12,4 @@ import AdmZip from 'adm-zip'; | ||
import { get_less_token } from '../helpers/credentials.js'; | ||
const spinner = ora({ text: '' }); | ||
@@ -35,3 +37,3 @@ | ||
if (value === undefined) { | ||
console.error(chalk.redBright(`Environment variable '${key}' must be defined`)); | ||
console.error(chalk.redBright(`\nEnvironment variable '${key}' must be defined`)); | ||
process.exit(1); | ||
@@ -123,4 +125,6 @@ } | ||
const LESS_TOKEN = await get_less_token(); | ||
const headers = { | ||
Authorization: `Bearer ${process.env.LESS_TOKEN}`, | ||
Authorization: `Bearer ${LESS_TOKEN}`, | ||
'connection_id': connectionId, | ||
@@ -137,3 +141,3 @@ ...formData.getHeaders(), | ||
spinner.stop(); | ||
console.error(chalk.redBright('Error:'), error?.response?.data || 'Deployment failed'); | ||
console.error(chalk.redBright('Error:'), error?.response?.data?.error || 'Deployment failed'); | ||
socket.close(); | ||
@@ -140,0 +144,0 @@ process.exit(1); // Non-success exit code for failure |
import axios from 'axios'; | ||
import chalk from 'chalk'; | ||
import config from '../../utils/config.js'; | ||
import { verify_auth_token, get_less_token } from '../helpers/credentials.js'; | ||
export default async function get_all() { | ||
if (!process.env.LESS_TOKEN) { | ||
console.log(chalk.redBright('Error:'), 'Environment variable LESS_TOKEN must be defined'); | ||
process.exit(1); | ||
} | ||
await verify_auth_token(); | ||
@@ -14,4 +12,5 @@ const serverUrl = `${config.SERVER_URL}/v1/projects`; | ||
try { | ||
const LESS_TOKEN = await get_less_token(); | ||
const headers = { | ||
Authorization: `Bearer ${process.env.LESS_TOKEN}` | ||
Authorization: `Bearer ${LESS_TOKEN}` | ||
}; | ||
@@ -32,5 +31,5 @@ | ||
} catch (error) { | ||
console.error(chalk.redBright('Error:'), error?.response?.data || 'Get projects failed'); | ||
console.error(chalk.redBright('Error:'), error?.response?.data?.error || 'Get projects failed'); | ||
process.exit(1); | ||
} | ||
} |
import axios from 'axios'; | ||
import chalk from 'chalk'; | ||
import config from '../../utils/config.js'; | ||
import { verify_auth_token, get_less_token } from '../helpers/credentials.js'; | ||
@@ -11,6 +12,3 @@ export default async function get_by_id(project_name) { | ||
if (!process.env.LESS_TOKEN) { | ||
console.log(chalk.redBright('Error:'), 'Environment variable LESS_TOKEN must be defined'); | ||
process.exit(1); | ||
} | ||
await verify_auth_token(); | ||
@@ -20,4 +18,5 @@ const serverUrl = `${config.SERVER_URL}/v1/projects/${project_name}`; | ||
try { | ||
const LESS_TOKEN = await get_less_token(); | ||
const headers = { | ||
Authorization: `Bearer ${process.env.LESS_TOKEN}` | ||
Authorization: `Bearer ${LESS_TOKEN}` | ||
}; | ||
@@ -44,5 +43,5 @@ | ||
} catch (error) { | ||
console.error(chalk.redBright('Error:'), error?.response?.data || 'Get projects failed'); | ||
console.error(chalk.redBright('Error:'), error?.response?.data?.error || 'Get projects failed'); | ||
process.exit(1); | ||
} | ||
} |
{ | ||
"name": "@chuva.io/less-cli", | ||
"version": "1.0.0-beta.13", | ||
"version": "1.0.0-beta.14", | ||
"description": "`less-cli` is a CLI tool that allows you to deploy your Less projects to AWS while providing several other tools to facilitate your interaction with Less.", | ||
@@ -5,0 +5,0 @@ "author": "Chuva, LLC", |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
41126
19
761
10