ninjs-rjs
Version:
requirejs build wrapper
53 lines (45 loc) • 1.88 kB
JavaScript
const _ = require('ninjs-lodash')
const rjs = require('../lib/rjs')
const DEMO = _.path.join(_.$('paths.root'), 'demo')
const APP_SRC = _.path.join(DEMO, "app", "js")
const APP_DEST = _.path.join(DEMO, "app", "public", "js", "scripts.js")
const CDN_SRC = _.path.join(_.$("paths.code"), "sites", "snapptop.com", "apps", "cdn.snapptop.com", "js")
const CDN_DEST = _.path.join(_.$("paths.dev"), "sites", "snapptop.com", "cdn.snapptop.com", "public", "js", "scripts.js")
exports = module.exports = {
"help": {
"options": { },
"handler": (options) => { _.log(`\nTODO: print Help Info for all Commands\n`) },
"text": "Gets help info for all commands"
},
"settings": {
"options": { "key": "" },
"handler": (options) => {
let key = _.get(options, "key") || ""
let val = _.$(key)
if(val) _.jslog(val)
},
"text": `Gets global settings (_.$())\n\nOR\n\nGets a specific global setting designated by --key=<key> (_.$(key))`
},
"app": {
"render": {
"options": { "enabled": true, "baseUrl": "", "out": "" },
"handler": (options) => { rjs.renderApp(options, _.logcb) },
"text": "Builds/Optimizes/AutoPrefixes/Minifies file entry -> dest/styles.css"
},
"demo": {
"options": { "enabled": true, "baseUrl": APP_SRC, "out": APP_DEST },
"handler": (options) => { rjs.renderApp(options, _.logcb) },
"text": "Builds demo app js and prints result -> see ./demo/app/public/js/** for output"
},
"cdn": {
"options": { "enabled": true, "baseUrl": CDN_SRC, "out": CDN_DEST },
"handler": (options) => { rjs.renderApp(options, _.logcb) },
"text": "Builds cdn app js and prints result"
}
}
}
_.cli(exports)
// Prevents the program from stopping instantly
// process.stdin.resume();