@applicaster/zapplicaster-cli
Version:
CLI Tool for the zapp app and Quick Brick project
42 lines (36 loc) • 1.22 kB
JavaScript
const { join, resolve } = require("path");
const cwd = process.cwd();
const quickBrickTemplate = join(__dirname, "../templates");
/**
* returns the path which needs to be used to output the quick brick directory
*
* @param {boolean} [destinationPath=false] optional destination path to override the default
* @returns path where quick brick template project will be generated
*/
function quickBrickDirectory(destinationPath = false) {
return destinationPath || join(cwd, "./quick_brick");
}
/**
* returns the destination path of a specific config file
* @param {Object} options
* @param {String} options.destinationPath destination path of the quick brick template
* @param {String} options.platform
* @param {String} options.folder either "config", "fonts" or "assets"
* @param {String?} options.fileName name of the file (optional)
* @returns {String} destination path
*/
function getFileDestinationPath({
destinationPath,
platform,
folder,
fileName,
}) {
const path = resolve(quickBrickDirectory(destinationPath), folder, platform);
return fileName ? resolve(path, fileName) : path;
}
module.exports = {
cwd,
quickBrickTemplate,
quickBrickDirectory,
getFileDestinationPath,
};