@carbon/feature-flags 0.3.0-rc.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/index.js CHANGED
@@ -28,6 +28,16 @@ try {
28
28
  enabled$1.enableUseControlledStateWithValue = false;
29
29
  }
30
30
 
31
+ if (process.env.CARBON_ENABLE_CSS_GRID) {
32
+ if (process.env.CARBON_ENABLE_CSS_GRID === 'true') {
33
+ enabled$1.enableCssGrid = true;
34
+ } else {
35
+ enabled$1.enableCssGrid = false;
36
+ }
37
+ } else {
38
+ enabled$1.enableCssGrid = false;
39
+ }
40
+
31
41
  if (process.env.CARBON_ENABLE_2021_RELEASE) {
32
42
  if (process.env.CARBON_ENABLE_2021_RELEASE === 'true') {
33
43
  enabled$1.enable_2021Release = true;
@@ -40,6 +50,7 @@ try {
40
50
  } catch (error) {
41
51
  enabled$1.enableCssCustomProperties = false;
42
52
  enabled$1.enableUseControlledStateWithValue = false;
53
+ enabled$1.enableCssGrid = false;
43
54
  enabled$1.enable_2021Release = false;
44
55
  }
45
56
 
@@ -51,6 +62,10 @@ const featureFlagInfo = [{
51
62
  name: "enable-use-controlled-state-with-value",
52
63
  description: "Enable components to be created in either a controlled or uncontrolled mode\n",
53
64
  enabled: enabled$1.enableUseControlledStateWithValue
65
+ }, {
66
+ name: "enable-css-grid",
67
+ description: "Enable CSS Grid Layout in the Grid and Column React components\n",
68
+ enabled: enabled$1.enableCssGrid
54
69
  }, {
55
70
  name: "enable-2021-release",
56
71
  description: "Enable the features and functionality for the 2021 Release\n",
package/lib/index.js CHANGED
@@ -32,6 +32,16 @@ try {
32
32
  enabled$1.enableUseControlledStateWithValue = false;
33
33
  }
34
34
 
35
+ if (process.env.CARBON_ENABLE_CSS_GRID) {
36
+ if (process.env.CARBON_ENABLE_CSS_GRID === 'true') {
37
+ enabled$1.enableCssGrid = true;
38
+ } else {
39
+ enabled$1.enableCssGrid = false;
40
+ }
41
+ } else {
42
+ enabled$1.enableCssGrid = false;
43
+ }
44
+
35
45
  if (process.env.CARBON_ENABLE_2021_RELEASE) {
36
46
  if (process.env.CARBON_ENABLE_2021_RELEASE === 'true') {
37
47
  enabled$1.enable_2021Release = true;
@@ -44,6 +54,7 @@ try {
44
54
  } catch (error) {
45
55
  enabled$1.enableCssCustomProperties = false;
46
56
  enabled$1.enableUseControlledStateWithValue = false;
57
+ enabled$1.enableCssGrid = false;
47
58
  enabled$1.enable_2021Release = false;
48
59
  }
49
60
 
@@ -55,6 +66,10 @@ const featureFlagInfo = [{
55
66
  name: "enable-use-controlled-state-with-value",
56
67
  description: "Enable components to be created in either a controlled or uncontrolled mode\n",
57
68
  enabled: enabled$1.enableUseControlledStateWithValue
69
+ }, {
70
+ name: "enable-css-grid",
71
+ description: "Enable CSS Grid Layout in the Grid and Column React components\n",
72
+ enabled: enabled$1.enableCssGrid
58
73
  }, {
59
74
  name: "enable-2021-release",
60
75
  description: "Enable the features and functionality for the 2021 Release\n",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/feature-flags",
3
3
  "description": "Build with feature flags in Carbon",
4
- "version": "0.3.0-rc.0",
4
+ "version": "0.3.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -11,6 +11,12 @@
11
11
  "directory": "packages/feature-flags"
12
12
  },
13
13
  "bugs": "https://github.com/carbon-design-system/carbon/issues",
14
+ "files": [
15
+ "es",
16
+ "lib",
17
+ "scss",
18
+ "index.scss"
19
+ ],
14
20
  "keywords": [
15
21
  "ibm",
16
22
  "carbon",
@@ -39,5 +45,5 @@
39
45
  "rollup-plugin-strip-banner": "^2.0.0"
40
46
  },
41
47
  "sideEffects": false,
42
- "gitHead": "f82c66b394c5440333efee2bdcd8a85b2414b90c"
48
+ "gitHead": "05909da32a2ee6aa2fb1965eb57871ea77c81c0e"
43
49
  }
@@ -9,5 +9,6 @@
9
9
  $generated-feature-flags: (
10
10
  'enable-css-custom-properties': false,
11
11
  'enable-use-controlled-state-with-value': false,
12
+ 'enable-css-grid': false,
12
13
  'enable-2021-release': false,
13
14
  );
package/feature-flags.yml DELETED
@@ -1,20 +0,0 @@
1
- #
2
- # Copyright IBM Corp. 2015, 2020
3
- #
4
- # This source code is licensed under the Apache-2.0 license found in the
5
- # LICENSE file in the root directory of this source tree.
6
- #
7
-
8
- feature-flags:
9
- - name: enable-css-custom-properties
10
- description: Describe what the flag does
11
- enabled: false
12
- - name: enable-use-controlled-state-with-value
13
- description: >
14
- Enable components to be created in either a controlled or uncontrolled
15
- mode
16
- enabled: false
17
- - name: enable-2021-release
18
- description: >
19
- Enable the features and functionality for the 2021 Release
20
- enabled: false
package/rollup.config.js DELETED
@@ -1,48 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2015, 2020
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import path from 'path';
9
- import stripBanner from 'rollup-plugin-strip-banner';
10
-
11
- const BANNER = `/**
12
- * Copyright IBM Corp. 2015, 2020
13
- *
14
- * This source code is licensed under the Apache-2.0 license found in the
15
- * LICENSE file in the root directory of this source tree.
16
- */
17
- `;
18
-
19
- const baseConfig = {
20
- external: [],
21
- plugins: [
22
- stripBanner(),
23
- {
24
- renderChunk(code) {
25
- return `${BANNER}\n${code}`;
26
- },
27
- },
28
- ],
29
- };
30
-
31
- export default [
32
- {
33
- ...baseConfig,
34
- input: path.join(__dirname, './src/index.js'),
35
- output: {
36
- file: 'es/index.js',
37
- format: 'esm',
38
- },
39
- },
40
- {
41
- ...baseConfig,
42
- input: path.join(__dirname, './src/index.js'),
43
- output: {
44
- file: 'lib/index.js',
45
- format: 'commonjs',
46
- },
47
- },
48
- ];
@@ -1,93 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2015, 2020
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- export class FeatureFlagScope {
9
- constructor(flags) {
10
- this.flags = new Map();
11
-
12
- if (flags) {
13
- Object.keys(flags).forEach((key) => {
14
- this.flags.set(key, flags[key]);
15
- });
16
- }
17
- }
18
-
19
- /**
20
- * Check to see if a flag exists
21
- * @param {string} name
22
- */
23
- checkForFlag(name) {
24
- if (!this.flags.has(name)) {
25
- throw new Error(
26
- `Unable to find a feature flag with the name: \`${name}\``
27
- );
28
- }
29
- }
30
-
31
- /**
32
- * Add a feature flag
33
- * @param {string} name
34
- * @param {boolean} enabled
35
- */
36
- add(name, enabled) {
37
- if (this.flags.has(name)) {
38
- throw new Error(`The feature flag: ${name} already exists`);
39
- }
40
- this.flags.set(name, enabled);
41
- }
42
-
43
- /**
44
- * Enable a feature flag
45
- * @param {string} name
46
- */
47
- enable(name) {
48
- this.checkForFlag(name);
49
- this.flags.set(name, true);
50
- }
51
-
52
- /**
53
- * Disable a feature flag
54
- * @param {string} name
55
- */
56
- disable(name) {
57
- this.checkForFlag(name);
58
- this.flags.set(name, false);
59
- }
60
-
61
- /**
62
- * Merge the given feature flags with the current set of feature flags.
63
- * Duplicate keys will be set to the value in the given feature flags.
64
- * @param {object} flags
65
- */
66
- merge(flags) {
67
- Object.keys(flags).forEach((key) => {
68
- this.flags.set(key, flags[key]);
69
- });
70
- }
71
-
72
- /**
73
- * @param {FeatureFlagScope} scope
74
- */
75
- mergeWithScope(scope) {
76
- for (const [key, value] of scope.flags) {
77
- if (this.flags.has(key)) {
78
- continue;
79
- }
80
- this.flags.set(key, value);
81
- }
82
- }
83
-
84
- /**
85
- * Check if a feature flag is enabled
86
- * @param {string} name
87
- * @returns {boolean}
88
- */
89
- enabled(name) {
90
- this.checkForFlag(name);
91
- return this.flags.get(name);
92
- }
93
- }
@@ -1,59 +0,0 @@
1
- /**
2
- * Code generated by @carbon/feature-flags. DO NOT EDIT.
3
- *
4
- * Copyright IBM Corp. 2015, 2020
5
- *
6
- * This source code is licensed under the Apache-2.0 license found in the
7
- * LICENSE file in the root directory of this source tree.
8
- */
9
- const enabled = {};
10
-
11
- try {
12
- if (process.env.CARBON_ENABLE_CSS_CUSTOM_PROPERTIES) {
13
- if (process.env.CARBON_ENABLE_CSS_CUSTOM_PROPERTIES === 'true') {
14
- enabled.enableCssCustomProperties = true;
15
- } else {
16
- enabled.enableCssCustomProperties = false;
17
- }
18
- } else {
19
- enabled.enableCssCustomProperties = false;
20
- }
21
-
22
- if (process.env.CARBON_ENABLE_USE_CONTROLLED_STATE_WITH_VALUE) {
23
- if (process.env.CARBON_ENABLE_USE_CONTROLLED_STATE_WITH_VALUE === 'true') {
24
- enabled.enableUseControlledStateWithValue = true;
25
- } else {
26
- enabled.enableUseControlledStateWithValue = false;
27
- }
28
- } else {
29
- enabled.enableUseControlledStateWithValue = false;
30
- }
31
-
32
- if (process.env.CARBON_ENABLE_2021_RELEASE) {
33
- if (process.env.CARBON_ENABLE_2021_RELEASE === 'true') {
34
- enabled.enable_2021Release = true;
35
- } else {
36
- enabled.enable_2021Release = false;
37
- }
38
- } else {
39
- enabled.enable_2021Release = false;
40
- }
41
- } catch (error) {
42
- enabled.enableCssCustomProperties = false;
43
- enabled.enableUseControlledStateWithValue = false;
44
- enabled.enable_2021Release = false;
45
- }
46
-
47
- export const featureFlagInfo = [{
48
- name: "enable-css-custom-properties",
49
- description: "Describe what the flag does",
50
- enabled: enabled.enableCssCustomProperties
51
- }, {
52
- name: "enable-use-controlled-state-with-value",
53
- description: "Enable components to be created in either a controlled or uncontrolled mode\n",
54
- enabled: enabled.enableUseControlledStateWithValue
55
- }, {
56
- name: "enable-2021-release",
57
- description: "Enable the features and functionality for the 2021 Release\n",
58
- enabled: enabled.enable_2021Release
59
- }];
package/src/index.js DELETED
@@ -1,42 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2015, 2020
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import { featureFlagInfo } from './generated/feature-flags';
9
- import { FeatureFlagScope } from './FeatureFlagScope';
10
-
11
- const FeatureFlags = createScope();
12
-
13
- for (let i = 0; i < featureFlagInfo.length; i++) {
14
- const featureFlag = featureFlagInfo[i];
15
- FeatureFlags.add(featureFlag.name, featureFlag.enabled);
16
- }
17
-
18
- export { FeatureFlags };
19
-
20
- export function createScope(flags) {
21
- return new FeatureFlagScope(flags);
22
- }
23
-
24
- export function add(...args) {
25
- return FeatureFlags.add(...args);
26
- }
27
-
28
- export function enable(...args) {
29
- return FeatureFlags.enable(...args);
30
- }
31
-
32
- export function disable(...args) {
33
- return FeatureFlags.disable(...args);
34
- }
35
-
36
- export function enabled(...args) {
37
- return FeatureFlags.enabled(...args);
38
- }
39
-
40
- export function merge(...args) {
41
- return FeatureFlags.merge(...args);
42
- }