Skip to content

Commit

Permalink
RELEASE v0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
taylortom authored Oct 17, 2022
2 parents 7ccd991 + d04bdef commit 15888f3
Show file tree
Hide file tree
Showing 65 changed files with 16,597 additions and 5,429 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,38 @@ All notable changes to the Adapt authoring tool are documented in this file.
**IMPORTANT**: For information on how to **correctly and safely** update your installation, please consult **INSTALL.md**.<br/>
_Note that we adhere to the [semantic versioning](http://semver.org/) scheme for release numbering._

## [0.11.0] - 2022-10-17

The final minor release of the 'legacy' codebase. This release bundles critical security updates with some other minor improvements.

**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.

***

**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`..

***

**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).**

### Fixed
- npm install scripts for adapt_framework should run as root ([#2566](https://github.com/adaptlearning/adapt_authoring/issues/2566))
- Update npm dependencies ([#2583](https://github.com/adaptlearning/adapt_authoring/issues/2583))
- RequireJS occasionally times out on very slow connections ([#2594](https://github.com/adaptlearning/adapt_authoring/issues/2594))
- Framework update doesn't update src/core ([#2628](https://github.com/adaptlearning/adapt_authoring/issues/2628))
- Export build error using latest framework release ([#2637](https://github.com/adaptlearning/adapt_authoring/issues/2637))
- Need to update browserslist DB on build to avoid errors ([#2639](https://github.com/adaptlearning/adapt_authoring/issues/2639))
- Fix migrations ([#2653](https://github.com/adaptlearning/adapt_authoring/issues/2653))

### Added
- Login email address should be case-insensitive ([#2060](https://github.com/adaptlearning/adapt_authoring/issues/2060))
- Update CKEditor ([#2575](https://github.com/adaptlearning/adapt_authoring/issues/2575))
- Remove global grunt dependency ([#2581](https://github.com/adaptlearning/adapt_authoring/issues/2581))
- Support --skipDependencyCheck during install process ([#2590](https://github.com/adaptlearning/adapt_authoring/issues/2590))
- We shouldn't require a full rebuild for exports ([#2602](https://github.com/adaptlearning/adapt_authoring/issues/2602))
- Add support for GitHub API tokens to avoid exceeding the unauthenticated rate limit ([#2642](https://github.com/adaptlearning/adapt_authoring/issues/2642))
- Add ES6 support ([#2643](https://github.com/adaptlearning/adapt_authoring/issues/2643))

## [0.10.5] - 2020-11-09

Bugfix release.
Expand Down Expand Up @@ -718,6 +750,7 @@ Initial release.
- Loading screen of death
- Session cookie security issues

[0.11.0]: https://github.com/adaptlearning/adapt_authoring/compare/v0.10.5...v0.11.0
[0.10.5]: https://github.com/adaptlearning/adapt_authoring/compare/v0.10.4...v0.10.5
[0.10.4]: https://github.com/adaptlearning/adapt_authoring/compare/v0.10.3...v0.10.4
[0.10.3]: https://github.com/adaptlearning/adapt_authoring/compare/v0.10.2...v0.10.3
Expand Down
29 changes: 25 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ module.exports = function(grunt) {
name: 'core/app',
mainConfigFile: "frontend/src/core/config.js",
out: "frontend/build/js/origin.js",
generateSourceMaps: true,
preserveLicenseComments: true,
optimize: "none"
}
Expand All @@ -119,10 +118,32 @@ module.exports = function(grunt) {
name: 'core/app',
mainConfigFile: "frontend/src/core/config.js",
out: "frontend/build/js/origin.js",
optimize: "uglify2"
optimize: "none"
}
}
},
babel: {
dev: {
options: {
compact: false,
retainLines: true,
presets: [ [ '@babel/preset-env', { targets: { ie: '11' } } ] ],
sourceType: 'script'
},
src: 'frontend/build/js/origin.js',
dest: 'frontend/build/js/origin.js'
},
compile: {
options: {
comments: false,
minified: true,
presets: [ [ '@babel/preset-env', { targets: { ie: '11' } } ] ],
sourceType: 'script'
},
src: 'frontend/build/js/origin.js',
dest: 'frontend/build/js/origin.js'
}
},
mochaTest: {
src: ['test/*.js'],
options: {
Expand Down Expand Up @@ -315,10 +336,10 @@ module.exports = function(grunt) {
config.isProduction = isProduction;
grunt.file.write(configFile, JSON.stringify(config, null, 2));
// run the task
grunt.task.run(['migration-conf', 'requireBundle', 'generate-lang-json', 'copy', 'less:' + compilation, 'handlebars', 'requirejs:'+ compilation]);
grunt.task.run(['migration-conf', 'requireBundle', 'generate-lang-json', 'copy', 'less:' + compilation, 'handlebars', 'requirejs:'+ compilation, `babel:${compilation}`]);

} catch(e) {
grunt.task.run(['requireBundle', 'copy', 'less:' + compilation, 'handlebars', 'requirejs:' + compilation]);
grunt.task.run(['requireBundle', 'copy', 'less:' + compilation, 'handlebars', 'requirejs:' + compilation, `babel:${compilation}`]);
}
});
};
6 changes: 6 additions & 0 deletions conf/migrations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
migrationsDir: "migrations",
changelogCollectionName: "changelog",
migrationFileExtension: ".js",
useFileHash: false
};
1 change: 1 addition & 0 deletions frontend/src/core/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'jqueryForm',
'jqueryTagsInput',
'jqueryUI',
'polyfill',
'scrollTo',
'selectize',
'sweetalert',
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require.config({
modernizr: 'libraries/modernizr',
moment: 'libraries/moment.min',
pikaday: 'libraries/pikaday/js/pikaday',
polyfill: 'libraries/polyfill.min',
polyglot: 'libraries/polyglot.min',
scrollTo: 'libraries/scrollTo',
selectize: 'libraries/selectize/js/selectize',
Expand Down Expand Up @@ -90,5 +91,6 @@ require.config({
'templates/templates': {
deps:['handlebars']
}
}
},
waitSeconds: 0
});
1 change: 1 addition & 0 deletions frontend/src/libraries/polyfill.min.js

Large diffs are not rendered by default.

18 changes: 3 additions & 15 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,13 @@ function start() {
createMasterTenant,
createSuperUser,
buildFrontend,
syncMigrations
installHelpers.runMigrations
], function(error, results) {
if(error) {
console.error('ERROR: ', error);
return exit(1, 'Install was unsuccessful. Please check the console output.');
}
exit(0, `Installation completed successfully, the application can now be started with 'node server'.`);
exit(0, `Installation completed, the application can now be started with 'node server'.`);
});
});
}
Expand Down Expand Up @@ -511,24 +511,12 @@ function createSuperUser(callback) {
function buildFrontend(callback) {
installHelpers.buildAuthoring(function(error) {
if(error) {
return callback(`Failed to build the web application, (${error}) \nInstall will continue. Try again after installation completes using 'grunt build:prod'.`);
console.log(chalk.yellow(`Failed to build the web application, (${error}) \nInstall will continue. Try again after installation completes using 'grunt build:prod'.`));
}
callback();
});
}

//As this is a fresh install we dont need to run the migrations so add them to the db and set them to up
function syncMigrations(callback) {
installHelpers.syncMigrations(function(err, migrations) {
database.getDatabase(function(err, db) {
if(err) {
return callback(err);
}
db.update('migration', {}, {'state': 'up'}, callback)
}, masterTenant._id)
});
}

// helper functions

function addConfig(newConfigItems) {
Expand Down
50 changes: 29 additions & 21 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ const async = require('async');
const auth = require('./auth');
const chalk = require('chalk');
const configuration = require('./configuration');
const database = require('./database');
const domain = require('domain');
const EventEmitter = require('events').EventEmitter;
const exec = require('child_process').exec;
const express = require('express');
const frameworkhelper = require('./frameworkhelper');
const fs = require('fs');
const installHelpers = require('./installHelpers');
const logger = require('./logger');
Expand All @@ -22,14 +19,11 @@ const permissions = require('./permissions');
const pluginmanager = require('./pluginmanager');
const polyglot = require('node-polyglot');
const router = require('./router');
const semver = require('semver');
const usermanager = require('./usermanager');
const util = require('util');
// Express middleware
const bodyParser = require('body-parser');
const compression = require('compression');
const cookieParser = require('cookie-parser');
const errorHandler = require('errorhandler');
const favicon = require('serve-favicon');
const methodOverride = require('method-override');
const morgan = require('morgan');
Expand Down Expand Up @@ -233,6 +227,7 @@ Origin.prototype.clientErrorHandler = function () {
error.stack = err.stack;
}
res.statusCode = err.statusCode || 500;
console.log(error);
return res.json(error);
};
};
Expand Down Expand Up @@ -289,7 +284,9 @@ Origin.prototype.createServer = function (options, cb) {
requestDomain.add(res);
requestDomain.session = req.session;
requestDomain.on('error', next);
requestDomain.run(next);
requestDomain.enter();
// requestDomain.run(next());
next();
});
server.use(auth.initialize());
server.use(auth.session());
Expand All @@ -299,6 +296,9 @@ Origin.prototype.createServer = function (options, cb) {
server.use(express.static(path.join(app.configuration.serverRoot, 'frontend', 'src')));
}
server.use(permissions.policyChecker());
server.use((req, res, next) => {
next();
});

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

options = { ...{
skipDependencyCheck: false,
options = {
skipVersionCheck: false,
skipStartLog: false
}, ...options };

skipStartLog: false,
...options
};
checkPrerequisites(options, function(err, result) {
if(err) {
logger.log('error', chalk.red(err.message));
Expand Down Expand Up @@ -365,9 +364,10 @@ Origin.prototype.startServer = function (options) {
app.router = router(app);
// handle different server states
app.emit(serverOptions.minimal ? "minimalServerStarted" : "serverStarted", app.server);
if(!options.skipStartLog) {
logger.log('info', `Server started listening on port ${port}`);
}

runMigrations().then(() => {
if(!options.skipStartLog) logger.log('info', `Server started listening on port ${port}`);
});
var writeRebuildFile = function(courseFolder, callback) {
var OutputConstants = require('./outputmanager').Constants;
var buildFolder = path.join(courseFolder, OutputConstants.Folders.Build);
Expand Down Expand Up @@ -399,6 +399,19 @@ Origin.prototype.startServer = function (options) {
});
};

async function runMigrations() {
try {
const collections = await app.db.conn.db.collections();
if(!collections.find(c => c.collectionName === 'changelog')) {
logger.log('info', 'Need to run migrations. This is a one-time task.');
await installHelpers.runMigrations();
logger.log('info', 'Migrations run successfully');
}
} catch(e) {
logger.log('error', e);
}
}

Origin.prototype.restartServer = function () {
var app = this;
if (app._httpServer) {
Expand Down Expand Up @@ -518,12 +531,7 @@ Origin.prototype.ModulePreloader.defOpts = {

function checkPrerequisites(options, callback) {
async.series([
function(cb) {
if(options.skipDependencyCheck) {
return cb();
}
installHelpers.checkAllDependencies(cb);
},
installHelpers.checkAllDependencies,
function(cb) {
if(configuration.getConfig('isTestEnvironment') || options.skipVersionCheck) {
return cb();
Expand Down
Loading

0 comments on commit 15888f3

Please sign in to comment.