Install Template - Hertox82/lt-pm GitHub Wiki

Install Template

this is an example to install a template

import * as path from 'path';
import {PackageManager, Template} from 'lt-pm';

const cwd = path.resolve(__dirname+'/../test/template');      // <- Folder to take the Template Source
const compr = path.resolve(__dirname+'/../test/compressed'); // <- Folder to put Compressed Template
const depl = path.resolve(__dirname+'/../test/toDeploy');    // <- Folder to Decompress Template

const pm = new PackageManager(compr,cwd,depl);
//this info passed by third party
const listOfInstalled =[
    new Template('nameTemplate','vendor1','1.0.0'),
];

// Passing to PackageManager the list of Installed Template
pm.setListTemplateInstalled(listOfInstalled);

// Get the list of avaiable Plugin into the Repo
let listTemplateRepo = pm.getLatestTemplateRepo();

 listTemplateRepo.forEach(
        (template) => {
            if(!template.installed) {
                pm.installTemplate(template);
            }
        }
    );

<< Back