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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.13.0...main)

* [#313](https://github.com/mozilla/glean.js/pull/313): Send Glean.js version and platform information on X-Telemetry-Agent header instead of User-Agent header.
* [#343](https://github.com/mozilla/glean.js/pull/343): BUGFIX: Report the correct failure exit code when the Glean command line tool fails.

# v0.13.0 (2021-05-18)

[Full changelog](https://github.com/mozilla/glean.js/compare/v0.12.0...v0.13.0)
Expand Down
53 changes: 29 additions & 24 deletions glean/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ async function setup(projectRoot: string) {
console.log(`Using Glean virtual environment at ${venvRoot}`);
} else if (!await createPythonVenv(venvRoot)){
console.error(`Failed to create a Glean virtual environment at ${venvRoot}`);
process.exit(1);
}
}

Expand All @@ -189,33 +190,10 @@ async function runGlean(projectRoot: string, parserArgs: string[]) {

if (err) {
console.error(`${stderr}`);
process.exit(1);
}
}

/**
* Runs the command.
*
* @param args the arguments passed to this process.
*/
async function run(args: string[]) {
if (args.length < 3) {
throw new Error("Not enough arguments. Please refer to https://mozilla.github.io/glean_parser/readme.html");
}

const projectRoot = process.cwd();
try {
await setup(projectRoot);
} catch (err) {
console.error("Failed to setup the Glean build environment", err);
}

await runGlean(projectRoot, args.slice(2));
}

run(argv).catch(e => {
console.error("There was an error running Glean", e);
});

/**
* Returns a spinner
*
Expand All @@ -239,3 +217,30 @@ function stopSpinner(spinner: NodeJS.Timeout) {
process.stdout.write(" \r");
clearInterval(spinner);
}

/**
* Runs the command.
*
* @param args the arguments passed to this process.
*/
async function run(args: string[]) {
if (args.length < 3) {
throw new Error("Not enough arguments. Please refer to https://mozilla.github.io/glean_parser/readme.html");
}

const projectRoot = process.cwd();
try {
await setup(projectRoot);
} catch (err) {
console.error("Failed to setup the Glean build environment", err);
process.exit(1);
}

await runGlean(projectRoot, args.slice(2));
}

// For discoverability, try to leave this function as the last one on this file.
run(argv).catch(e => {
console.error("There was an error running Glean", e);
process.exit(1);
});
6 changes: 3 additions & 3 deletions samples/web-extension/javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Running the example requires Python 3.
npm link
```

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

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

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

```bash
npm run build
Expand All @@ -44,6 +44,6 @@ npm run build
- **Chromium-based browsers**
1. Go to [chrome://extensions](chrome://extensions);
2. Click on `Load unpacked`;
3. Choose this `web-extension` folder;
3. Choose this `web-extension/javascript` folder;
4. Click on `background page`;
5. Try clicking on the little Glean logo that should have been added to your browsers toolbar.
6 changes: 3 additions & 3 deletions samples/web-extension/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Running the example requires Python 3.
npm link
```

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

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

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

```bash
npm run build
Expand All @@ -44,6 +44,6 @@ npm run build
- **Chromium-based browsers**
1. Go to [chrome://extensions](chrome://extensions);
2. Click on `Load unpacked`;
3. Choose this `web-extension` folder;
3. Choose this `web-extension/typescript` folder;
4. Click on `background page`;
5. Try clicking on the little Glean logo that should have been added to your browsers toolbar.