Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
require.resolve('backbone/backbone.js'),
path.join(__dirname, '..', '..', 'dist', 'backbone.iosync.js'),
path.join(__dirname, '..', '..', 'dist', 'backbone.iobind.js')
]);
// serve using express
exports.vendorjs = folio.serve(vendorJs);
/**
* Template Javascript Package
*
* We are going to use pre-compiled
* jade on the client-side.
*/
var templateJs = new folio.Glossary([
require.resolve('jade/runtime.js'),
path.join(__dirname, '..', 'views/templates/js/header.js'),
path.join(__dirname, '..', 'views/templates/form.jade'),
path.join(__dirname, '..', 'views/templates/item.jade')
], {
compilers: {
jade: function (name, source) {
return 'template[\'' + name + '\'] = ' +
jade.compileClient(source, {
client: true,
compileDebug: false
}) + ';';
}
}
});
exports.index = function(req, res){
res.render('index', { title: 'Done.', layout: false });
};
/**
* Vendor Javascript Package
*
* jquery
* underscore
* backbone
* backbone.iosync
* backbone.iobind
*/
var vendorJs = new folio.Glossary([
//path.join(__dirname, '..', 'public', 'js', 'jquery.min.js'),
require.resolve('jquery/dist/jquery.js'),
require.resolve('underscore/underscore.js'),
require.resolve('backbone/backbone.js'),
path.join(__dirname, '..', '..', 'dist', 'backbone.iosync.js'),
path.join(__dirname, '..', '..', 'dist', 'backbone.iobind.js')
]);
// serve using express
exports.vendorjs = folio.serve(vendorJs);
/**
* Template Javascript Package
*
* We are going to use pre-compiled
* jade on the client-side.
});
};
// Go!
iteratePath(basepath);
/**
* Package together all found files into a
* folio.Glossary, defining a custom "compiler"
* that will wrap our script with the needed commonjs
*
* @param {Array} files
* @param {Object} folio glossary configuration
*/
var applicationJs = new folio.Glossary(appfiles, {
compilers: {
js: function (name, source, filename) {
var title = filename.replace(basepath + '/', '').replace('.js', '')
, buf = '\nrequire.register("' + title + '", function (module, exports, require) {\n';
buf += source;
buf += '\n}); // module ' + name;
return buf;
}
}
});
/*!
* Load up our prefix/suffix
*/
var prefix = fs.readFileSync(join(__dirname, 'browser', 'prefix.js'), 'utf8')
path.join(__dirname, '..', 'views/templates/form.jade'),
path.join(__dirname, '..', 'views/templates/item.jade')
], {
compilers: {
jade: function (name, source) {
return 'template[\'' + name + '\'] = ' +
jade.compileClient(source, {
client: true,
compileDebug: false
}) + ';';
}
}
});
// serve using express
exports.templatejs = folio.serve(templateJs);
* backbone
* backbone.iosync
* backbone.iobind
*/
var vendorJs = new folio.Glossary([
//path.join(__dirname, '..', 'public', 'js', 'jquery.min.js'),
require.resolve('jquery/dist/jquery.js'),
require.resolve('underscore/underscore.js'),
require.resolve('backbone/backbone.js'),
path.join(__dirname, '..', '..', 'dist', 'backbone.iosync.js'),
path.join(__dirname, '..', '..', 'dist', 'backbone.iobind.js')
]);
// serve using express
exports.vendorjs = folio.serve(vendorJs);
/**
* Template Javascript Package
*
* We are going to use pre-compiled
* jade on the client-side.
*/
var templateJs = new folio.Glossary([
require.resolve('jade/runtime.js'),
path.join(__dirname, '..', 'views/templates/js/header.js'),
path.join(__dirname, '..', 'views/templates/form.jade'),
path.join(__dirname, '..', 'views/templates/item.jade')
], {
compilers: {
jade: function (name, source) {
var drip = new folio.Glossary([
path.join(__dirname, '..', 'lib', 'drip.js')
], {
prefix: fs.readFileSync(path.join(__dirname, 'browser', 'prefix.js'), 'utf8'),
suffix: fs.readFileSync(path.join(__dirname, 'browser', 'suffix.js'), 'utf8')
});
drip.compile(function (err, source) {
var copyright = fs.readFileSync(path.join(__dirname, 'browser', 'copyright.js'));
fs.writeFileSync(path.join(__dirname, '..', 'drip.js'), copyright + '\n' + source);
console.log('Build successful: ' + '\tdrip.js');
});
var drip_min = new folio.Glossary([
path.join(__dirname, '..', 'lib', 'drip.js')
], {
minify: true,
prefix: fs.readFileSync(path.join(__dirname, 'browser', 'prefix.js'), 'utf8'),
suffix: fs.readFileSync(path.join(__dirname, 'browser', 'suffix.js'), 'utf8')
});
drip_min.compile(function (err, source) {
var copyright = fs.readFileSync(path.join(__dirname, 'browser', 'copyright.js'));
fs.writeFileSync(path.join(__dirname, '..', 'drip.min.js'), copyright + '\n' + source);
console.log('Build successful: ' + '\tdrip.min.js');
});
var folio = require('folio')
, path = require('path')
, fs = require('fs');
var drip = new folio.Glossary([
path.join(__dirname, '..', 'lib', 'drip.js')
], {
prefix: fs.readFileSync(path.join(__dirname, 'browser', 'prefix.js'), 'utf8'),
suffix: fs.readFileSync(path.join(__dirname, 'browser', 'suffix.js'), 'utf8')
});
drip.compile(function (err, source) {
var copyright = fs.readFileSync(path.join(__dirname, 'browser', 'copyright.js'));
fs.writeFileSync(path.join(__dirname, '..', 'drip.js'), copyright + '\n' + source);
console.log('Build successful: ' + '\tdrip.js');
});
var drip_min = new folio.Glossary([
path.join(__dirname, '..', 'lib', 'drip.js')
], {
minify: true,
file({'backbone.iobind.js': ['lib/copyright.js', 'lib/model.js', 'lib/collection.js', 'lib/prefix.js', 'lib/suffix.js']}, function () {
var binding = new folio.glossary([
path.join(__dirname, 'lib', 'copyright.js'),
path.join(__dirname, 'lib', 'prefix.js'),
path.join(__dirname, 'lib', 'model.js'),
path.join(__dirname, 'lib', 'collection.js'),
path.join(__dirname, 'lib', 'suffix.js')
]);
binding.compile(function (err, source) {
fs.writeFileSync(path.join(__dirname, 'backbone.iobind.js'), source);
console.log('Build successful: '.green + '\tbackbone.iobind.js'.blue);
});
});
var folio = require('folio');
folio('chai')
.root(__dirname, '..')
.use(folio.requires())
.dir('./lib')
.package('chai')
.entry('./chai.js')
.pop()
.use(folio.indent())
.line(' ')
.pop()
.use(folio.wrapper())
.prefix([
'!function (name, context, definition) {'
, ' if (typeof require === \'function\' && typeof exports === \'object\' && typeof module === \'object\') {'
, ' module.exports = definition();'
, ' } else if (typeof define === \'function\' && typeof define.amd === \'object\') {'
, ' define(function () {'
, ' return definition();'
, ' });'
, ' } else {'
, ' context[name] = definition();'
, ' }'
, '}(\'chai\', this, function () {\n'
].join('\n'))
var folio = require('folio');
folio('chai')
.root(__dirname, '..')
.use(folio.requires())
.dir('./lib')
.package('chai')
.entry('./chai.js')
.pop()
.use(folio.indent())
.line(' ')
.pop()
.use(folio.wrapper())
.prefix([
'!function (name, context, definition) {'
, ' if (typeof require === \'function\' && typeof exports === \'object\' && typeof module === \'object\') {'
, ' module.exports = definition();'
, ' } else if (typeof define === \'function\' && typeof define.amd === \'object\') {'
, ' define(function () {'
, ' return definition();'
, ' });'