This post has moved to my personal blog: http://maximilianschmitt.me/posts/compile-es6-command-line-apps/
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
const fs = require("fs"); | |
const path = require("path"); | |
const srcDir = path.join(__dirname, "src"); | |
// Define the absolute paths to replace and their corresponding relative paths | |
const patterns = { | |
"@pages/": "./src/pages/", | |
"@lib/": "./src/", | |
"@components/": "./src/components/", |
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
app.use(function(req, res, next) { | |
const router = Router.create({ | |
routes, | |
location: req.path | |
}); | |
router.run(function(Handler, state) { | |
router.transitionTo = function() { | |
const redirectUrl = router.makeHref.apply(router, arguments); | |
return Promise.reject({ reason: 'redirect', redirectUrl }); |
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
'use strict'; | |
var gulp = require('gulp'); | |
var browserify = require('browserify'); | |
var source = require('vinyl-source-stream'); | |
var notifier = require('stream-notifier'); | |
var watchify = require('watchify'); | |
gulp.task('browserify', function() { | |
var bundler = browserify('./src/main') |
This post has moved to my personal blog: http://maximilianschmitt.me/posts/istanbul-code-coverage-badge-github/
This post has moved to my personal blog: http://maximilianschmitt.me/posts/iojs-command-line-apps-nodejs/
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
'use strict'; | |
var EventEmitter = require('events').EventEmitter; | |
var mockSocket = function() { | |
return { | |
toServer: new EventEmitter(), | |
toClient: new EventEmitter(), | |
disconnect: function() { | |
this.toServer.emit('disconnect'); |
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
'use strict'; | |
var mysqlBackup = require('./mysql-backup'); | |
var schedule = require('node-schedule'); | |
schedule.scheduleJob({ hour: 22, minute: 0 }, mysqlBackup); |