-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from rbrastad/serverside-es6
Serverside es6
- Loading branch information
Showing
14 changed files
with
148 additions
and
124 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
'use strict'; | ||
|
||
// Folder variables | ||
var srcSite = 'src/main/resources'; | ||
var buildSite = 'build/resources/main'; | ||
var srcAssetsApp = srcSite + '/assets/**/*'; | ||
var srcES6 = srcSite + '/**/*.es6'; | ||
var buildAssets = buildSite + '/assets/dist'; | ||
|
||
var gulp = require('gulp'); | ||
var babel = require('gulp-babel'); | ||
var gulpWebpack = require('webpack-stream'); | ||
var plumber = require('gulp-plumber'); | ||
|
||
gulp.task('default',['babel', 'webpack']); | ||
|
||
gulp.task('webpack', function() { | ||
return gulp | ||
.src( srcAssetsApp ) | ||
.pipe(plumber({ | ||
handleError: function (err) { | ||
console.log(err); | ||
this.emit('end'); | ||
} | ||
})) | ||
.pipe(gulpWebpack(require('./webpack.config.js'))) | ||
.pipe(gulp.dest(buildAssets)); | ||
}); | ||
|
||
|
||
gulp.task('webpack-dev', function() { | ||
return gulp | ||
.src( srcAssetsApp ) | ||
.pipe(plumber({ | ||
handleError: function (err) { | ||
console.log(err); | ||
this.emit('end'); | ||
} | ||
})) | ||
.pipe(gulpWebpack(require('./webpack-dev.config.js'))) | ||
.pipe(gulp.dest(buildAssets)); | ||
}); | ||
|
||
|
||
gulp.task('babel', () => { | ||
return gulp.src( srcES6 ) | ||
.pipe(plumber({ | ||
handleError: function (err) { | ||
console.log(err); | ||
this.emit('end'); | ||
} | ||
})) | ||
.pipe(babel({ | ||
presets: [ | ||
['es2015', {'modules': false}] | ||
] | ||
})) | ||
.pipe(gulp.dest( buildSite )); | ||
}); | ||
|
||
|
||
gulp.task('watch', function() { | ||
gulp.watch( srcES6 , ['babel']); | ||
gulp.watch( srcAssetsApp , ['webpack-dev']); | ||
}); | ||
|
||
|
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { | ||
getUser, | ||
getProfile, | ||
getMemberships | ||
} from '/lib/xp/auth'; | ||
|
||
export function whoami() { | ||
let user = getUser({ | ||
includeProfile : true | ||
}); | ||
|
||
let whoami = { | ||
user, | ||
"memberships" : getMemberships( user.key ) | ||
}; | ||
|
||
return whoami; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {whoami} from '/lib/auth'; | ||
|
||
function get(request) { | ||
return { body: whoami()}; | ||
} | ||
|
||
exports.get = get; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<service> | ||
<allow> | ||
<principal>role:system.authenticated</principal> | ||
</allow> | ||
</service> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,4 @@ | |
<name>Runar Brastad</name> | ||
<url>https://github.com/rbrastad</url> | ||
</vendor> | ||
|
||
</site> |
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
Oops, something went wrong.