Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ typecheck:
interruptible: true
script:
- yarn
- yarn build
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 thought: ‏I guess this is because otherwise the type definitions from the peer dependencies are not found? That's a bit annoying to have to build just to typecheck 😞 (but I don't see an alternative)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, here I'm just reverting to the behavior that we add before #4019, since we don't nee to run yarn build at install anymore

- yarn typecheck
- scripts/cli typecheck test/apps/vanilla
- scripts/cli typecheck test/e2e
Expand All @@ -164,6 +165,7 @@ build-and-lint:
interruptible: true
script:
- yarn
- yarn build
- yarn lint
- node scripts/check-packages.ts

Expand Down Expand Up @@ -611,6 +613,7 @@ check-expired-telemetry-scheduled:
- $TARGET_TASK_NAME == "check-expired-telemetry"
script:
- yarn
- yarn build
- MONITOR_UNTIL_COMMENT_EXPIRED_LEVEL=error yarn lint

check-expired-telemetry-scheduled-failure:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"type": "module",
"scripts": {
"postinstall": "scripts/cli init_submodule && scripts/cli ci_build_and_pack",
"postinstall": "scripts/cli init_submodule",
"build": "yarn workspaces foreach --all --parallel --topological run build",
"build:bundle": "yarn workspaces foreach --all --parallel run build:bundle",
"build:apps": "node scripts/build/build-test-apps.ts",
Expand Down
3 changes: 0 additions & 3 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"lockFileMaintenance": {
"enabled": true
},
"skipInstalls": false,
"allowScripts": true,
"ignoreScripts": false,
"packageRules": [
{
"groupName": "all non-major dependencies",
Expand Down
17 changes: 17 additions & 0 deletions scripts/build/build-test-apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ runMain(async () => {
function buildApp(appPath: string) {
printLog(`Building app at ${appPath}...`)
command`yarn install --no-immutable`.withCurrentWorkingDirectory(appPath).run()

// install peer dependencies if any
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 suggestion: ‏Maybe add a comment explaining why we are using peed dependencies instead of dependencies. I think I got it but it's not obvious. (ideally that comment would be in the package.json, but 🤷)

// intent: renovate does not allow to generate local packages before install
// so local packages are marked as optional peer dependencies and only installed when we build the test apps
const packageJson = JSON.parse(fs.readFileSync(path.join(appPath, 'package.json'), 'utf-8'))
if (packageJson.peerDependencies) {
// For each peer dependency, install it
for (const [name] of Object.entries(packageJson.peerDependencies)) {
command`yarn add -D ${name}`.withCurrentWorkingDirectory(appPath).run()
}
// revert package.json & yarn.lock changes if they are versioned
const areFilesVersioned = command`git ls-files package.json yarn.lock`.withCurrentWorkingDirectory(appPath).run()
if (areFilesVersioned) {
command`git checkout package.json yarn.lock`.withCurrentWorkingDirectory(appPath).run()
}
}

command`yarn build`.withCurrentWorkingDirectory(appPath).run()
}

Expand Down
10 changes: 0 additions & 10 deletions scripts/cli
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,6 @@ cmd_check_server_side_rendering_compatibility () {
yarn compat:ssr || fail 'server side rendering compatibility broken'
}

# in CI, build and pack after install to allow renovate to install test apps
cmd_ci_build_and_pack () {
if [[ -z "${CI+x}" ]]; then
exit 0
else
yarn build
yarn run pack
fi
}

fail () {
echo
echo "❌ ${1}"
Expand Down
16 changes: 13 additions & 3 deletions test/apps/base-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@
"scripts": {
"build": "webpack"
},
"dependencies": {
"@datadog/browser-logs": "file:../../../packages/logs/package.tgz",
"@datadog/browser-rum": "file:../../../packages/rum/package.tgz"
"peerDependencies": {
"@datadog/browser-logs": "*",
"@datadog/browser-rum": "*"
},
"peerDependenciesMeta": {
"@datadog/browser-logs": {
"optional": true
},
"@datadog/browser-rum": {
"optional": true
}
Comment on lines +11 to +17
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥜 nitpick: If we're gonna install them anyway, then they are no optional (and it seems that npm would actually install them automatically, unfortunately this is not the case for yarn)

You might need to add the peer dependencies before doing yarn install in the build script though. I don't know if it's worth it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that renovate don't allow to build those dependencies before running the install to re-generate the lock file.

So the idea is to have a way to run the install without having those dependencies built, otherwise the install fails as the dependencies are missing.
But we still need to build them before effectively be able to use the test apps.

Do you have a simpler alternative in mind?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all good then! thanks

},
"resolutions": {
"@datadog/browser-rum-core": "file:../../../packages/rum-core/package.tgz",
"@datadog/browser-rum": "file:../../../packages/rum/package.tgz",
"@datadog/browser-logs": "file:../../../packages/logs/package.tgz",
"@datadog/browser-core": "file:../../../packages/core/package.tgz",
"@datadog/browser-rum-slim": "file:../../../packages/rum-slim/package.tgz",
"@datadog/browser-worker": "file:../../../packages/worker/package.tgz"
Expand Down
55 changes: 8 additions & 47 deletions test/apps/base-extension/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,6 @@ __metadata:
version: 8
cacheKey: 10c0

"@datadog/browser-core@file:../../../packages/core/package.tgz::locator=rum-testing-extension%40workspace%3A.":
version: 6.25.0
resolution: "@datadog/browser-core@file:../../../packages/core/package.tgz#../../../packages/core/package.tgz::hash=5f6a44&locator=rum-testing-extension%40workspace%3A."
checksum: 10c0/d20a19ba2e618847b466eab8363487b85fc487befd0b93e16410f54f8b32ea94c9e6b1a7c66e9541fd708d2eac6f3416cd214f5ad7e5104459d87a73687d506f
languageName: node
linkType: hard

"@datadog/browser-logs@file:../../../packages/logs/package.tgz::locator=rum-testing-extension%40workspace%3A.":
version: 6.25.0
resolution: "@datadog/browser-logs@file:../../../packages/logs/package.tgz#../../../packages/logs/package.tgz::hash=2789e6&locator=rum-testing-extension%40workspace%3A."
dependencies:
"@datadog/browser-core": "npm:6.25.0"
peerDependencies:
"@datadog/browser-rum": 6.25.0
peerDependenciesMeta:
"@datadog/browser-rum":
optional: true
checksum: 10c0/d04b7f0d59678cfe5447e3627166e81959e754b4366c0f88aef36d8a0fc3abd4e4f623113da0d983e4304661f5f9d4903a46c5873bb8e4c6686abf4bb940cd38
languageName: node
linkType: hard

"@datadog/browser-rum-core@file:../../../packages/rum-core/package.tgz::locator=rum-testing-extension%40workspace%3A.":
version: 6.25.0
resolution: "@datadog/browser-rum-core@file:../../../packages/rum-core/package.tgz#../../../packages/rum-core/package.tgz::hash=62f963&locator=rum-testing-extension%40workspace%3A."
dependencies:
"@datadog/browser-core": "npm:6.25.0"
checksum: 10c0/e14f387c7591daea532ce34e62f906a9f39e19fe4749914b8db44a84a3de561bd75ac54fe48713220fb7e01feb187c158c984e3f7c6b3191b46bb15d2ffefefe
languageName: node
linkType: hard

"@datadog/browser-rum@file:../../../packages/rum/package.tgz::locator=rum-testing-extension%40workspace%3A.":
version: 6.25.0
resolution: "@datadog/browser-rum@file:../../../packages/rum/package.tgz#../../../packages/rum/package.tgz::hash=912b9a&locator=rum-testing-extension%40workspace%3A."
dependencies:
"@datadog/browser-core": "npm:6.25.0"
"@datadog/browser-rum-core": "npm:6.25.0"
peerDependencies:
"@datadog/browser-logs": 6.25.0
peerDependenciesMeta:
"@datadog/browser-logs":
optional: true
checksum: 10c0/596e6c651000bcaaaac1ef11c7573c570d963d223d05d03ad07a3e1957a95cf2fdc50880b71b145690e6c735d44c150272bba0208b307cba5d361cf190883953
languageName: node
linkType: hard

"@discoveryjs/json-ext@npm:^0.6.1":
version: 0.6.3
resolution: "@discoveryjs/json-ext@npm:0.6.3"
Expand Down Expand Up @@ -928,10 +883,16 @@ __metadata:
version: 0.0.0-use.local
resolution: "rum-testing-extension@workspace:."
dependencies:
"@datadog/browser-logs": "file:../../../packages/logs/package.tgz"
"@datadog/browser-rum": "file:../../../packages/rum/package.tgz"
webpack: "npm:5.103.0"
webpack-cli: "npm:6.0.1"
peerDependencies:
"@datadog/browser-logs": "*"
"@datadog/browser-rum": "*"
peerDependenciesMeta:
"@datadog/browser-logs":
optional: true
"@datadog/browser-rum":
optional: true
languageName: unknown
linkType: soft

Expand Down
2 changes: 1 addition & 1 deletion test/apps/react-router-v6-app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,6 @@ document.body.appendChild(rootElement)
const root = ReactDOM.createRoot(rootElement)
root.render(
<React.StrictMode>
<RouterProvider router={router} />
<RouterProvider router={router as any} />
</React.StrictMode>
)
16 changes: 14 additions & 2 deletions test/apps/react-router-v6-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@
"build": "webpack"
},
"dependencies": {
"@datadog/browser-rum": "file:../../../packages/rum/package.tgz",
"@datadog/browser-rum-react": "file:../../../packages/rum-react/package.tgz",
"react": "19.2.0",
"react-dom": "19.2.0",
"react-router-dom": "6.30.0"
},
"peerDependencies": {
"@datadog/browser-rum": "*",
"@datadog/browser-rum-react": "*"
},
"peerDependenciesMeta": {
"@datadog/browser-rum": {
"optional": true
},
"@datadog/browser-rum-react": {
"optional": true
}
},
"resolutions": {
"@datadog/browser-rum-core": "file:../../../packages/rum-core/package.tgz",
"@datadog/browser-core": "file:../../../packages/core/package.tgz",
"@datadog/browser-rum": "file:../../../packages/rum/package.tgz",
"@datadog/browser-rum-react": "file:../../../packages/rum-react/package.tgz",
"@datadog/browser-rum-slim": "file:../../../packages/rum-slim/package.tgz",
"@datadog/browser-worker": "file:../../../packages/worker/package.tgz"
},
Expand Down
66 changes: 8 additions & 58 deletions test/apps/react-router-v6-app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,6 @@ __metadata:
version: 8
cacheKey: 10c0

"@datadog/browser-core@file:../../../packages/core/package.tgz::locator=react-router-v6-app%40workspace%3A.":
version: 6.25.0
resolution: "@datadog/browser-core@file:../../../packages/core/package.tgz#../../../packages/core/package.tgz::hash=5f6a44&locator=react-router-v6-app%40workspace%3A."
checksum: 10c0/d20a19ba2e618847b466eab8363487b85fc487befd0b93e16410f54f8b32ea94c9e6b1a7c66e9541fd708d2eac6f3416cd214f5ad7e5104459d87a73687d506f
languageName: node
linkType: hard

"@datadog/browser-rum-core@file:../../../packages/rum-core/package.tgz::locator=react-router-v6-app%40workspace%3A.":
version: 6.25.0
resolution: "@datadog/browser-rum-core@file:../../../packages/rum-core/package.tgz#../../../packages/rum-core/package.tgz::hash=62f963&locator=react-router-v6-app%40workspace%3A."
dependencies:
"@datadog/browser-core": "npm:6.25.0"
checksum: 10c0/e14f387c7591daea532ce34e62f906a9f39e19fe4749914b8db44a84a3de561bd75ac54fe48713220fb7e01feb187c158c984e3f7c6b3191b46bb15d2ffefefe
languageName: node
linkType: hard

"@datadog/browser-rum-react@file:../../../packages/rum-react/package.tgz::locator=react-router-v6-app%40workspace%3A.":
version: 6.25.0
resolution: "@datadog/browser-rum-react@file:../../../packages/rum-react/package.tgz#../../../packages/rum-react/package.tgz::hash=fb5234&locator=react-router-v6-app%40workspace%3A."
dependencies:
"@datadog/browser-core": "npm:6.25.0"
"@datadog/browser-rum-core": "npm:6.25.0"
peerDependencies:
react: 18 || 19
react-router: 6 || 7
react-router-dom: 6 || 7
peerDependenciesMeta:
"@datadog/browser-rum":
optional: true
"@datadog/browser-rum-slim":
optional: true
react:
optional: true
react-router:
optional: true
react-router-dom:
optional: true
checksum: 10c0/27d1521afed6fd6a225a4be63633c57d206a09e082c218f91d658d4a6054f43ae11c4acb93b2cf3a781e01a4c847f95609414795a24f6a262aedb0cf8b102fa0
languageName: node
linkType: hard

"@datadog/browser-rum@file:../../../packages/rum/package.tgz::locator=react-router-v6-app%40workspace%3A.":
version: 6.25.0
resolution: "@datadog/browser-rum@file:../../../packages/rum/package.tgz#../../../packages/rum/package.tgz::hash=912b9a&locator=react-router-v6-app%40workspace%3A."
dependencies:
"@datadog/browser-core": "npm:6.25.0"
"@datadog/browser-rum-core": "npm:6.25.0"
peerDependencies:
"@datadog/browser-logs": 6.25.0
peerDependenciesMeta:
"@datadog/browser-logs":
optional: true
checksum: 10c0/596e6c651000bcaaaac1ef11c7573c570d963d223d05d03ad07a3e1957a95cf2fdc50880b71b145690e6c735d44c150272bba0208b307cba5d361cf190883953
languageName: node
linkType: hard

"@jridgewell/gen-mapping@npm:^0.3.5":
version: 0.3.12
resolution: "@jridgewell/gen-mapping@npm:0.3.12"
Expand Down Expand Up @@ -733,14 +677,20 @@ __metadata:
version: 0.0.0-use.local
resolution: "react-router-v6-app@workspace:."
dependencies:
"@datadog/browser-rum": "file:../../../packages/rum/package.tgz"
"@datadog/browser-rum-react": "file:../../../packages/rum-react/package.tgz"
react: "npm:19.2.0"
react-dom: "npm:19.2.0"
react-router-dom: "npm:6.30.0"
ts-loader: "npm:9.5.4"
typescript: "npm:5.9.3"
webpack: "npm:5.103.0"
peerDependencies:
"@datadog/browser-rum": "*"
"@datadog/browser-rum-react": "*"
peerDependenciesMeta:
"@datadog/browser-rum":
optional: true
"@datadog/browser-rum-react":
optional: true
languageName: unknown
linkType: soft

Expand Down
16 changes: 13 additions & 3 deletions test/apps/vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@
"compat:tsc": "tsc -p tsconfig.json",
"compat:ssr": "webpack --config ./webpack.ssr.js && node dist/app.js"
},
"dependencies": {
"@datadog/browser-logs": "file:../../../packages/logs/package.tgz",
"@datadog/browser-rum": "file:../../../packages/rum/package.tgz"
"peerDependencies": {
"@datadog/browser-logs": "*",
"@datadog/browser-rum": "*"
},
"peerDependenciesMeta": {
"@datadog/browser-logs": {
"optional": true
},
"@datadog/browser-rum": {
"optional": true
}
},
"resolutions": {
"@datadog/browser-core": "file:../../../packages/core/package.tgz",
"@datadog/browser-rum": "file:../../../packages/rum/package.tgz",
"@datadog/browser-logs": "file:../../../packages/logs/package.tgz",
"@datadog/browser-rum-core": "file:../../../packages/rum-core/package.tgz",
"@datadog/browser-rum-react": "file:../../../packages/rum-react/package.tgz",
"@datadog/browser-rum-slim": "file:../../../packages/rum-slim/package.tgz",
Expand Down
Loading