Skip to content

Commit 15888f3

Browse files
authored
RELEASE v0.11.0
2 parents 7ccd991 + d04bdef commit 15888f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+16597
-5429
lines changed

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,38 @@ All notable changes to the Adapt authoring tool are documented in this file.
55
**IMPORTANT**: For information on how to **correctly and safely** update your installation, please consult **INSTALL.md**.<br/>
66
_Note that we adhere to the [semantic versioning](http://semver.org/) scheme for release numbering._
77

8+
## [0.11.0] - 2022-10-17
9+
10+
The final minor release of the 'legacy' codebase. This release bundles critical security updates with some other minor improvements.
11+
12+
**Breaking:** the requirement for a global install of grunt has been removed, and therefore the front-end application must now be built using npx (`npx grunt xxx`). See the wiki for more information.
13+
14+
***
15+
16+
**IMPORTANT NOTE:** an error message will be shown at the end of the upgrade process. This is related to a deprecated module used to apply data migrations between updates which has now been removed. **The error can be safely ignored**, and all migrations will be run automatically as a one-time fix once the app is started post-upgrade with with `node server`..
17+
18+
***
19+
20+
**Please note that this repository will receive no more major updates and will be archived once the new codebase reaches a stable v1.0.0 (and after a grace period to allow existing users to migrate).**
21+
22+
### Fixed
23+
- npm install scripts for adapt_framework should run as root ([#2566](https://github.com/adaptlearning/adapt_authoring/issues/2566))
24+
- Update npm dependencies ([#2583](https://github.com/adaptlearning/adapt_authoring/issues/2583))
25+
- RequireJS occasionally times out on very slow connections ([#2594](https://github.com/adaptlearning/adapt_authoring/issues/2594))
26+
- Framework update doesn't update src/core ([#2628](https://github.com/adaptlearning/adapt_authoring/issues/2628))
27+
- Export build error using latest framework release ([#2637](https://github.com/adaptlearning/adapt_authoring/issues/2637))
28+
- Need to update browserslist DB on build to avoid errors ([#2639](https://github.com/adaptlearning/adapt_authoring/issues/2639))
29+
- Fix migrations ([#2653](https://github.com/adaptlearning/adapt_authoring/issues/2653))
30+
31+
### Added
32+
- Login email address should be case-insensitive ([#2060](https://github.com/adaptlearning/adapt_authoring/issues/2060))
33+
- Update CKEditor ([#2575](https://github.com/adaptlearning/adapt_authoring/issues/2575))
34+
- Remove global grunt dependency ([#2581](https://github.com/adaptlearning/adapt_authoring/issues/2581))
35+
- Support --skipDependencyCheck during install process ([#2590](https://github.com/adaptlearning/adapt_authoring/issues/2590))
36+
- We shouldn't require a full rebuild for exports ([#2602](https://github.com/adaptlearning/adapt_authoring/issues/2602))
37+
- Add support for GitHub API tokens to avoid exceeding the unauthenticated rate limit ([#2642](https://github.com/adaptlearning/adapt_authoring/issues/2642))
38+
- Add ES6 support ([#2643](https://github.com/adaptlearning/adapt_authoring/issues/2643))
39+
840
## [0.10.5] - 2020-11-09
941

1042
Bugfix release.
@@ -718,6 +750,7 @@ Initial release.
718750
- Loading screen of death
719751
- Session cookie security issues
720752

753+
[0.11.0]: https://github.com/adaptlearning/adapt_authoring/compare/v0.10.5...v0.11.0
721754
[0.10.5]: https://github.com/adaptlearning/adapt_authoring/compare/v0.10.4...v0.10.5
722755
[0.10.4]: https://github.com/adaptlearning/adapt_authoring/compare/v0.10.3...v0.10.4
723756
[0.10.3]: https://github.com/adaptlearning/adapt_authoring/compare/v0.10.2...v0.10.3

Gruntfile.js

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ module.exports = function(grunt) {
108108
name: 'core/app',
109109
mainConfigFile: "frontend/src/core/config.js",
110110
out: "frontend/build/js/origin.js",
111-
generateSourceMaps: true,
112111
preserveLicenseComments: true,
113112
optimize: "none"
114113
}
@@ -119,10 +118,32 @@ module.exports = function(grunt) {
119118
name: 'core/app',
120119
mainConfigFile: "frontend/src/core/config.js",
121120
out: "frontend/build/js/origin.js",
122-
optimize: "uglify2"
121+
optimize: "none"
123122
}
124123
}
125124
},
125+
babel: {
126+
dev: {
127+
options: {
128+
compact: false,
129+
retainLines: true,
130+
presets: [ [ '@babel/preset-env', { targets: { ie: '11' } } ] ],
131+
sourceType: 'script'
132+
},
133+
src: 'frontend/build/js/origin.js',
134+
dest: 'frontend/build/js/origin.js'
135+
},
136+
compile: {
137+
options: {
138+
comments: false,
139+
minified: true,
140+
presets: [ [ '@babel/preset-env', { targets: { ie: '11' } } ] ],
141+
sourceType: 'script'
142+
},
143+
src: 'frontend/build/js/origin.js',
144+
dest: 'frontend/build/js/origin.js'
145+
}
146+
},
126147
mochaTest: {
127148
src: ['test/*.js'],
128149
options: {
@@ -315,10 +336,10 @@ module.exports = function(grunt) {
315336
config.isProduction = isProduction;
316337
grunt.file.write(configFile, JSON.stringify(config, null, 2));
317338
// run the task
318-
grunt.task.run(['migration-conf', 'requireBundle', 'generate-lang-json', 'copy', 'less:' + compilation, 'handlebars', 'requirejs:'+ compilation]);
339+
grunt.task.run(['migration-conf', 'requireBundle', 'generate-lang-json', 'copy', 'less:' + compilation, 'handlebars', 'requirejs:'+ compilation, `babel:${compilation}`]);
319340

320341
} catch(e) {
321-
grunt.task.run(['requireBundle', 'copy', 'less:' + compilation, 'handlebars', 'requirejs:' + compilation]);
342+
grunt.task.run(['requireBundle', 'copy', 'less:' + compilation, 'handlebars', 'requirejs:' + compilation, `babel:${compilation}`]);
322343
}
323344
});
324345
};

conf/migrations.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
migrationsDir: "migrations",
3+
changelogCollectionName: "changelog",
4+
migrationFileExtension: ".js",
5+
useFileHash: false
6+
};

frontend/src/core/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
'jqueryForm',
1212
'jqueryTagsInput',
1313
'jqueryUI',
14+
'polyfill',
1415
'scrollTo',
1516
'selectize',
1617
'sweetalert',

frontend/src/core/config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ require.config({
1515
modernizr: 'libraries/modernizr',
1616
moment: 'libraries/moment.min',
1717
pikaday: 'libraries/pikaday/js/pikaday',
18+
polyfill: 'libraries/polyfill.min',
1819
polyglot: 'libraries/polyglot.min',
1920
scrollTo: 'libraries/scrollTo',
2021
selectize: 'libraries/selectize/js/selectize',
@@ -90,5 +91,6 @@ require.config({
9091
'templates/templates': {
9192
deps:['handlebars']
9293
}
93-
}
94+
},
95+
waitSeconds: 0
9496
});

frontend/src/libraries/polyfill.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,13 @@ function start() {
316316
createMasterTenant,
317317
createSuperUser,
318318
buildFrontend,
319-
syncMigrations
319+
installHelpers.runMigrations
320320
], function(error, results) {
321321
if(error) {
322322
console.error('ERROR: ', error);
323323
return exit(1, 'Install was unsuccessful. Please check the console output.');
324324
}
325-
exit(0, `Installation completed successfully, the application can now be started with 'node server'.`);
325+
exit(0, `Installation completed, the application can now be started with 'node server'.`);
326326
});
327327
});
328328
}
@@ -511,24 +511,12 @@ function createSuperUser(callback) {
511511
function buildFrontend(callback) {
512512
installHelpers.buildAuthoring(function(error) {
513513
if(error) {
514-
return callback(`Failed to build the web application, (${error}) \nInstall will continue. Try again after installation completes using 'grunt build:prod'.`);
514+
console.log(chalk.yellow(`Failed to build the web application, (${error}) \nInstall will continue. Try again after installation completes using 'grunt build:prod'.`));
515515
}
516516
callback();
517517
});
518518
}
519519

520-
//As this is a fresh install we dont need to run the migrations so add them to the db and set them to up
521-
function syncMigrations(callback) {
522-
installHelpers.syncMigrations(function(err, migrations) {
523-
database.getDatabase(function(err, db) {
524-
if(err) {
525-
return callback(err);
526-
}
527-
db.update('migration', {}, {'state': 'up'}, callback)
528-
}, masterTenant._id)
529-
});
530-
}
531-
532520
// helper functions
533521

534522
function addConfig(newConfigItems) {

lib/application.js

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ const async = require('async');
77
const auth = require('./auth');
88
const chalk = require('chalk');
99
const configuration = require('./configuration');
10-
const database = require('./database');
1110
const domain = require('domain');
1211
const EventEmitter = require('events').EventEmitter;
13-
const exec = require('child_process').exec;
1412
const express = require('express');
15-
const frameworkhelper = require('./frameworkhelper');
1613
const fs = require('fs');
1714
const installHelpers = require('./installHelpers');
1815
const logger = require('./logger');
@@ -22,14 +19,11 @@ const permissions = require('./permissions');
2219
const pluginmanager = require('./pluginmanager');
2320
const polyglot = require('node-polyglot');
2421
const router = require('./router');
25-
const semver = require('semver');
26-
const usermanager = require('./usermanager');
2722
const util = require('util');
2823
// Express middleware
2924
const bodyParser = require('body-parser');
3025
const compression = require('compression');
3126
const cookieParser = require('cookie-parser');
32-
const errorHandler = require('errorhandler');
3327
const favicon = require('serve-favicon');
3428
const methodOverride = require('method-override');
3529
const morgan = require('morgan');
@@ -233,6 +227,7 @@ Origin.prototype.clientErrorHandler = function () {
233227
error.stack = err.stack;
234228
}
235229
res.statusCode = err.statusCode || 500;
230+
console.log(error);
236231
return res.json(error);
237232
};
238233
};
@@ -289,7 +284,9 @@ Origin.prototype.createServer = function (options, cb) {
289284
requestDomain.add(res);
290285
requestDomain.session = req.session;
291286
requestDomain.on('error', next);
292-
requestDomain.run(next);
287+
requestDomain.enter();
288+
// requestDomain.run(next());
289+
next();
293290
});
294291
server.use(auth.initialize());
295292
server.use(auth.session());
@@ -299,6 +296,9 @@ Origin.prototype.createServer = function (options, cb) {
299296
server.use(express.static(path.join(app.configuration.serverRoot, 'frontend', 'src')));
300297
}
301298
server.use(permissions.policyChecker());
299+
server.use((req, res, next) => {
300+
next();
301+
});
302302

303303
// loop through the plugins for middleware
304304
var pluginManager = pluginmanager.getManager();
@@ -329,12 +329,11 @@ Origin.prototype.createServer = function (options, cb) {
329329
Origin.prototype.startServer = function (options) {
330330
var app = this;
331331

332-
options = { ...{
333-
skipDependencyCheck: false,
332+
options = {
334333
skipVersionCheck: false,
335-
skipStartLog: false
336-
}, ...options };
337-
334+
skipStartLog: false,
335+
...options
336+
};
338337
checkPrerequisites(options, function(err, result) {
339338
if(err) {
340339
logger.log('error', chalk.red(err.message));
@@ -365,9 +364,10 @@ Origin.prototype.startServer = function (options) {
365364
app.router = router(app);
366365
// handle different server states
367366
app.emit(serverOptions.minimal ? "minimalServerStarted" : "serverStarted", app.server);
368-
if(!options.skipStartLog) {
369-
logger.log('info', `Server started listening on port ${port}`);
370-
}
367+
368+
runMigrations().then(() => {
369+
if(!options.skipStartLog) logger.log('info', `Server started listening on port ${port}`);
370+
});
371371
var writeRebuildFile = function(courseFolder, callback) {
372372
var OutputConstants = require('./outputmanager').Constants;
373373
var buildFolder = path.join(courseFolder, OutputConstants.Folders.Build);
@@ -399,6 +399,19 @@ Origin.prototype.startServer = function (options) {
399399
});
400400
};
401401

402+
async function runMigrations() {
403+
try {
404+
const collections = await app.db.conn.db.collections();
405+
if(!collections.find(c => c.collectionName === 'changelog')) {
406+
logger.log('info', 'Need to run migrations. This is a one-time task.');
407+
await installHelpers.runMigrations();
408+
logger.log('info', 'Migrations run successfully');
409+
}
410+
} catch(e) {
411+
logger.log('error', e);
412+
}
413+
}
414+
402415
Origin.prototype.restartServer = function () {
403416
var app = this;
404417
if (app._httpServer) {
@@ -518,12 +531,7 @@ Origin.prototype.ModulePreloader.defOpts = {
518531

519532
function checkPrerequisites(options, callback) {
520533
async.series([
521-
function(cb) {
522-
if(options.skipDependencyCheck) {
523-
return cb();
524-
}
525-
installHelpers.checkAllDependencies(cb);
526-
},
534+
installHelpers.checkAllDependencies,
527535
function(cb) {
528536
if(configuration.getConfig('isTestEnvironment') || options.skipVersionCheck) {
529537
return cb();

0 commit comments

Comments
 (0)