Skip to content

Commit 5afe451

Browse files
👷 [FFL-23] Create datadog-flagging package (DataDog#3553)
1 parent b86b7c7 commit 5afe451

19 files changed

Lines changed: 128 additions & 4 deletions

‎.github/CODEOWNERS‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Order is important, the last matching pattern takes the most precedence.
22

33
# Global
4-
* @Datadog/rum-browser
4+
packages/flagging @Datadog/feature-flagging-experimentation
5+
* @Datadog/rum-browser
56

67
# Docs
78
*README.md @Datadog/rum-browser @DataDog/documentation

‎.github/codeql-config.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: 'CodeQL config'
33
paths:
44
- packages/core/src
55
- packages/logs/src
6+
- packages/flagging/src
67
- packages/rum/src
78
- packages/rum-core/src
89
- packages/rum-slim/src

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ package.tgz
2222
/playwright-report/
2323
/blob-report/
2424
/playwright/.cache/
25+
.vscode

‎eslint-local-rules/disallowSideEffects.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const packagesRoot = path.resolve(__dirname, '..', 'packages')
2727
// Those modules are known to have side effects when evaluated
2828
const pathsWithSideEffect = new Set([
2929
`${packagesRoot}/logs/src/entries/main.ts`,
30+
`${packagesRoot}/flagging/src/entries/main.ts`,
3031
`${packagesRoot}/rum/src/entries/main.ts`,
3132
`${packagesRoot}/rum-slim/src/entries/main.ts`,
3233
])

‎eslint.config.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ export default tseslint.config(
341341
},
342342

343343
{
344-
files: ['packages/{rum,logs,rum-slim}/src/entries/*.ts'],
344+
files: ['packages/{rum,logs,flagging,rum-slim}/src/entries/*.ts'],
345345
rules: {
346346
'local-rules/disallow-enum-exports': 'error',
347347
},
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*
2+
!/bundle/**/*.js
3+
!/cjs/**/*
4+
!/esm/**/*
5+
!/src/**/*
6+
/src/**/*.spec.ts
7+
/src/**/*.specHelper.ts

‎packages/flagging/.yarnrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
save-exact true
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Flagging SDK (Prerelease)
2+
3+
This package supports flagging and experimentation by performing evaluation in the browser.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "@datadog/browser-flagging",
3+
"version": "6.7.0",
4+
"license": "Apache-2.0",
5+
"private": true,
6+
"main": "cjs/entries/main.js",
7+
"module": "esm/entries/main.js",
8+
"types": "cjs/entries/main.d.ts",
9+
"scripts": {
10+
"pack": "yarn pack",
11+
"build": "run-p build:cjs build:esm build:bundle",
12+
"build:bundle": "rm -rf bundle && SDK_SETUP=cdn webpack --mode=production",
13+
"build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.json && yarn replace-build-env cjs",
14+
"build:esm": "rm -rf esm && tsc -p tsconfig.esm.json && yarn replace-build-env esm",
15+
"replace-build-env": "node ../../scripts/build/replace-build-env.js"
16+
},
17+
"dependencies": {
18+
"@datadog/browser-core": "6.7.0"
19+
},
20+
"peerDependencies": {
21+
"@datadog/browser-rum": "6.7.0"
22+
},
23+
"peerDependenciesMeta": {
24+
"@datadog/browser-rum": {
25+
"optional": true
26+
}
27+
},
28+
"repository": {
29+
"type": "git",
30+
"url": "https://github.com/DataDog/browser-sdk.git",
31+
"directory": "packages/flagging"
32+
},
33+
"volta": {
34+
"extends": "../../package.json"
35+
},
36+
"publishConfig": {
37+
"access": "public"
38+
}
39+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineGlobal, getGlobalObject } from '@datadog/browser-core'
2+
import { flagging as importedFlagging } from '../hello'
3+
4+
export const datadogFlagging = importedFlagging
5+
6+
interface BrowserWindow extends Window {
7+
DD_FLAGGING?: typeof datadogFlagging
8+
}
9+
defineGlobal(getGlobalObject<BrowserWindow>(), 'DD_FLAGGING', datadogFlagging)

0 commit comments

Comments
 (0)