Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cyklang/cli

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cyklang/cli - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

21

build/AssetCommand.js

@@ -45,3 +45,3 @@ "use strict";

this.addCommand(new AssetList('l', '(l)ist assets'));
this.addCommand(new AssetUpload('upload', 'upload assets from current directory'));
this.addCommand(new AssetUpload('upload', 'upload assets from sources'));
this.addCommand(new AssetUpload('u', '(u)pload assets'));

@@ -79,2 +79,3 @@ }

this.description(description)
.option('-a --auth <auth_schema>', 'authentication schema : basic | token | any, default is no authentication')
.option('-d --dest <destination>', 'destination path, directory name')

@@ -105,2 +106,7 @@ .option('-c --clean', 'clean destination path before uploading')

throw 'no source to upload';
if (options.auth && ' basic | token | any '.indexOf(options.auth) === -1) {
throw 'valid authentication schemas are : basic | token | any';
}
logger.debug('options : ', options);
logger.debug('auth : ' + options.auth);
let dest = "/";

@@ -127,3 +133,3 @@ if (options.dest !== undefined)

logger.debug('upload file ' + source + ' to ' + dest + base);
await this.uploadAsset({ path: source, mtime: filestat.mtime }, dest + base);
await this.uploadAsset({ path: source, mtime: filestat.mtime }, dest + base, options.auth);
}

@@ -176,3 +182,3 @@ }

if (uploadConfirmed === true) {
await this.uploadFiles(dirName, uploadList, dest);
await this.uploadFiles(dirName, uploadList, dest, options.auth);
}

@@ -277,3 +283,3 @@ // const rl = readline.createInterface(process.stdin, process.stdout)

//----------------------------------------------------------------------------------------------
async uploadFiles(dirName, uploadList, dest) {
async uploadFiles(dirName, uploadList, dest, auth) {
for (let ind = 0; ind < uploadList.length; ind++) {

@@ -283,3 +289,3 @@ const upload = uploadList[ind];

logger.debug('upload ' + upload.path + ' to ' + route);
await this.uploadAsset(upload, route);
await this.uploadAsset(upload, route, auth);
}

@@ -290,4 +296,4 @@ }

//----------------------------------------------------------------------------------------------
async uploadAsset(upload, route) {
logger.debug('uploadAsset ' + upload.path + ' to route ' + route + ' with mimetype ' + this.mimetypeLookup(upload.path));
async uploadAsset(upload, route, auth) {
logger.debug('uploadAsset ' + upload.path + ' to route ' + route + ' with mimetype ' + this.mimetypeLookup(upload.path) + ', auth : ' + auth);
try {

@@ -303,2 +309,3 @@ let dbAsset = await this.dbManager?.dbAssetExist(route);

dbAsset.route = route;
dbAsset.auth = auth;
// const fstat = fs.statSync(fileName)

@@ -305,0 +312,0 @@ dbAsset.last_update = upload.mtime;

@@ -19,3 +19,4 @@ #!/usr/bin/env ts-node

this.description('manage users in cyk_user table').version('0.1');
this.addCommand(new UserAddCmd());
this.addCommand(new UserAddCmd('add', 'add a new user'));
this.addCommand(new UserAddCmd('a', 'add a new user'));
this.addCommand(new UserUpdateCmd('update', 'update user by id all fields except password'));

@@ -31,5 +32,5 @@ this.addCommand(new UserUpdateCmd('u', 'shortcut for (u)pdate'));

class UserAddCmd extends Cmd_1.Cmd {
constructor() {
super('add');
this.description('add a new user')
constructor(name, description) {
super(name);
this.description(description)
.requiredOption('-n --name <name>', 'user name')

@@ -36,0 +37,0 @@ .option('-e --email <email>', 'user email address')

{
"name": "@cyklang/cli",
"version": "0.3.0",
"version": "0.3.1",
"description": "cyklang CLI",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -22,3 +22,3 @@ import { Command } from "commander"

this.addCommand(new AssetList('l', '(l)ist assets'))
this.addCommand(new AssetUpload('upload', 'upload assets from current directory'))
this.addCommand(new AssetUpload('upload', 'upload assets from sources'))
this.addCommand(new AssetUpload('u', '(u)pload assets'))

@@ -65,2 +65,3 @@ }

this.description(description)
.option('-a --auth <auth_schema>', 'authentication schema : basic | token | any, default is no authentication')
.option('-d --dest <destination>', 'destination path, directory name')

@@ -94,2 +95,8 @@ .option('-c --clean', 'clean destination path before uploading')

if ( options.auth && ' basic | token | any '.indexOf(options.auth) === -1 ) {
throw 'valid authentication schemas are : basic | token | any'
}
logger.debug('options : ', options)
logger.debug('auth : ' + options.auth)
let dest = "/"

@@ -114,3 +121,3 @@ if (options.dest !== undefined) dest = options.dest

logger.debug('upload file ' + source + ' to ' + dest + base)
await this.uploadAsset({ path: source, mtime: filestat.mtime }, dest + base)
await this.uploadAsset({ path: source, mtime: filestat.mtime }, dest + base, options.auth)
}

@@ -175,3 +182,3 @@ }

if (uploadConfirmed === true) {
await this.uploadFiles(dirName, uploadList, dest)
await this.uploadFiles(dirName, uploadList, dest, options.auth)
}

@@ -289,3 +296,3 @@

async uploadFiles(dirName: string, uploadList: FileDescriptor[], dest: string) {
async uploadFiles(dirName: string, uploadList: FileDescriptor[], dest: string, auth: string | undefined) {
for (let ind = 0; ind < uploadList.length; ind++) {

@@ -295,3 +302,3 @@ const upload = uploadList[ind]

logger.debug('upload ' + upload.path + ' to ' + route)
await this.uploadAsset(upload, route)
await this.uploadAsset(upload, route, auth)
}

@@ -304,4 +311,4 @@ }

async uploadAsset(upload: FileDescriptor, route: string) {
logger.debug('uploadAsset ' + upload.path + ' to route ' + route + ' with mimetype ' + this.mimetypeLookup(upload.path))
async uploadAsset(upload: FileDescriptor, route: string, auth?: string) {
logger.debug('uploadAsset ' + upload.path + ' to route ' + route + ' with mimetype ' + this.mimetypeLookup(upload.path) + ', auth : ' + auth)

@@ -317,2 +324,3 @@ try {

dbAsset.route = route
dbAsset.auth = auth

@@ -319,0 +327,0 @@ // const fstat = fs.statSync(fileName)

@@ -14,3 +14,4 @@ #!/usr/bin/env ts-node

this.description('manage users in cyk_user table').version('0.1')
this.addCommand(new UserAddCmd())
this.addCommand(new UserAddCmd('add', 'add a new user'))
this.addCommand(new UserAddCmd('a', 'add a new user'))
this.addCommand(new UserUpdateCmd('update', 'update user by id all fields except password'))

@@ -39,5 +40,5 @@ this.addCommand(new UserUpdateCmd('u', 'shortcut for (u)pdate'))

class UserAddCmd extends Cmd {
constructor() {
super('add')
this.description('add a new user')
constructor(name: string, description: string) {
super(name)
this.description(description)
.requiredOption('-n --name <name>', 'user name')

@@ -44,0 +45,0 @@ .option('-e --email <email>', 'user email address')

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