apeman-proto-app
Version:
Prototype for app project.
139 lines (127 loc) • 3.5 kB
JavaScript
/**
* Configuration file for apeman projects.
* @see https://github.com/apeman-labo/apeman
*/
;
module.exports = {
/**
* Current working directory path
*/
get $cwd() {
return __dirname;
},
/** Package data. */
get $pkg() {
return require('./package.json');
},
/** Prototype apps */
get $proto() {
return [
require('apeman-proto-abstract'),
require('apeman-proto-wtch'),
require('apeman-proto-mocha')
];
},
/**
* apeman tmpl configurations.
* @see https://github.com/apeman-labo/apeman-tmpl
*/
get $tmpls() {
const robots = require('apeman-tmpl-robots'),
humans = require('apeman-tmpl-humans'),
route = require('apeman-tmpl-route'),
bud = require('apeman-tmpl-bud'),
settings = require('apeman-tmpl-settings');
let $ctx = this.$ctx || {},
$vars = this.$vars || {};
let testDir = $ctx.testDir || $vars.TEST_DEFAULT_DIR;
return {
'public/robots.txt': robots({
disallow: [
'errors',
'tmp',
'downloads'
]
}),
'public/humans.txt': humans({}),
'routes/index.js': route({}),
'settings/index.js': settings({}),
'test/.test.js.bud': undefined,
[`${testDir}/.test.js.bud`]: bud({
'type': 'route-test',
'runner': 'mocha',
'src': '../routes/*_route.js'
})
}
},
/**
* apeman task configurations.
* @see https://github.com/apeman-labo/apeman-task
*/
get $tasks() {
const mkdir = require('apeman-task-mkdir'),
coz = require('apeman-task-coz');
let $ctx = this.$ctx || {},
$vars = this.$vars || {};
let testDir = $ctx.testDir || $vars.TEST_DEFAULT_DIR;
return {
'app:mkdir': mkdir([
'errors',
'public',
'routes',
`${testDir}`,
'settings'
]),
'app:render': coz([
$vars.APP_RENDER_PATTERN
]),
'app:test': [
'mocha:run'
]
}
},
/**
* apeman watch configurations.
* @see https://github.com/apeman-labo/apeman-wtch
*/
get $wtchs() {
let $vars = this.$vars;
return {
'app:render': {
pattern: $vars.APP_RENDER_PATTERN,
action: (ev, filename) => {
require('coz').render(filename);
}
}
}
},
/**
* Note about properties
*/
get $notes() {
return {
'$tasks.app:mkdir': "Generate directories for app.",
'$tasks.app:render': "Render bud files.",
'$wtchs.app:render': "Watch bud files to render."
}
},
/**
* Commands which need to be installed in advance
*/
get $needs() {
return {}
},
/**
* Project variables
*/
get $vars() {
return {
TEST_DEFAULT_DIR: 'tests',
APP_RENDER_PATTERN: `+(errors|public|routes|tests|settings)/**/.*.bud`
}
}
};
if (!module.parent) {
// Execute this file as apeman bin.
require('apeman').cli(process.argv);
}