-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use webpack to build ErizoClient (#948)
Use webpack to build ErizoClient
- Loading branch information
Showing
39 changed files
with
620 additions
and
453 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
erizoClient/dist/erizofc.js | ||
erizoClient/build/erizofc.js | ||
erizoClient/dist/erizo.js | ||
erizoClient/dist/production/ | ||
erizoClient/dist/debug/ | ||
erizoController/node_modules/ | ||
test/public/erizo.js | ||
erizoController/ch_policies/ | ||
erizoController/ch_policies/ |
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,35 @@ | ||
const erizoFcTasks = (gulp, plugins, config) => { | ||
const that = {}; | ||
if (!config.paths) { | ||
return; | ||
} | ||
const erizoFcConfig = { | ||
entry: `${config.paths.entry}ErizoFc.js`, | ||
webpackConfig: require('../webpack.config.erizofc.js'), | ||
debug: `${config.paths.debug}/erizofc`, | ||
production: `${config.paths.production}/erizofc`, | ||
}; | ||
that.bundle = () => | ||
gulp.src(erizoFcConfig.entry) | ||
.pipe(plugins.webpackGulp(erizoFcConfig.webpackConfig, plugins.webpack)) | ||
.on('error', anError => console.log('An error ', anError)) | ||
.pipe(gulp.dest(erizoFcConfig.debug)) | ||
.on('error', anError => console.log('An error ', anError)); | ||
|
||
that.compile = () => { | ||
return gulp.src(`${erizoFcConfig.debug}/**/*.js`) | ||
.pipe(gulp.dest(erizoFcConfig.production)); | ||
} | ||
|
||
that.dist = () => | ||
gulp.src(`${erizoFcConfig.production}/**/*.js`) | ||
.pipe(gulp.dest(config.paths.spine)); | ||
|
||
that.clean = () => | ||
plugins.del([`${erizoFcConfig.debug}/**/*.js*`, `${erizoFcConfig.production}/**/*.js*`], | ||
{ force: true }); | ||
|
||
return that; | ||
}; | ||
|
||
module.exports = erizoFcTasks; |
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,43 @@ | ||
const erizoTasks = (gulp, plugins, config) => { | ||
const that = {}; | ||
if (!config.paths) { | ||
return; | ||
} | ||
const erizoConfig = { | ||
entry: `${config.paths.entry}Erizo.js`, | ||
webpackConfig: require('../webpack.config.erizo.js'), | ||
debug: `${config.paths.debug}/erizo`, | ||
production: `${config.paths.production}/erizo`, | ||
}; | ||
|
||
that.bundle = () => | ||
gulp.src(erizoConfig.entry, { base: './' }) | ||
.pipe(plugins.webpackGulp(erizoConfig.webpackConfig, plugins.webpack)) | ||
.on('error', anError => console.log('An error ', anError)) | ||
.pipe(gulp.dest(erizoConfig.debug)) | ||
.on('error', anError => console.log('An error ', anError)); | ||
|
||
that.compile = () => | ||
gulp.src(`${erizoConfig.debug}/**/*.js`, { base: './' }) | ||
.pipe(plugins.sourcemaps.init()) | ||
.pipe(plugins.closureCompiler({ | ||
languageIn: 'ECMASCRIPT6', | ||
languageOut: 'ECMASCRIPT5', | ||
jsOutputFile: 'erizo.js', | ||
createSourceMap: true, | ||
})) | ||
.pipe(plugins.sourcemaps.write('/')) // gulp-sourcemaps automatically adds the sourcemap url comment | ||
.pipe(gulp.dest(erizoConfig.production)); | ||
|
||
that.dist = () => | ||
gulp.src(`${erizoConfig.production}/**/*.js*`) | ||
.pipe(gulp.dest(config.paths.basicExample)); | ||
|
||
that.clean = () => | ||
plugins.del([`${erizoConfig.debug}/**/*.js*`, `${erizoConfig.production}/**/*.js*`], | ||
{ force: true }); | ||
|
||
return that; | ||
}; | ||
|
||
module.exports = erizoTasks; |
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,62 @@ | ||
const gulp = require('gulp'); | ||
|
||
const plugins = {}; | ||
plugins.runSequence = require('run-sequence'); | ||
plugins.del = require('del'); | ||
plugins.sourcemaps = require('gulp-sourcemaps'); | ||
|
||
plugins.eslint = require('gulp-eslint'); | ||
plugins.closureCompiler = require('google-closure-compiler-js').gulp(); | ||
|
||
plugins.webpack = require('webpack'); | ||
plugins.webpackGulp = require('webpack-stream'); | ||
|
||
|
||
const config = { | ||
paths: { | ||
entry: './src/', | ||
debug: './dist/debug', | ||
production: './dist/production', | ||
basicExample: '../../extras/basic_example/public/', | ||
spine: '../../spine/', | ||
js: './src/**/*.js', | ||
}, | ||
}; | ||
|
||
const tasks = ['clean', 'bundle', 'compile', 'dist']; | ||
const targets = ['erizo', 'erizofc']; | ||
const allTasks = ['lint']; | ||
|
||
|
||
const taskFunctions = {}; | ||
taskFunctions.erizo = require('./gulp/erizoTasks.js')(gulp, plugins, config); | ||
taskFunctions.erizofc = require('./gulp/erizoFcTasks.js')(gulp, plugins, config); | ||
|
||
targets.forEach( | ||
(target) => { | ||
tasks.forEach( | ||
(task) => { | ||
const taskName = `${task}_${target}`; | ||
allTasks.push(taskName); | ||
gulp.task(taskName, () => { | ||
return taskFunctions[target][task]() | ||
}); | ||
}); | ||
}); | ||
|
||
gulp.task('lint', () => { | ||
return gulp.src(config.paths.js) | ||
.pipe(plugins.eslint()); | ||
}); | ||
|
||
gulp.task('watch', () => { | ||
const watcher = gulp.watch('src/**/*.js'); | ||
watcher.on('change', (event) => { | ||
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...'); | ||
plugins.runSequence('default'); | ||
}); | ||
}); | ||
|
||
gulp.task('default', () => { | ||
plugins.runSequence(...allTasks); | ||
}); |
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,19 @@ | ||
import Room from './Room'; | ||
import { LicodeEvent, RoomEvent, StreamEvent } from './Events'; | ||
import Stream from './Stream'; | ||
import Logger from './utils/Logger'; | ||
|
||
require("expose-loader?adapter!../lib/adapter.js"); | ||
require("script-loader!./utils/L.Resizer.js"); | ||
|
||
|
||
const Erizo = { | ||
Room: Room.bind(null, undefined, undefined), | ||
LicodeEvent, | ||
RoomEvent, | ||
StreamEvent, | ||
Stream: Stream.bind(null, undefined), | ||
Logger, | ||
}; | ||
|
||
export default Erizo; |
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,15 @@ | ||
import Room from './Room'; | ||
import { LicodeEvent, RoomEvent, StreamEvent } from './Events'; | ||
import Stream from './Stream'; | ||
|
||
// Using script-loader to load global variables | ||
|
||
const Erizo = { | ||
Room, | ||
LicodeEvent, | ||
RoomEvent, | ||
StreamEvent, | ||
Stream | ||
}; | ||
|
||
export default Erizo; |
Oops, something went wrong.