Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
|
dgozman
2016/10/24 18:26:00
Should we rename this one as well to follow snake_
chenwilliam
2016/10/24 22:57:12
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var path = require("path"); | 5 var path = require("path"); |
| 6 | 6 |
| 7 var jsonfile = require("jsonfile"); | 7 var jsonfile = require("jsonfile"); |
| 8 | 8 |
| 9 var utils = require("../utils"); | 9 var utils = require("../utils"); |
| 10 | 10 |
| 11 module.exports = function main(protocols, output) | 11 module.exports = function main(protocols, output) |
| 12 { | 12 { |
| 13 var domains = []; | 13 var domains = []; |
| 14 var version; | 14 var version; |
| 15 for (var i = 0; i < protocols.length; i++) { | 15 for (var i = 0; i < protocols.length; i++) { |
| 16 var protocol = protocols[i]; | 16 var protocol = protocols[i]; |
| 17 if (!utils.isFile(protocol)) | 17 if (!utils.isFile(protocol)) |
| 18 throw new Error(`Cannot find ${protocol}`); | 18 throw new Error(`Cannot find ${protocol}`); |
| 19 var json = require(protocol); | 19 var json = require(protocol); |
| 20 domains = domains.concat(json.domains); | 20 domains = domains.concat(json.domains); |
| 21 version = json.version; | 21 version = json.version; |
| 22 } | 22 } |
| 23 var combinedProtocol = { | 23 var combinedProtocol = { |
| 24 version, | 24 version, |
| 25 domains | 25 domains |
| 26 }; | 26 }; |
| 27 jsonfile.writeFileSync(output, combinedProtocol, {spaces: 4}); | 27 jsonfile.writeFileSync(output, combinedProtocol, {spaces: 4}); |
| 28 }; | 28 }; |
| OLD | NEW |