Last active
August 29, 2015 14:17
-
-
Save sankargorthi/9040903c0cc03c9d728a to your computer and use it in GitHub Desktop.
component@1 builder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global __dirname */ | |
var _ = require('lodash'); | |
var log = require('debug')('builder:log'); | |
var debug = require('debug')('builder:debug'); | |
var error = require('debug')('builder:error'); | |
/* File utilities */ | |
var write = require('fs').writeFileSync; | |
var mkdir = require('mkdirp').sync; | |
var path = require('path'); | |
/* Component utilities */ | |
var program = require('commander'); | |
var build = require('component-builder'); | |
var resolve = require('component-resolver'); | |
var bundler = require('component-bundler'); | |
/* handlebars configuration */ | |
var hbs = require('component-builder-handlebars'); | |
var hbsOptions = require('./plugins/hbs'); | |
var xmlOptions = require('./plugins/xml.json'); | |
program | |
.version('9.0.0') | |
.option('-d, --development', 'Build the development version of the modules') | |
.parse(process.argv); | |
var options = { | |
root: path.join(__dirname), | |
build: path.join(__dirname, 'public/sm/feature'), | |
name: 'build' | |
}; | |
mkdir(options.build); | |
log('build path %s', options.build); | |
var json = require('./component.json'); | |
var bundle = bundler.pages(json); | |
resolve(options.root, { | |
install: true | |
}, function (err, tree) { | |
if (err) { | |
error(err); | |
throw err; | |
} | |
var bundles = bundle(tree); | |
_.each(bundles, function (module, name) { | |
var version = _(module).pluck('node').filter({ | |
name: name | |
}).first().version; | |
debug('Version of module %s: %s', name, version); | |
var outputPath = path.join(options.build, name, version); | |
log('Building module: %s to %s', name, outputPath); | |
var buildOptions = { | |
dev: program.development || false | |
}; | |
/** | |
* build CSS files | |
*/ | |
build.styles(module, buildOptions) | |
.use('styles', build.plugins.css()) | |
.use('styles', build.plugins.urlRewriter()) | |
.build(function (err, css) { | |
var file; | |
if (!css) { | |
log('WARNING: No CSS found for %s', name); | |
return; | |
} | |
if (err) { | |
error(err); | |
throw err; | |
} | |
// Create the outputPath folder for this bundle | |
mkdir(outputPath); | |
file = path.join(outputPath, options.name + '.css'); | |
write(file, css, 'utf8'); | |
}); | |
/** | |
* build JS files | |
*/ | |
build.scripts(module, buildOptions) | |
.use('scripts', build.plugins.js()) | |
.use('templates', build.plugins.string()) | |
.use('hbs', hbs(hbsOptions)) | |
.use('xml', hbs(xmlOptions)) | |
.build(function (err, js) { | |
var file; | |
if (!js) { | |
log('WARNING: No JS found for %s', name); | |
return; | |
} | |
if (err) { | |
error(err); | |
throw err; | |
} | |
js = hbs.includeRuntime() + js; | |
file = path.join(outputPath, options.name + '.js'); | |
js = build.scripts.umd('./modules/' + name, name, js); | |
write(file, js, 'utf8'); | |
}); | |
/** | |
* write files and assets | |
*/ | |
build.files(module, { | |
destination: outputPath | |
}) | |
.use('images', build.plugins.symlink()) | |
.use('files', build.plugins.symlink()) | |
.end(); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* At the root folder */ | |
{ | |
"name": "ms-ui", | |
"version": "8.4.0", | |
"paths": [ | |
"modules" | |
], | |
"locals": [ | |
"content-blocks", | |
"datasource", | |
"extension-connector", | |
"mailing", | |
"message-queue", | |
"ms-core", | |
"ms-dashboard", | |
"notification", | |
"programs", | |
"settings", | |
"sm-app", | |
"strongview-reports", | |
"target", | |
"templates", | |
"tracking-report" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Located at ./modules/ms-core */ | |
{ | |
"name": "ms-core", | |
"repository": "sv/ms-core", | |
"description": "The MS core utilities", | |
"version": "", | |
"keywords": [ | |
"messageStudio", | |
"ms-core" | |
], | |
"license": "© StrongView Systems, 2014. All Rights Reserved.", | |
"paths": [ | |
"../../util", | |
"../../" | |
], | |
"locals": [ | |
"strongview-utility", | |
"sm-dijit", | |
"data", | |
"sm-util", | |
"ms-loader", | |
"wizardstyles" | |
], | |
"scripts": [ | |
"sm/Util.js", | |
"sm/Context.js", | |
"sm/Constants.js", | |
"scripts/bootstrap.js", | |
"scripts/autoupdate.js", | |
"index.js" | |
], | |
"styles": [ | |
"styles/reset.css", | |
"styles/common.css", | |
"styles/content.css", | |
"styles/DnD.css", | |
"styles/layoutNav.css", | |
"styles/messageStudio.css" | |
], | |
"hbs": [ | |
"tmpl/RecordCount.hbs" | |
], | |
"images": [ | |
"images/CKEditorDialogTitleBar.gif", | |
"images/left_menu_assets.png", | |
"images/ListIcons.png", | |
"images/ListIcons_grayscale.png", | |
"images/TemplateWizardActiveButtonGradient.gif", | |
"images/TemplateWizardCloseButton.gif", | |
"images/ab-winner-sprite.png", | |
"images/about_bg_body.gif", | |
"images/active_green.gif", | |
"images/active_grey.gif", | |
"images/add_icon.gif", | |
"images/admin_controlpanel.gif", | |
"images/admin_export.gif", | |
"images/admin_inbound.gif", | |
"images/admin_interfaces.gif", | |
"images/admin_liveupdates.gif", | |
"images/admin_logmanagement.gif", | |
"images/admin_outbound.gif", | |
"images/admin_setupwizard.gif", | |
"images/admin_trackingsystem.gif", | |
"images/admin_usermanagement.gif", | |
"images/archived_green.gif", | |
"images/archived_grey.gif", | |
"images/background_blue_curve.jpg", | |
"images/bg_tab.gif", | |
"images/blue_left.png", | |
"images/blue_right.png", | |
"images/btn_Add.png", | |
"images/btn_Remove.png", | |
"images/button_arrowleft.gif", | |
"images/button_arrowright.gif", | |
"images/button_create_cblock.gif", | |
"images/button_hide_overlay.gif", | |
"images/button_left.gif", | |
"images/button_pagefirst.gif", | |
"images/button_pagelast.gif", | |
"images/button_pagenext.gif", | |
"images/button_pageprev.gif", | |
"images/button_print_overlay.gif", | |
"images/button_reload.gif", | |
"images/button_restart.gif", | |
"images/button_right.gif", | |
"images/button_show_overlay.gif", | |
"images/button_start.gif", | |
"images/button_stop.gif", | |
"images/checkboxes.png", | |
"images/common_icons.png", | |
"images/createIcon.gif", | |
"images/createProgramLinkButton.gif", | |
"images/dashboard.png", | |
"images/dashboardGradientSprite.gif", | |
"images/dashboardIconsSprite.png", | |
"images/ddmenu_topgraphic.png", | |
"images/delete_icon.gif", | |
"images/deliverabilityIcon.png", | |
"images/disabled-template-icons.png", | |
"images/engagementIcon.png", | |
"images/graphHeader.gif", | |
"images/grey_left.png", | |
"images/grey_right.png", | |
"images/headingshadow.gif", | |
"images/icon_Alert.png", | |
"images/icon_Create.png", | |
"images/icon_Delete.png", | |
"images/icon_Edit.png", | |
"images/icon_Refresh.png", | |
"images/icon_ResetPassword.png", | |
"images/icon_add.gif", | |
"images/icon_chrome.png", | |
"images/icon_collapsed.gif", | |
"images/icon_content_block_16.png", | |
"images/icon_delete.gif", | |
"images/icon_expand_view.png", | |
"images/icon_expanded.gif", | |
"images/icon_firefox.png", | |
"images/icon_internet_explorer.png", | |
"images/icon_multi_variate_16.png", | |
"images/icon_personalize.png", | |
"images/icon_safari.png", | |
"images/idsWizardArrows.png", | |
"images/imageLibraryButtonGradients.png", | |
"images/insertV4.png", | |
"images/keystats_icon.gif", | |
"images/loader_content.gif", | |
"images/loader_tab.gif", | |
"images/mailingWizardSprite.png", | |
"images/mailings_icon.gif", | |
"images/main_bgbl.gif", | |
"images/main_bgbr.gif", | |
"images/main_bgleft.gif", | |
"images/main_bgtl.gif", | |
"images/main_bgtop.gif", | |
"images/main_bgtr.gif", | |
"images/overview.png", | |
"images/pane_bgdivider.gif", | |
"images/pane_bgdropshadow.gif", | |
"images/pane_drag.gif", | |
"images/password-assets.png", | |
"images/pinfo_bg.gif", | |
"images/prefs_bgbl.gif", | |
"images/prefs_bgbr.gif", | |
"images/prefs_bgtfoot.gif", | |
"images/prefs_bgtl.gif", | |
"images/prefs_bgtr.gif", | |
"images/prefs_filtericon.gif", | |
"images/prefs_prefsicon.gif", | |
"images/previewnavshadow.gif", | |
"images/previewtabs.gif", | |
"images/progress_bgleft.gif", | |
"images/progress_bgleftselected.gif", | |
"images/progress_bgright.gif", | |
"images/progress_bgrightselected.gif", | |
"images/quickStartIcons.png", | |
"images/reachIcon.png", | |
"images/report_bgtfootbl.gif", | |
"images/report_bgtfootbr.gif", | |
"images/report_bgthead.gif", | |
"images/report_bgtheadtl.gif", | |
"images/report_bgtheadtr.gif", | |
"images/reporting_clicksopens.gif", | |
"images/reporting_complaints.gif", | |
"images/reporting_failureanalysis.gif", | |
"images/reporting_mailings.gif", | |
"images/reporting_overview.gif", | |
"images/reporting_performance.gif", | |
"images/reporting_unsubscribes.gif", | |
"images/searchfield_bgleft.gif", | |
"images/searchfield_bgright.gif", | |
"images/sidebar_bgtop_rounded.gif", | |
"images/sortable_bgth.gif", | |
"images/spacer_highlight.gif", | |
"images/specialTagButtonIcons.png", | |
"images/sprite_button_controls.gif", | |
"images/sprite_menu_bar.gif", | |
"images/sprite_nav.png", | |
"images/sprite_nav_accordion.gif", | |
"images/sprite_searchbox.png", | |
"images/strongmail.gif", | |
"images/submit_close.gif", | |
"images/submit_validatexsl.gif", | |
"images/tabBottomEnabledC.gif", | |
"images/tabEnabled.png", | |
"images/tabHover.gif", | |
"images/tabHover.png", | |
"images/tabShadow.gif", | |
"images/tab_administration.gif", | |
"images/tab_columns.gif", | |
"images/tab_messagestudio.gif", | |
"images/tab_previewaol.gif", | |
"images/tab_previewhtml.gif", | |
"images/tab_previewraw.gif", | |
"images/tab_previewsms.gif", | |
"images/tab_previewtext.gif", | |
"images/tab_programs.gif", | |
"images/tab_reporting.gif", | |
"images/tab_rules.gif", | |
"images/tab_targets.gif", | |
"images/tab_tokens.gif", | |
"images/tableheader.gif", | |
"images/targetBuilderIcons.png", | |
"images/targetBuilderInfoIcons.png", | |
"images/templateActionIcons.png", | |
"images/templates_icon.gif", | |
"images/tileGridButtons.png", | |
"images/tooltipConnectorLeft.png", | |
"images/toprightToolBackground.png", | |
"images/verticalrule.gif", | |
"images/viewIcon.gif", | |
"images/contentBlockSprites.png", | |
"images/expand_minus.gif", | |
"images/expand_plus.gif", | |
"images/icon_dnd.gif", | |
"images/imageLibraryDisplayFilterIcons.gif", | |
"images/loader_dojo.gif", | |
"images/openhand.cur", | |
"images/rightNavigation.png", | |
"images/spacer.gif", | |
"images/spriteIconsSmall.png", | |
"images/sprite_nav_inactive.png", | |
"images/thumbCollapse.png", | |
"images/thumbExpand.png" | |
], | |
"dependencies": { | |
"lodash/lodash": "2.4.1", | |
"components/jquery": "^2.1.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment