2.0.0 • Published 3 years ago

smartuxdeploy v2.0.0

Weekly downloads
44
License
ISC
Repository
-
Last release
3 years ago

SmartUX Studio application deployment to SmartUX runtime

Overview

Requirements

NodeJS

Installation

 $ npm install smartuxdeploy

Usage

input parameters:

ParameterDescriptionExample valueData type
protocolprotocol of the smartUX studio environment'http' or 'https'String
hostURLURL of the SmartUX Studio (do not include http:// or https://)studio.smartux.comString
usernameusername to log in to SmartUX StudioadminString
encryptedPasswordencrypted passwordClick here for detailsString

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:

ParameterDescriptionExample valueData type
protocolprotocol of the smartUX studio environment'http' or 'https'String
hostURLURL of the SmartUX dashboard (do not include http:// or https://)smartuxdashboard.comString
usernameusername to log in to SmartUX dashboarduserString
encryptedPasswordencrypted passwordClick here for detailsString
2.0.0

3 years ago

1.0.42

4 years ago

1.0.41

4 years ago

1.0.40

4 years ago

1.0.39

4 years ago

1.0.38

4 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.34

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago