Skip to content

Commit 4ac2014

Browse files
author
Beatriz Rizental
authored
Bug 1686678 - Prepare Glean.js for publishing (#73)
1 parent a340092 commit 4ac2014

File tree

8 files changed

+1714
-3057
lines changed

8 files changed

+1714
-3057
lines changed

.circleci/config.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ jobs:
6565
name: Verify no Javascript errors found in Qt
6666
command: bin/qt-js-check.sh
6767

68+
publish:
69+
docker:
70+
- image: cimg/node:14.13.1
71+
steps:
72+
- checkout
73+
- run:
74+
name: Install Javascript dependencies
75+
command: npm --prefix ./glean install
76+
- run:
77+
name: NPM Authentication
78+
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
79+
- run:
80+
name: Publish to npm
81+
command: export PATH=.:$PATH && (cd glean && npm publish)
82+
6883

6984
workflows:
7085
version: 2
@@ -73,6 +88,15 @@ workflows:
7388
- lint
7489
- unit-tests
7590
- check-qt-js
91+
- publish:
92+
requires:
93+
- lint
94+
- unit-tests
95+
filters:
96+
branches:
97+
ignore: /.*/
98+
tags:
99+
only: /v[0-9]+(\.[0-9]+)*/
76100
# Comment this job away until Bug 1681899 is resolved.
77101
# - check-size:
78102
# filters:

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Unreleased changes
2+
3+
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.1.0...main)
4+
5+
* [#73](https://github.com/mozilla/glean.js/pull/73): Add this changelog file.
6+
* [#42](https://github.com/mozilla/glean.js/pull/42): Implement the `deletion-request` ping.
7+
* [#41](https://github.com/mozilla/glean.js/pull/41): Implement the `logPings` debug tool.
8+
* When `logPings` is enabled, pings are logged upon collection.
9+
* [#40](https://github.com/mozilla/glean.js/pull/40): Use the dispatcher in all Glean external API functions. Namely:
10+
* Metric recording functions;
11+
* Ping submission;
12+
* `initialize` and `setUploadEnabled`.
13+
* [#36](https://github.com/mozilla/glean.js/pull/36): Implement the event metric type.
14+
* [#31](https://github.com/mozilla/glean.js/pull/31): Implement a task Dispatcher to help in executing Promises in a deterministic order.
15+
* [#26](https://github.com/mozilla/glean.js/pull/26): Implement the setUploadEnable API.
16+
* [#25](https://github.com/mozilla/glean.js/pull/25): Implement an adapter that leverages browser APIs to upload pings.
17+
* [#24](https://github.com/mozilla/glean.js/pull/24): Implement a ping upload manager.
18+
* [#23](https://github.com/mozilla/glean.js/pull/23): Implement the initialize API and glean internal metrics.
19+
* [#22](https://github.com/mozilla/glean.js/pull/22): Implement the PingType structure and a ping maker.
20+
* [#20](https://github.com/mozilla/glean.js/pull/20): Implement the datetime metric type.
21+
* [#17](https://github.com/mozilla/glean.js/pull/17): Implement the UUID metric type.
22+
* [#14](https://github.com/mozilla/glean.js/pull/14): Implement the counter metric type.
23+
* [#13](https://github.com/mozilla/glean.js/pull/13): Implement the string metric type.
24+
* [#11](https://github.com/mozilla/glean.js/pull/11): Implement the boolean metric type.
25+
* [#9](https://github.com/mozilla/glean.js/pull/9): Implement a metrics database module.
26+
* [#8](https://github.com/mozilla/glean.js/pull/8): Implement a web extension version of the underlying storage module.
27+
* [#6](https://github.com/mozilla/glean.js/pull/6): Implement an abstract underlying storage module.

glean/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glean/package.json

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
{
2-
"name": "glean",
2+
"name": "@mozilla/glean",
33
"version": "0.1.0",
44
"description": "An implementation of the Glean SDK, a modern cross-platform telemetry client, for Javascript environments.",
5-
"main": "./dist/glean.js",
5+
"exports": {
6+
"./package.json": "./package.json",
7+
"./qt": "./dist/qt.js",
8+
"./webext": "./dist/webext.js"
9+
},
10+
"files": [
11+
"README.md",
12+
"package.json",
13+
"dist/**/*.js"
14+
],
615
"scripts": {
716
"test": "npm run test:core && npm run test:platform",
817
"test:core": "ts-mocha \"tests/core/**/*.spec.ts\" --paths -p ./tsconfig.json --recursive",
@@ -11,11 +20,12 @@
1120
"lint": "eslint . --ext .ts,.js,.json --max-warnings=0",
1221
"fix": "eslint . --ext .ts,.js,.json --fix",
1322
"build": "webpack --config webpack.config.js --mode production",
14-
"dev": "webpack --watch --config webpack.config.js --mode development --devtool inline-source-map"
23+
"dev": "webpack --watch --config webpack.config.js --mode development --devtool inline-source-map",
24+
"prepare": "npm run build"
1525
},
1626
"repository": {
1727
"type": "git",
18-
"url": "git+https://github.com/brizental/glean.js.git"
28+
"url": "git+https://github.com/mozilla/glean.js.git"
1929
},
2030
"keywords": [
2131
"telemetry",
@@ -24,9 +34,9 @@
2434
"author": "The Glean Team <glean-team@mozilla.com>",
2535
"license": "MPL-2.0",
2636
"bugs": {
27-
"url": "https://github.com/brizental/glean.js/issues"
37+
"url": "https://github.com/mozilla/glean.js/issues"
2838
},
29-
"homepage": "https://github.com/brizental/glean.js#readme",
39+
"homepage": "https://github.com/mozilla/glean.js#readme",
3040
"devDependencies": {
3141
"@types/assert": "^1.5.4",
3242
"@types/mocha": "^8.2.0",

samples/web-extension/README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@ Whenever this web extensions popup is opened it will trigger Glean.js events.
1010
1111
## How to run this sample
1212

13-
1. Build Glean.js for web extensions. On the root folder of this repository run:
14-
15-
```bash
16-
npm run build:webext
17-
```
18-
19-
2. Generate metrics and pings files.
13+
1. Generate metrics and pings files.
2014

2115
```bash
2216
npm run glean_parser
@@ -26,15 +20,26 @@ npm run glean_parser
2620
> glean_parser is a Python package. To install it run `pip install glean_parser`.
2721
> Javascript support was added to glean_parser on version 2.1.0, make sure your version is up to date.
2822
23+
2. Link the `@mozilla/glean` package. On the glean/ folder run:
24+
25+
```bash
26+
npm link
27+
```
28+
29+
3. Link the `@mozilla/glean` package to this sample web extension. On this `web-extension` folder run:
30+
31+
```bash
32+
npm link @mozilla/glean
33+
```
2934

30-
3. Build this sample. On this `web-extension` folder run:
35+
4. Build this sample. On this `web-extension` folder run:
3136

3237
```bash
3338
npm install
3439
npm run build
3540
```
3641

37-
4. Load the web extension on your browser of choice.
42+
5. Load the web extension on your browser of choice.
3843

3944
- **Firefox**
4045
1. Go to [about:debugging#/runtime/this-firefox](about:debugging#/runtime/this-firefox);

samples/web-extension/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
"use strict";
66

7-
import Glean from "glean";
7+
import Glean from "@mozilla/glean/webext";
88
import { custom } from "./generated/pings";
99
import { webextStarted, popupOpened } from "./generated/sample";
1010

0 commit comments

Comments
 (0)