Skip to content

Instantly share code, notes, and snippets.

@anfibiacreativa
Last active July 12, 2019 18:46
Show Gist options
  • Save anfibiacreativa/5cb55d6ff987a2f350f104758c3ade3f to your computer and use it in GitHub Desktop.
Save anfibiacreativa/5cb55d6ff987a2f350f104758c3ade3f to your computer and use it in GitHub Desktop.
const path = require('path');
// this comes from maven env
const TENANT = process.env.NPM_FRONTEND_MODULE_BASE_DIR;
const TENANT_NAME = TENANT.split('/').reverse()[2];
const TENANT_COMPONENTS = TENANT.substr(0, TENANT.lastIndexOf('/'));
const PROJECT_ID = 'project-id';
console.log(`############## FRONTEND BUILD ##############`);
console.log(`############## STARTING BUILD FOR TENANT: ${TENANT_NAME} ##############`);
console.log(`############## ******* ##############`);
const CONSTANTS = {
SUFFIX_SOURCE: '.entry',
SUFFIX_TARGET: '.bundle',
SUFFIX_AUTHOR: 'author', // eg: author.bundle.js, dialog.author.bundle.js
// Project root (relative to config folder)
BASE_DIR: '../../',
// Partial from tenant package (subproject id)
TENANTS_PACKAGE: `${TENANT}`,
// Path to frontend working directory (or where the package.json is at) (relative to BASE_DIR)
FRONTEND_PACKAGE: '',
// Path to tenant root
PROJECT_COMMONS: `apps/${PROJECT_ID}`,
// Path to shared and abstracts include
SHARED_INCLUDE: 'commons/shared',
// Path to vendor (js) code alias
VENDORS_INCLUDE: 'commons/vendor',
// Path to assets (such as svg icons)
ASSETS_INCLUDE: 'theme/assets',
// Path to dialogs styles include
DIALOG_CSS_INCLUDE: 'dialog',
// Path to tenants package
TENANTS_COMPONENTS_INCLUDE: `${TENANTS_COMPONENTS}`,
// Path to components package
COMPONENTS_INCLUDE: 'components',
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment