Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨[RUM-3151] Report bundle sizes to logs #2605

Merged
merged 21 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ecd33a7
✨[RUM-3151] Report bundle sizes to logs
RomanGaignault Feb 9, 2024
e61ca38
added ddsource in request and PostBundleSize is now async
RomanGaignault Feb 12, 2024
46f89ea
fix lint error
RomanGaignault Feb 12, 2024
369a184
added function getGitInformation, branch name in request and error h…
RomanGaignault Feb 12, 2024
d0ee5a3
changed branch's retrieve function
RomanGaignault Feb 12, 2024
bee5035
changed get branch method
RomanGaignault Feb 12, 2024
039adfb
changed branch method
RomanGaignault Feb 12, 2024
4b4cbf1
test merging
RomanGaignault Feb 12, 2024
8341cda
echo target branch name
RomanGaignault Feb 12, 2024
07f65d4
update gitlab yaml echo
RomanGaignault Feb 12, 2024
ff01b8d
added merge request tag in built and lint
RomanGaignault Feb 12, 2024
904e9fe
only merge request
RomanGaignault Feb 12, 2024
f7db3eb
revert changes gitlab yml
RomanGaignault Feb 12, 2024
8b13c6c
added branch new method
RomanGaignault Feb 12, 2024
e273ea3
Changed name intake, source version file and commit retrieve process
RomanGaignault Feb 13, 2024
f532ec7
added browser-sdk-version function / added error.cause to run main fu…
RomanGaignault Feb 13, 2024
bc7f0c6
added function printErrorWithCause
RomanGaignault Feb 13, 2024
269ff1f
deleted getter and added a simple return of lerna version. Changed fe…
RomanGaignault Feb 14, 2024
499851c
build env getbrowserversion
RomanGaignault Feb 14, 2024
81855d3
changed export name BrowserSdkVersion
RomanGaignault Feb 15, 2024
bf1e3dd
changed browserSdkVersion export name
RomanGaignault Feb 15, 2024
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
5 changes: 2 additions & 3 deletions scripts/export-bundles-sizes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const fs = require('fs')
const path = require('path')
const { execSync } = require('child_process')
const lernaJson = require('../lerna.json')
const { getBrowserSdkVersion } = require('./lib/browser-sdk-version')
const { getOrg2ApiKey } = require('./lib/secrets')
const { runMain, fetch: fetchWrapper } = require('./lib/execution-utils')
bcaudan marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -29,7 +28,7 @@ runMain(async () => {
rum_slim: getBundleSize(rumSlimPath),
worker: getBundleSize(workerPath),
},
version: lernaJson.version,
version: getBrowserSdkVersion(),
commit: process.env.CI_COMMIT_SHORT_SHA,
branch: process.env.CI_COMMIT_REF_NAME,
},
Expand Down
9 changes: 9 additions & 0 deletions scripts/lib/browser-sdk-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const lernaJson = require('../../lerna.json')

function getBrowserSdkVersion() {
return lernaJson.version
}

module.exports = {
getBrowserSdkVersion,
}
RomanGaignault marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions scripts/lib/build-env.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { readFileSync } = require('fs')
const path = require('path')
const execSync = require('child_process').execSync
const lernaJson = require('../../lerna.json')
const { getBrowserSdkVersion } = require('./browser-sdk-version')
const { command } = require('./command')

/**
Expand All @@ -24,12 +24,12 @@ const buildEnvFactories = {
SDK_VERSION: () => {
switch (getBuildMode()) {
case 'release':
return lernaJson.version
return getBrowserSdkVersion()
case 'canary': {
const commitSha1 = execSync('git rev-parse HEAD').toString().trim()
// TODO when tags would allow '+' characters
// use build separator (+) instead of prerelease separator (-)
return `${lernaJson.version}-${commitSha1}`
return `${getBrowserSdkVersion()}-${commitSha1}`
}
default:
return 'dev'
Expand Down
1 change: 1 addition & 0 deletions scripts/lib/execution-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function runMain(mainFunction) {
.catch((error) => {
printError('\nScript exited with error:')
printError(error)
printError(error.cause)
BenoitZugmeyer marked this conversation as resolved.
Show resolved Hide resolved
process.exit(1)
})
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/release/generate-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const readFile = util.promisify(require('fs').readFile)

const emojiNameMap = require('emoji-name-map')

const lernaConfig = require('../../lerna.json')
const { getBrowserSdkVersion } = require('../lib/browser-sdk-version')
const { spawnCommand, printError, runMain } = require('../lib/execution-utils')
const { command } = require('../lib/command')
const { modifyFile } = require('../lib/files-utils')
Expand Down Expand Up @@ -33,7 +33,7 @@ ${emojisLegend}

---

## v${lernaConfig.version}
## v${getBrowserSdkVersion()}

${changesList}
${content.slice(content.indexOf('\n##'))}`
Expand Down
4 changes: 2 additions & 2 deletions scripts/release/update-peer-dependency-versions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const lernaConfig = require('../../lerna.json')
const { runMain } = require('../lib/execution-utils')
const { modifyFile } = require('../lib/files-utils')
const { command } = require('../lib/command')
const { getBrowserSdkVersion } = require('../lib/browser-sdk-version')

const JSON_FILES = ['rum', 'rum-slim', 'logs'].map((packageName) => `./packages/${packageName}/package.json`)

Expand All @@ -25,7 +25,7 @@ runMain(async () => {
function updateJsonPeerDependencies(content) {
const json = JSON.parse(content)
Object.keys(json.peerDependencies).forEach((key) => {
json.peerDependencies[key] = lernaConfig.version
json.peerDependencies[key] = getBrowserSdkVersion()
})
return `${JSON.stringify(json, null, 2)}\n`
}