Skip to content

Commit

Permalink
feat: add httparchive nostats subset
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Apr 19, 2019
1 parent fbefc64 commit 3ec7612
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/build-entity-json-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const DATA_DIR = path.join(__dirname, '../data')

if (!fs.existsSync(DIST_DIR)) fs.mkdirSync(DIST_DIR)

function cleanStatsFromEntity(entity) {
return _.omit(entity, ['totalExecutionTime', 'totalOccurrences'])
}

const sourceEntities = JSON5.parse(fs.readFileSync(`${DATA_DIR}/entities.json5`, 'utf8'))
fs.writeFileSync(`${DIST_DIR}/entities.json`, JSON.stringify(sourceEntities))

Expand Down Expand Up @@ -36,3 +40,7 @@ for (const entity of entitiesInHTTPArchive) {

fs.writeFileSync(`${DIST_DIR}/entities.json`, JSON.stringify(sourceEntities))
fs.writeFileSync(`${DIST_DIR}/entities-httparchive.json`, JSON.stringify(entitiesInHTTPArchive))
fs.writeFileSync(
`${DIST_DIR}/entities-httparchive-nostats.json`,
JSON.stringify(entitiesInHTTPArchive.map(e => cleanStatsFromEntity(e))),
)
1 change: 1 addition & 0 deletions lib/subsets/httparchive-nostats.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../index'
3 changes: 3 additions & 0 deletions lib/subsets/httparchive-nostats.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const {createAPIFromDataset} = require('../create-entity-finder-api.js')
const entities = require('../../dist/entities-httparchive-nostats.json')
module.exports = createAPIFromDataset(entities)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
},
"config": {
"exportAliases": {
"httparchive-nostats-subset": "./lib/subsets/httparchive-nostats.js",
"httparchive-subset": "./lib/subsets/httparchive.js"
}
}
Expand Down

0 comments on commit 3ec7612

Please sign in to comment.