Skip to content

Commit 31fa6c5

Browse files
committed
Link @mozilla/glean in samples just like in benchmarks
We use --prefix a lot on the CI and that makes link behave differently. Using the same strategy as in benchmarks, we make sure both linking steps happen with the same prefix and thus the linking works as expected. This will fix Bug 1707626.
1 parent 8f64c18 commit 31fa6c5

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

.circleci/config.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,12 @@ jobs:
6464
- run:
6565
name: Install JavaScript dependencies for Glean
6666
command: npm --prefix ./glean install
67-
- run:
68-
name: Build & link Glean.js to use it in the samples
69-
command: |
70-
npm --prefix ./glean run build:webext
71-
npm --prefix ./glean run build:cli
72-
npm --prefix ./glean link
7367
# JS sample related jobs
7468
- run:
7569
name: Install JavaScript dependencies for the JS sample
7670
command: |
77-
npm --prefix ./samples/web-extension/javascript install
78-
npm --prefix ./samples/web-extension/javascript link @mozilla/glean
71+
npm --prefix ./samples/web-extension/javascript install
72+
npm --prefix ./samples/web-extension/javascript run link:glean
7973
- run:
8074
name: Build the JS sample
8175
command: |
@@ -88,8 +82,8 @@ jobs:
8882
- run:
8983
name: Install Typescript dependencies for the TS sample
9084
command: |
91-
npm --prefix ./samples/web-extension/typescript install
92-
npm --prefix ./samples/web-extension/typescript link @mozilla/glean
85+
npm --prefix ./samples/web-extension/typescript install
86+
npm --prefix ./samples/web-extension/typescript run link:glean
9387
- run:
9488
name: Build the TS sample
9589
command: |

samples/web-extension/javascript/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"description": "A sample web extension using Glean.js",
66
"main": "dist/bundle.js",
77
"scripts": {
8+
"link:glean": "cd ../../../glean && npm i && npm run build && npm link && cd ../samples/web-extension/javascript && npm link @mozilla/glean",
89
"glean": "glean translate src/metrics.yaml src/pings.yaml -f javascript -o src/generated",
910
"build": "npm run glean && webpack --config webpack.config.js --mode production",
1011
"dev": "npm run glean && webpack --watch --config webpack.config.js --mode development",

samples/web-extension/typescript/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "dist/bundle.js",
66
"type": "module",
77
"scripts": {
8+
"link:glean": "cd ../../../glean && npm i && npm run build && npm link && cd ../samples/web-extension/typescript && npm link @mozilla/glean",
89
"glean": "glean translate src/metrics.yaml src/pings.yaml -f typescript -o src/generated",
910
"build": "npm run glean && webpack --config webpack.config.js --mode production",
1011
"dev": "npm run glean && webpack --watch --config webpack.config.js --mode development",

0 commit comments

Comments
 (0)