Comparing version 0.0.1 to 0.0.2
module.exports = { | ||
featureName: "Feature 1", | ||
buildTimeEnabled: false, | ||
featureName: 'Feature 1', | ||
buildTimeEnabled: true, | ||
jsFiles: [ | ||
"feature1.js" | ||
'feature1.js', | ||
], | ||
vendorFiles: [], | ||
scssFiles: [ | ||
"_feature1.scss" | ||
] | ||
'_feature1.scss', | ||
], | ||
}; |
module.exports = { | ||
featureName: "Feature 2", | ||
featureName: 'Feature 2', | ||
buildTimeEnabled: true, | ||
jsFiles: [ | ||
"feature2.js" | ||
'feature2.js', | ||
], | ||
vendorFiles: [], | ||
scssFiles: [ | ||
"_feature2.scss" | ||
] | ||
'_feature2.scss', | ||
], | ||
}; |
@@ -11,3 +11,3 @@ module.exports = function(grunt) { | ||
// Default task | ||
grunt.registerTask('default', ['babel']); | ||
grunt.registerTask('default', ['babel', 'watch']); | ||
}; |
@@ -7,2 +7,9 @@ 'use strict'; | ||
const features = { | ||
/** | ||
* Return the boolean value or execute the function that defines if this feature is enabled or not. | ||
* | ||
* @param {Boolean || Function} buildTimeEnabled - data from the config file that indicates enabled status | ||
* @return {Boolean} - `true` if enabled | ||
*/ | ||
isBuildTimeEnabled: function(buildTimeEnabled) { | ||
@@ -16,6 +23,18 @@ if (typeof buildTimeEnabled === 'function') { | ||
buildFeatureExclusions: function() { | ||
/** | ||
* Build a list of files to include and a list of files to exclude | ||
* | ||
* @return {Object} `{ inclusions: {}, exclusions: {} }` | ||
*/ | ||
buildFeatureLists: function() { | ||
var inclusions; | ||
var exclusions; | ||
var files; | ||
inclusions = { | ||
js: [], | ||
vendor: [], | ||
scss: [], | ||
}; | ||
exclusions = { | ||
@@ -36,2 +55,3 @@ js: [], | ||
data.jsFiles.forEach(function(file) { | ||
inclusions.js.push('../js/' + file); | ||
exclusions.js.push('!../js/' + file); | ||
@@ -43,2 +63,3 @@ }); | ||
data.vendorFiles.forEach(function(file) { | ||
inclusions.vendor.push('../js/' + file); | ||
exclusions.vendor.push('!../js/' + file); | ||
@@ -50,2 +71,3 @@ }); | ||
data.scssFiles.forEach(function(file) { | ||
inclusions.scss.push('../scss/' + file); | ||
exclusions.scss.push('!../scss/' + file); | ||
@@ -57,5 +79,13 @@ }); | ||
return exclusions; | ||
return { | ||
inclusions, | ||
exclusions, | ||
}; | ||
}, | ||
/** | ||
* Get a list of all of the declared features, teir states, and file lists | ||
* | ||
* @return {Object} Combined feature configs | ||
*/ | ||
getList: function() { | ||
@@ -75,2 +105,7 @@ var files = fs.readdirSync(featureDir); | ||
/** | ||
* Build a key:value list of features and their enabled states | ||
* | ||
* @return {Object} key: value pairs | ||
*/ | ||
enabledList: function() { | ||
@@ -77,0 +112,0 @@ var files = fs.readdirSync(featureDir); |
{ | ||
"name": "featurama", | ||
"version": "0.0.1", | ||
"description": "Disable features based on config files.", | ||
"version": "0.0.2", | ||
"description": "Enable/Disable features via JS config files.", | ||
"main": "dist/featurama.js", | ||
@@ -11,3 +11,3 @@ "scripts": { | ||
"type": "git", | ||
"url": "https://github.com/sparkbox/featureFlags" | ||
"url": "https://github.com/sparkbox/featurama" | ||
}, | ||
@@ -28,4 +28,5 @@ "keywords": [ | ||
"grunt-babel": "^5.0.1", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"lodash": "^3.10.1" | ||
} | ||
} |
@@ -1,2 +0,3 @@ | ||
# Feature Flags | ||
# Featurama | ||
![Chaos](http://i.giphy.com/yEXPAGIytvqNy.gif) | ||
@@ -3,0 +4,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14970
22
262
7
4
1