Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue/2647 add es6-8 support #2648

Merged
merged 24 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6b3c330
issue/2647
oliverfoster Feb 17, 2020
6343150
Added .gitignore and source comment for polyfill.min.js
oliverfoster Feb 17, 2020
5a4d3ce
Added watch directive
oliverfoster Feb 17, 2020
061a8aa
Added backbone version comment
oliverfoster Feb 17, 2020
a0dcfbb
Removed unnecessary option
oliverfoster Feb 17, 2020
d61b241
Removed /.temp/ folder in favour of <%= outputdir %>/.temp/
oliverfoster Feb 18, 2020
f8c8410
Revert root .temp dir
oliverfoster Feb 18, 2020
f6f102d
Removed shortid dependency
oliverfoster Feb 19, 2020
3f6a737
Switched to single quotes
oliverfoster Feb 19, 2020
8742b58
Merge branch 'master' into issue/2647
oliverfoster Feb 20, 2020
fdf21c5
issue/2647 Converted AdaptModel to ES Class (#2652)
oliverfoster Mar 2, 2020
f836ea0
Removed sourcemap from backbone
oliverfoster Mar 2, 2020
d481ba2
Merge branch 'master' into issue/2647
oliverfoster Mar 4, 2020
8b1d902
Converted child models of AdaptModel to ES6 Class (#2674)
oliverfoster Mar 5, 2020
f241841
Made CourseModel inherit MenuModel rather than ContentObjectModel
oliverfoster Mar 5, 2020
4359725
Merge remote-tracking branch 'origin/master' into issue/2647
oliverfoster Mar 9, 2020
0c70dcf
issue/2678 Added Adpt.log.removed and Adapt.log.deprecated
oliverfoster Mar 9, 2020
94c4afe
Added config.json _warnFirstOnly: true
oliverfoster Mar 9, 2020
76a6ea2
Linting fixes
oliverfoster Mar 10, 2020
6d2e155
Merge remote-tracking branch 'origin/issue/2647' into issue/2678
oliverfoster Mar 10, 2020
cee5d7a
Linting fixes
oliverfoster Mar 10, 2020
d79024b
issue/2677 Exposed router controller at Adapt.router, converted to ES…
oliverfoster Mar 11, 2020
e3f0f05
issue/2678 Added Adapt.log.removed and Adapt.log.deprecated
oliverfoster Mar 11, 2020
0fca307
Merge branch 'master' into issue/2647
oliverfoster Mar 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions grunt/config/babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
options: {
sourceMap: true,
inputSourceMap: true,
sourceType: 'script',
minified: true,
comments: false,
presets: [
[
'@babel/preset-env',
{
"targets": {
"ie": "11"
}
}
]
]
},
dist: {
files: [{
"expand": true,
"cwd": "<%= tempdir %>",
"src": [
"adapt.min.js"
],
"dest": "<%= outputdir %>adapt/js/",
"ext": ".min.js"
}]
}
};
5 changes: 5 additions & 0 deletions grunt/config/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@ module.exports = {
src: [
'<%= outputdir %>'
]
},
temp: {
src: [
'<%= tempdir %>'
]
}
};
9 changes: 3 additions & 6 deletions grunt/config/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function(grunt, options) {
name: 'core/js/app',
baseUrl: '<%= sourcedir %>',
mainConfigFile: './config.js',
out: '<%= outputdir %>adapt/js/adapt.min.js',
out: '<%= tempdir %>adapt.min.js',
// fetch these bower plugins an add them as dependencies to the app.js
plugins: [
'<%= sourcedir %>components/*/bower.json',
Expand Down Expand Up @@ -37,7 +37,7 @@ module.exports = function(grunt, options) {
name: 'core/js/app',
baseUrl: '<%= sourcedir %>',
mainConfigFile: './config.js',
out: '<%= outputdir %>adapt/js/adapt.min.js',
out: '<%= tempdir %>adapt.min.js',
// fetch these bower plugins an add them as dependencies to the app.js
plugins: [
'<%= sourcedir %>components/*/bower.json',
Expand All @@ -51,10 +51,7 @@ module.exports = function(grunt, options) {
return grunt.config('helpers').includedFilter(filepath);
},
preserveLicenseComments: false,
optimize: 'uglify2',
uglify2: {
compress: false
}
optimize: 'none'
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion grunt/config/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
},
js: {
files: ['<%= sourcedir %>**/*.js'],
tasks: ['javascript:dev']
tasks: ['javascript:dev', 'babel', 'clean:temp']
},
componentsAssets: {
files: ['<%= sourcedir %>components/**/assets/**'],
Expand Down
2 changes: 2 additions & 0 deletions grunt/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ module.exports = function(grunt) {
var root = __dirname.split(path.sep).slice(0, -1).join(path.sep);
var sourcedir = appendSlash(grunt.option('sourcedir')) || exports.defaults.sourcedir;
var outputdir = appendSlash(grunt.option('outputdir')) || exports.defaults.outputdir;
var tempdir = outputdir + '.temp/';
var jsonext = grunt.option('jsonext') || exports.defaults.jsonext;

var languageFolders = '';
Expand All @@ -210,6 +211,7 @@ module.exports = function(grunt) {
root: root,
sourcedir: sourcedir,
outputdir: outputdir,
tempdir: tempdir,
jsonext: jsonext,
theme: grunt.option('theme') || exports.defaults.theme,
menu: grunt.option('menu') || exports.defaults.menu,
Expand Down
2 changes: 2 additions & 0 deletions grunt/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ module.exports = function(grunt) {
'create-json-config',
'tracking-insert',
'javascript:compile',
'babel',
'clean:dist',
'less:compile',
'replace',
'scripts:adaptpostbuild',
'clean:temp',
'minify'
]);
};
2 changes: 2 additions & 0 deletions grunt/tasks/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ module.exports = function(grunt) {
'create-json-config',
'tracking-insert',
'javascript:dev',
'babel',
'less:dev',
'replace',
'scripts:adaptpostbuild',
'clean:temp',
'watch'
]);
};
4 changes: 3 additions & 1 deletion grunt/tasks/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ module.exports = function(grunt) {
'create-json-config',
'tracking-insert',
'newer:javascript:dev',
'babel',
'newer:less:dev',
'replace',
'scripts:adaptpostbuild'
'scripts:adaptpostbuild',
'clean:temp'
]);
};
4 changes: 3 additions & 1 deletion grunt/tasks/server-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ module.exports = function(grunt) {
'less:' + requireMode,
'handlebars',
'javascript:' + requireMode,
'babel',
'replace',
'scripts:adaptpostbuild'
'scripts:adaptpostbuild',
'clean:temp'
]);
});
};
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@
"url": "https://github.com/adaptlearning/adapt_framework/issues"
},
"dependencies": {
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.8.4",
"@types/backbone": "^1.4.1",
"@types/jquery": "^3.3.31",
"async": "^2.6.1",
"chalk": "^2.4.1",
"columnify": "^1.5.4",
"csv": "^5.0.0",
"grunt": "^1.0.3",
"grunt-babel": "^8.0.0",
"grunt-concurrent": "^2.3.1",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-connect": "^2.0.0",
Expand All @@ -36,8 +41,6 @@
"jit-grunt": "^0.10.0",
"jschardet": "^1.6.0",
"jshint-stylish": "^2.2.1",
"@types/jquery": "^3.3.31",
"@types/backbone": "^1.4.1",
"less": "^3.9.0",
"load-grunt-config": "^1.0.1",
"nsdeclare": "^0.1.0",
Expand Down
3 changes: 3 additions & 0 deletions src/core/libraries/backbone.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ define("backbone.controller", [

var Controller = Backbone.Controller = function(options) {
options || (options = {});
this.preinitialize.apply(this, arguments);
_.extend(this, _.pick(options, controllerOptions));
this.initialize.apply(this, arguments);
};
Expand All @@ -18,6 +19,8 @@ define("backbone.controller", [

_.extend(Controller.prototype, Backbone.Events, {

preinitialize: function() {},

initialize: function() {}

});
Expand Down
5 changes: 3 additions & 2 deletions src/core/libraries/backbone.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/core/libraries/polyfill.min.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/core/libraries/promise-polyfill.min.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/core/required/adapt/js/scriptLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
}
},
paths: {
promise: 'libraries/promise-polyfill.min',
polyfill: 'libraries/polyfill.min',
jquery: 'libraries/jquery.min',
underscore: 'libraries/underscore.min',
'underscore.results': 'libraries/underscore.results',
Expand Down Expand Up @@ -108,7 +108,7 @@
function loadFoundationLibraries() {
require([
'handlebars',
'promise',
'polyfill',
'underscore',
'underscore.results',
'backbone',
Expand Down