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

add the custom-init-config partial #903

Merged
merged 4 commits into from
Aug 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions hbshelpers/shallowMergeConfig.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* This helper merges JSON objects into a single config.
*
* @param {...Object} Either an array of JSON objects, or a single JSON object.
* @param {import('handlebars').HelperOptions} options
* @returns {string} The JSON formatted combined config.
*/
module.exports = function shallowMergeConfig(...options) {
const parsedData = JSON.parse(options[options.length - 1].fn(this));
module.exports = function shallowMergeConfig(options) {
const parsedData = JSON.parse(options.fn(this));
let stringFormat;
if (Array.isArray(parsedData)) {
stringFormat = JSON.stringify(Object.assign({}, ...parsedData));
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
"testMatch": [
"<rootDir>/tests/**/*.js"
],
"modulePathIgnorePatterns": [
"/test-site/"
],
"testPathIgnorePatterns": [
"/fixtures/",
"/test-utils/",
Expand Down
4 changes: 4 additions & 0 deletions script/additional-answers-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// This file expects a JS object literal.
{

}
1 change: 1 addition & 0 deletions script/core.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
}));
}
},
...{{> script/additional-answers-config }},
onReady: () => {
window.AnswersExperience.AnswersInitializedPromise.resolve();

Expand Down