Skip to content
Open
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
2 changes: 2 additions & 0 deletions blueprints/flexi-config/files/config/flexi.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
'use strict';

module.exports = {
configVersion: '1.0.0',

// breakpoints, order does not matter, they will be sorted by `begin`
// `name` is used for layout names and booleans on the device/layout service
// `prefix` is used for column classes, column attributes, and container breakpoint classes
Expand Down
18 changes: 18 additions & 0 deletions lib/get-validated-flexi-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ module.exports = function(projectRoot) {
fs.existsSync(configPath));

let flexiConfig = require(configPath);
let actualVersion = flexiConfig.configVersion;
let expectedVersion = require(path.join(projectRoot,
'node_modules',
'@html-next',
'flexi-config',
'blueprints',
'flexi-config',
'files',
'config',
'flexi.js')).configVersion;

assert('config/flexi.js is defined, but could not be imported', flexiConfig);
assert('config/flexi.js is defined, but does not contain property [array] breakpoints,'
Expand All @@ -35,6 +45,14 @@ module.exports = function(projectRoot) {
assert('config/flexi.js is defined, but does not contain property [number] columns,'
+ ` consider running ${GENERATE_CONFIG_COMMAND} to see the default config file.`,
typeof flexiConfig.columns === 'number');
assert('config/flexi.js is defined, but does not contain property [string] configVersion,'
+ ` consider running ${GENERATE_CONFIG_COMMAND} to see the default config file.`,
actualVersion);
assert(`config/flexi.js version does not match the latest config file. Got '${actualVersion}',`
+ ` expected '${expectedVersion}'. Consider running ${GENERATE_CONFIG_COMMAND} to see`
+ ' what your config file is missing, then update the version number to match.',
actualVersion === expectedVersion);

return flexiConfig;
};