Skip to content

Commit

Permalink
feat(lib): exporting metrics by default
Browse files Browse the repository at this point in the history
This allows to require metrics easier than before by doing:
```
const metrics = require('pwmetrics/lib/metrics');

// {
//     TTFCP: "firstContentfulPaint",
//     TTFMP: "firstMeaningfulPaint",
//     TTFCPUIDLE: "firstCPUIdle",
//     TTI: "interactive",
//     SI: "speedIndex"
// }
```

Contrary to the current way:
```
const metrics = require('pwmetrics/lib/metrics/metrics');

// {
//     METRICS: {
//         TTFCP: "firstContentfulPaint",
//         TTFMP: "firstMeaningfulPaint",
//         TTFCPUIDLE: "firstCPUIdle",
//         TTI: "interactive",
//         SI: "speedIndex"
//     }
// }
```

The `readme.md` and `gulpfile.js` files have been updated too.
  • Loading branch information
bcabanes committed Nov 1, 2018
1 parent 6aa4bf1 commit 466f79a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/metrics/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { METRICS } from './metrics';

module.exports = METRICS;
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module.exports = {
`pwmetrics-config.js`

```js
const METRICS = require('pwmetrics/lib/metrics/metrics');
const METRICS = require('pwmetrics/lib/metrics');

module.exports = {
url: 'http://example.com/',
Expand Down
2 changes: 1 addition & 1 deletion recipes/gulp/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* eslint-disable no-console */
const gulp = require('gulp');
const PWMetrics = require('../../lib/');
const {METRICS} = require('../../lib/metrics/metrics');
const METRICS = require('../../lib/metrics');

/**
* Run pwmetrics
Expand Down

0 comments on commit 466f79a

Please sign in to comment.