2.0.0 • Published 5 years ago
smartuxdeploy v2.0.0
SmartUX Studio application deployment to SmartUX runtime
Overview
Requirements
NodeJS
Installation
$ npm install smartuxdeploy
Usage
input parameters:
Parameter | Description | Example value | Data type |
---|---|---|---|
protocol | protocol of the smartUX studio environment | 'http' or 'https' | String |
hostURL | URL of the SmartUX Studio (do not include http:// or https://) | studio.smartux.com | String |
username | username to log in to SmartUX Studio | admin | String |
encryptedPassword | encrypted password | Click here for details | String |
import the required npm modules in your file
const smartuxdeploy = require('smartuxdeploy');
const fs = require('fs');
const zipper = require('zip-local');
const path = require('path');
const FormData = require('form-data');
example usage:
// Set the enviroment variables
const protocol = "<http or https>";
const hostURL = "<YOUR STUDIO URL>";
const username = "<STUDIO USERNAME>";
const encryptedPassword = "<ENCRYPTED PASSWORD>";
// deployAll method calls the getZipFilesToDeploy which results the list of published apps from the smartUx build process.
// next it chceks if there are already files from previously unzipped applications and makes sure that the unzip directory is empty.
// next it unzips the first application from list of published apps and calls the publishZipFile method.
// All the above steps are repeated for all the applications from published app list from the smartUX build process.
async function deployAll() {
var appZipDir = './smartUXPublishedApps/';
var unzipDir = './tempunzipdir';
var zipFilesToDeploy;
try {
zipFilesToDeploy = await smartuxdeploy.getZipFilesToDeploy(appZipDir);
console.log(zipFilesToDeploy);
} catch (error) {
console.error(error);
}
for (file of zipFilesToDeploy) {
// Emptying the unzip directory or create unzipDir if does not exists
if (fs.existsSync(unzipDir)) {
for (const file of fs.readdirSync(unzipDir)) {
fs.unlinkSync(path.join(unzipDir, file));
}
} else {
fs.mkdirSync(unzipDir);
}
console.log(file);
// unzip the zipfile to get smartuxapp.json
zipper.sync.unzip(appZipDir + file).save(unzipDir);
var smartuxAppJson = await smartuxdeploy.readSmartUXAppJs(unzipDir, file);
let appZipFile = appZipDir + file;
var appNameFromZipFile = smartuxAppJson.name;
console.log("Calling runtime publish for app : " + appNameFromZipFile);
try {
await smartuxdeploy.publishZipFile(protocol, hostURL, username, encryptedPassword, appZipFile, smartuxAppJson, file);
} catch (error) {
console.error(error);
}
console.log("Runtime publish completed for app : " + appNameFromZipFile);
}
}
try {
deployAll();
} catch (error) {
console.error(error);
}
publishZipFile
input parameters:
Parameter | Description | Example value | Data type |
---|---|---|---|
protocol | protocol of the smartUX studio environment | 'http' or 'https' | String |
hostURL | URL of the SmartUX dashboard (do not include http:// or https://) | smartuxdashboard.com | String |
username | username to log in to SmartUX dashboard | user | String |
encryptedPassword | encrypted password | Click here for details | String |
2.0.0
5 years ago
1.0.42
5 years ago
1.0.41
5 years ago
1.0.40
5 years ago
1.0.39
5 years ago
1.0.38
5 years ago
1.0.37
5 years ago
1.0.36
5 years ago
1.0.35
5 years ago
1.0.33
5 years ago
1.0.32
5 years ago
1.0.34
5 years ago
1.0.31
5 years ago
1.0.30
5 years ago
1.0.29
5 years ago
1.0.28
5 years ago
1.0.27
5 years ago
1.0.26
5 years ago
1.0.22
5 years ago
1.0.21
5 years ago
1.0.20
5 years ago
1.0.25
5 years ago
1.0.24
5 years ago
1.0.23
5 years ago
1.0.19
5 years ago
1.0.18
5 years ago
1.0.17
5 years ago
1.0.16
5 years ago
1.0.11
5 years ago
1.0.10
5 years ago
1.0.15
5 years ago
1.0.14
5 years ago
1.0.13
5 years ago
1.0.12
5 years ago
1.0.9
5 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago