Skip to content

Commit aa3cd1d

Browse files
Merge pull request #2525 from adaptlearning/issue/2510
Remove build includes after build
2 parents a8fd934 + 3c034b5 commit aa3cd1d

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

lib/outputmanager.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,6 @@ OutputPlugin.prototype.sanitizeCourseJSON = function(mode, json, next) {
266266

267267
async.waterfall([
268268
function(callback) {
269-
if (mode === Constants.Modes.Export) {
270-
return callback();
271-
}
272269
self.generateIncludesForConfig(configJson, function(error, includes) {
273270
if (error) {
274271
return callback(error);
@@ -926,6 +923,18 @@ OutputPlugin.prototype.applyMenu = function(tenantId, courseId, jsonObject, dest
926923
}
927924
};
928925

926+
OutputPlugin.prototype.removeBuildIncludes = async (configPath, next) => {
927+
try {
928+
const config = await fs.readJson(configPath);
929+
await fs.writeJson(configPath, config, { spaces: 2, replacer: (key, value) => {
930+
if (key !== 'build') return value;
931+
}});
932+
next(null);
933+
} catch (err) {
934+
next(err);
935+
}
936+
}
937+
929938
/**
930939
* extending plugins must implement this
931940
*

plugins/output/adapt/publish.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ function publishCourse(courseId, mode, request, response, next) {
223223
callback(null);
224224
});
225225
},
226+
function(callback) {
227+
const configPath = path.join(BUILD_FOLDER, Constants.Folders.Course, Constants.CourseCollections.config.filename);
228+
self.removeBuildIncludes(configPath, err => callback(err));
229+
},
226230
function(callback) {
227231
if (mode === Constants.Modes.Preview) { // No download required -- skip this step
228232
return callback();

0 commit comments

Comments
 (0)