@webiny/feature-flags 6.0.0-alpha.5 β†’ 6.0.0-rc.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/README.md CHANGED
@@ -1,97 +1,11 @@
1
- # `@webiny/feature-flags`
2
- [![](https://img.shields.io/npm/dw/@webiny/feature-flags.svg)](https://www.npmjs.com/package/@webiny/feature-flags)
3
- [![](https://img.shields.io/npm/v/@webiny/feature-flags.svg)](https://www.npmjs.com/package/@webiny/feature-flags)
4
- [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
5
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
1
+ # @webiny/feature-flags
6
2
 
7
- A small library that provides a simple way to define and read feature flags in a Webiny project.
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
8
6
 
9
- ## Table of Contents
7
+ πŸ“˜ **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
10
8
 
11
- - [Installation](#installation)
12
- - [Overview](#overview)
13
- - [Examples](#examples)
14
- - [Reference](#reference)
15
- - [Objects](#objects)
16
- - [`featureFlags`](#featureFlags)
9
+ ---
17
10
 
18
- ## Installation
19
-
20
- ```
21
- npm install --save @webiny/feature-flags
22
- ```
23
-
24
- Or if you prefer yarn:
25
-
26
- ```
27
- yarn add @webiny/feature-flags
28
- ```
29
-
30
-
31
- ## Overview
32
-
33
- The `@webiny/feature-flags` exports a single `featureFlags` object which contains all of the feature flags initially set via the Webiny project's `webiny.project.ts` config file, via its `featureFlags` property.
34
-
35
- For example, given the following `webiny.project.ts` config file;
36
-
37
- ```ts
38
- // webiny.project.ts
39
- export default {
40
- name: "webiny-js",
41
- cli: {
42
- ...
43
- },
44
-
45
- // Feature flags are defined via a simple JavaScript object.
46
- featureFlags: {
47
- myCustomFeatureFlag: false,
48
- someFeature: { enabled: true, myCustomProperty: 123, thisIsJson: "yes"}
49
- }
50
- };
51
- ```
52
-
53
- Within both backend and frontend application code, the `featureFlags` object can then be read like so:
54
-
55
- ```ts
56
- import { featureFlags } from "@webiny/feature-flags";
57
-
58
- const useMyCustomFeature = featureFlags.myCustomFeatureFlag;
59
-
60
- const someOtherFeatureMyCustomProperty = featureFlags.someFeature.myCustomProperty;
61
- ```
62
-
63
- > **NOTE**
64
- >
65
- > Behind the scenes, it's the [Webiny CLI](https://www.webiny.com/docs/core-development-concepts/basics/webiny-cli) that enables the propagation of the `featureFlags` object into the actual applications. As mentioned, the `featureFlags` object can be accessed within both backend and frontend application code.
66
-
67
- ## Examples
68
-
69
- No additional examples.
70
-
71
- ## Reference
72
-
73
- ### Objects
74
-
75
- #### `featureFlags`
76
-
77
- <details>
78
- <summary>Type Declaration</summary>
79
- <p>
80
-
81
- ```ts
82
- declare let featureFlags: Record<string, any>;
83
- ```
84
-
85
- </p>
86
- </details>
87
-
88
- The `featureFlags` object contains all of the feature flags initially set via the Webiny project's `webiny.project.ts` config file, via its `featureFlags` property.
89
-
90
-
91
- ```ts
92
- import { featureFlags } from "@webiny/feature-flags";
93
-
94
- const useMyCustomFeature = featureFlags.myCustomFeatureFlag;
95
-
96
- const someOtherFeatureMyCustomProperty = featureFlags.someFeature.myCustomProperty;
97
- ```
11
+ _This README file is automatically generated during the publish process._
package/index.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- export type FeatureFlags<TFeatureFlags = Record<string, any>> = {
2
- allowCmsLegacyRichTextInput?: boolean;
3
- cmsLegacyEntryEditor?: boolean;
4
- experimentalDynamicPages?: boolean;
5
- newWatchCommand?: boolean;
6
- } & TFeatureFlags;
1
+ export type FeatureFlags<TFeatureFlags = Record<string, any>> = {} & TFeatureFlags;
7
2
  declare let featureFlags: FeatureFlags;
8
3
  export { featureFlags };
package/index.js CHANGED
@@ -1,18 +1,13 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.featureFlags = void 0;
7
- let featureFlags = exports.featureFlags = {};
1
+ let featureFlags = {};
8
2
 
9
3
  // In API applications.
10
4
  if (process.env.WEBINY_FEATURE_FLAGS) {
11
- exports.featureFlags = featureFlags = JSON.parse(process.env.WEBINY_FEATURE_FLAGS);
5
+ featureFlags = JSON.parse(process.env.WEBINY_FEATURE_FLAGS);
12
6
 
13
7
  // In React applications.
14
8
  } else if (process.env.REACT_APP_WEBINY_FEATURE_FLAGS) {
15
- exports.featureFlags = featureFlags = JSON.parse(process.env.REACT_APP_WEBINY_FEATURE_FLAGS);
9
+ featureFlags = JSON.parse(process.env.REACT_APP_WEBINY_FEATURE_FLAGS);
16
10
  }
11
+ export { featureFlags };
17
12
 
18
13
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["featureFlags","exports","process","env","WEBINY_FEATURE_FLAGS","JSON","parse","REACT_APP_WEBINY_FEATURE_FLAGS"],"sources":["index.ts"],"sourcesContent":["export type FeatureFlags<TFeatureFlags = Record<string, any>> = {\n allowCmsLegacyRichTextInput?: boolean;\n cmsLegacyEntryEditor?: boolean;\n experimentalDynamicPages?: boolean;\n newWatchCommand?: boolean;\n} & TFeatureFlags;\n\nlet featureFlags: FeatureFlags = {};\n\n// In API applications.\nif (process.env.WEBINY_FEATURE_FLAGS) {\n featureFlags = JSON.parse(process.env.WEBINY_FEATURE_FLAGS) as FeatureFlags;\n\n // In React applications.\n} else if (process.env.REACT_APP_WEBINY_FEATURE_FLAGS) {\n featureFlags = JSON.parse(process.env.REACT_APP_WEBINY_FEATURE_FLAGS) as FeatureFlags;\n}\n\nexport { featureFlags };\n"],"mappings":";;;;;;AAOA,IAAIA,YAA0B,GAAAC,OAAA,CAAAD,YAAA,GAAG,CAAC,CAAC;;AAEnC;AACA,IAAIE,OAAO,CAACC,GAAG,CAACC,oBAAoB,EAAE;EAClCH,OAAA,CAAAD,YAAA,GAAAA,YAAY,GAAGK,IAAI,CAACC,KAAK,CAACJ,OAAO,CAACC,GAAG,CAACC,oBAAoB,CAAiB;;EAE3E;AACJ,CAAC,MAAM,IAAIF,OAAO,CAACC,GAAG,CAACI,8BAA8B,EAAE;EACnDN,OAAA,CAAAD,YAAA,GAAAA,YAAY,GAAGK,IAAI,CAACC,KAAK,CAACJ,OAAO,CAACC,GAAG,CAACI,8BAA8B,CAAiB;AACzF","ignoreList":[]}
1
+ {"version":3,"names":["featureFlags","process","env","WEBINY_FEATURE_FLAGS","JSON","parse","REACT_APP_WEBINY_FEATURE_FLAGS"],"sources":["index.ts"],"sourcesContent":["export type FeatureFlags<TFeatureFlags = Record<string, any>> = {} & TFeatureFlags;\n\nlet featureFlags: FeatureFlags = {};\n\n// In API applications.\nif (process.env.WEBINY_FEATURE_FLAGS) {\n featureFlags = JSON.parse(process.env.WEBINY_FEATURE_FLAGS) as FeatureFlags;\n\n // In React applications.\n} else if (process.env.REACT_APP_WEBINY_FEATURE_FLAGS) {\n featureFlags = JSON.parse(process.env.REACT_APP_WEBINY_FEATURE_FLAGS) as FeatureFlags;\n}\n\nexport { featureFlags };\n"],"mappings":"AAEA,IAAIA,YAA0B,GAAG,CAAC,CAAC;;AAEnC;AACA,IAAIC,OAAO,CAACC,GAAG,CAACC,oBAAoB,EAAE;EAClCH,YAAY,GAAGI,IAAI,CAACC,KAAK,CAACJ,OAAO,CAACC,GAAG,CAACC,oBAAoB,CAAiB;;EAE3E;AACJ,CAAC,MAAM,IAAIF,OAAO,CAACC,GAAG,CAACI,8BAA8B,EAAE;EACnDN,YAAY,GAAGI,IAAI,CAACC,KAAK,CAACJ,OAAO,CAACC,GAAG,CAACI,8BAA8B,CAAiB;AACzF;AAEA,SAASN,YAAY","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@webiny/feature-flags",
3
- "version": "6.0.0-alpha.5",
3
+ "version": "6.0.0-rc.0",
4
+ "type": "module",
4
5
  "main": "index.js",
5
6
  "repository": {
6
7
  "type": "git",
@@ -12,18 +13,14 @@
12
13
  ],
13
14
  "license": "MIT",
14
15
  "devDependencies": {
15
- "@types/uniqid": "5.3.2",
16
- "@webiny/project-utils": "6.0.0-alpha.5",
17
- "rimraf": "6.0.1",
18
- "typescript": "5.3.3"
16
+ "@types/uniqid": "5.3.4",
17
+ "@webiny/build-tools": "6.0.0-rc.0",
18
+ "rimraf": "6.1.3",
19
+ "typescript": "5.9.3"
19
20
  },
20
21
  "publishConfig": {
21
22
  "access": "public",
22
23
  "directory": "dist"
23
24
  },
24
- "scripts": {
25
- "build": "node ../cli/bin.js run build",
26
- "watch": "node ../cli/bin.js run watch"
27
- },
28
- "gitHead": "b7e120541b093e91f214904a9f13e4c2c4640978"
25
+ "gitHead": "0f2aa699f4642e550ab62c96fcd050e8d02345c9"
29
26
  }