Skip to content

Commit

Permalink
Better output from the build system
Browse files Browse the repository at this point in the history
  • Loading branch information
specious committed Aug 3, 2022
1 parent dcb61c2 commit fa195fc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function isTemplateFile(file) {
function readMetadataFile(file, metadata, countryNames) {
var locationName = path.basename(file, ".metadata.json");

console.log("Loading data: " + locationName);
console.log("Reading data:", locationName);

// Flag error and exit if metadata is not found
if (!fs.existsSync(file)) {
Expand Down Expand Up @@ -169,7 +169,9 @@ function readMetadataFile(file, metadata, countryNames) {
metadata[locationName].sampleLatLon = latLon;
}

// Write combined metadata file from individual location metadata files
//
// Build a single metadata file
//
glob("public/data/**/*.metadata.json", function (err, files) {
var metadata = {};
var countryNames = ["U.S."];
Expand All @@ -187,15 +189,16 @@ glob("public/data/**/*.metadata.json", function (err, files) {
});

var metadataFileContents =
"//\n// This file is AUTO-GENERATED each time the " +
"application is restarted.\n//\n\n" +
"//\n// This file is AUTO-GENERATED each time by the build system.\n//\n\n" +
"var CITY_DATA = " +
JSON.stringify(metadata) +
";\n" +
"var COUNTRY_NAMES = " +
JSON.stringify(countryNames) +
";\n";
fs.writeFileSync("public/js/data.js", metadataFileContents);

console.log();
console.log("Writing file: public/js/data.js");

fs.writeFileSync("public/js/data.js", metadataFileContents);
});

0 comments on commit fa195fc

Please sign in to comment.