Skip to content

Commit d5407ed

Browse files
committed
Add a version to the index file
1 parent ead878f commit d5407ed

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/make-index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,17 @@ const util = require('util');
2222
}
2323
index.push(pjson);
2424
}
25+
2526
const ownPjsonPath = path.join(__dirname, '..', 'package.json');
2627
const ownPjson = JSON.parse(await fs.readFile(ownPjsonPath, 'utf8'));
2728
const metadata = (({ homepage, repository, bugs }) => ({ homepage, repository, bugs }))(ownPjson);
28-
const data = await util.promisify(zlib.brotliCompress)(bson.serialize({ index, metadata }), {
29+
const indexFileContents = {
30+
indexFileVersion: 1,
31+
index,
32+
metadata
33+
};
34+
35+
const data = await util.promisify(zlib.brotliCompress)(bson.serialize(indexFileContents), {
2936
params: {
3037
[zlib.constants.BROTLI_PARAM_QUALITY]: zlib.constants.BROTLI_MAX_QUALITY
3138
}

0 commit comments

Comments
 (0)