Skip to content

Commit

Permalink
Bug 1686678 - Prepare Glean.js for publishing (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
Beatriz Rizental authored Feb 17, 2021
1 parent a340092 commit 4ac2014
Show file tree
Hide file tree
Showing 8 changed files with 1,714 additions and 3,057 deletions.
24 changes: 24 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ jobs:
name: Verify no Javascript errors found in Qt
command: bin/qt-js-check.sh

publish:
docker:
- image: cimg/node:14.13.1
steps:
- checkout
- run:
name: Install Javascript dependencies
command: npm --prefix ./glean install
- run:
name: NPM Authentication
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
- run:
name: Publish to npm
command: export PATH=.:$PATH && (cd glean && npm publish)


workflows:
version: 2
Expand All @@ -73,6 +88,15 @@ workflows:
- lint
- unit-tests
- check-qt-js
- publish:
requires:
- lint
- unit-tests
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*/
# Comment this job away until Bug 1681899 is resolved.
# - check-size:
# filters:
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Unreleased changes

[Full changelog](https://github.com/mozilla/glean.js/compare/v0.1.0...main)

* [#73](https://github.com/mozilla/glean.js/pull/73): Add this changelog file.
* [#42](https://github.com/mozilla/glean.js/pull/42): Implement the `deletion-request` ping.
* [#41](https://github.com/mozilla/glean.js/pull/41): Implement the `logPings` debug tool.
* When `logPings` is enabled, pings are logged upon collection.
* [#40](https://github.com/mozilla/glean.js/pull/40): Use the dispatcher in all Glean external API functions. Namely:
* Metric recording functions;
* Ping submission;
* `initialize` and `setUploadEnabled`.
* [#36](https://github.com/mozilla/glean.js/pull/36): Implement the event metric type.
* [#31](https://github.com/mozilla/glean.js/pull/31): Implement a task Dispatcher to help in executing Promises in a deterministic order.
* [#26](https://github.com/mozilla/glean.js/pull/26): Implement the setUploadEnable API.
* [#25](https://github.com/mozilla/glean.js/pull/25): Implement an adapter that leverages browser APIs to upload pings.
* [#24](https://github.com/mozilla/glean.js/pull/24): Implement a ping upload manager.
* [#23](https://github.com/mozilla/glean.js/pull/23): Implement the initialize API and glean internal metrics.
* [#22](https://github.com/mozilla/glean.js/pull/22): Implement the PingType structure and a ping maker.
* [#20](https://github.com/mozilla/glean.js/pull/20): Implement the datetime metric type.
* [#17](https://github.com/mozilla/glean.js/pull/17): Implement the UUID metric type.
* [#14](https://github.com/mozilla/glean.js/pull/14): Implement the counter metric type.
* [#13](https://github.com/mozilla/glean.js/pull/13): Implement the string metric type.
* [#11](https://github.com/mozilla/glean.js/pull/11): Implement the boolean metric type.
* [#9](https://github.com/mozilla/glean.js/pull/9): Implement a metrics database module.
* [#8](https://github.com/mozilla/glean.js/pull/8): Implement a web extension version of the underlying storage module.
* [#6](https://github.com/mozilla/glean.js/pull/6): Implement an abstract underlying storage module.
2 changes: 1 addition & 1 deletion glean/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions glean/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{
"name": "glean",
"name": "@mozilla/glean",
"version": "0.1.0",
"description": "An implementation of the Glean SDK, a modern cross-platform telemetry client, for Javascript environments.",
"main": "./dist/glean.js",
"exports": {
"./package.json": "./package.json",
"./qt": "./dist/qt.js",
"./webext": "./dist/webext.js"
},
"files": [
"README.md",
"package.json",
"dist/**/*.js"
],
"scripts": {
"test": "npm run test:core && npm run test:platform",
"test:core": "ts-mocha \"tests/core/**/*.spec.ts\" --paths -p ./tsconfig.json --recursive",
Expand All @@ -11,11 +20,12 @@
"lint": "eslint . --ext .ts,.js,.json --max-warnings=0",
"fix": "eslint . --ext .ts,.js,.json --fix",
"build": "webpack --config webpack.config.js --mode production",
"dev": "webpack --watch --config webpack.config.js --mode development --devtool inline-source-map"
"dev": "webpack --watch --config webpack.config.js --mode development --devtool inline-source-map",
"prepare": "npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/brizental/glean.js.git"
"url": "git+https://github.com/mozilla/glean.js.git"
},
"keywords": [
"telemetry",
Expand All @@ -24,9 +34,9 @@
"author": "The Glean Team <glean-team@mozilla.com>",
"license": "MPL-2.0",
"bugs": {
"url": "https://github.com/brizental/glean.js/issues"
"url": "https://github.com/mozilla/glean.js/issues"
},
"homepage": "https://github.com/brizental/glean.js#readme",
"homepage": "https://github.com/mozilla/glean.js#readme",
"devDependencies": {
"@types/assert": "^1.5.4",
"@types/mocha": "^8.2.0",
Expand Down
23 changes: 14 additions & 9 deletions samples/web-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ Whenever this web extensions popup is opened it will trigger Glean.js events.
## How to run this sample

1. Build Glean.js for web extensions. On the root folder of this repository run:

```bash
npm run build:webext
```

2. Generate metrics and pings files.
1. Generate metrics and pings files.

```bash
npm run glean_parser
Expand All @@ -26,15 +20,26 @@ npm run glean_parser
> glean_parser is a Python package. To install it run `pip install glean_parser`.
> Javascript support was added to glean_parser on version 2.1.0, make sure your version is up to date.
2. Link the `@mozilla/glean` package. On the glean/ folder run:

```bash
npm link
```

3. Link the `@mozilla/glean` package to this sample web extension. On this `web-extension` folder run:

```bash
npm link @mozilla/glean
```

3. Build this sample. On this `web-extension` folder run:
4. Build this sample. On this `web-extension` folder run:

```bash
npm install
npm run build
```

4. Load the web extension on your browser of choice.
5. Load the web extension on your browser of choice.

- **Firefox**
1. Go to [about:debugging#/runtime/this-firefox](about:debugging#/runtime/this-firefox);
Expand Down
2 changes: 1 addition & 1 deletion samples/web-extension/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

"use strict";

import Glean from "glean";
import Glean from "@mozilla/glean/webext";
import { custom } from "./generated/pings";
import { webextStarted, popupOpened } from "./generated/sample";

Expand Down
Loading

0 comments on commit 4ac2014

Please sign in to comment.