Skip to content

Commit

Permalink
Remove the import asserts
Browse files Browse the repository at this point in the history
In this project we are only using these in Node, so we can just use `fs.readFileSync` instead
  • Loading branch information
bhousel committed Sep 10, 2024
1 parent 806af85 commit b044a95
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/write_file_with_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'node:fs';
import JSON5 from 'json5';

// JSON
import packageJSON from '../package.json' assert {type: 'json'};
const packageJSON = JSON5.parse(fs.readFileSync('package.json', 'utf8'));

const URLRoot = 'https://raw.githubusercontent.com/osmlab/osm-community-index/main';

Expand Down
6 changes: 3 additions & 3 deletions scripts/build_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import { simplify } from '../lib/simplify.js';
import { writeFileWithMeta } from '../lib/write_file_with_meta.js';

// JSON
import geojsonSchemaJSON from '../schema/geojson.json' assert {type: 'json'};
import featureSchemaJSON from '../schema/feature.json' assert {type: 'json'};
import resourceSchemaJSON from '../schema/resource.json' assert {type: 'json'};
const geojsonSchemaJSON = JSON5.parse(fs.readFileSync('schema/geojson.json', 'utf8'));
const featureSchemaJSON = JSON5.parse(fs.readFileSync('schema/feature.json', 'utf8'));
const resourceSchemaJSON = JSON5.parse(fs.readFileSync('schema/resource.json', 'utf8'));

const Validator = jsonschema.Validator;
let v = new Validator();
Expand Down
7 changes: 4 additions & 3 deletions scripts/dist_files.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import { resolveStrings } from '../lib/resolve_strings.js';
import { writeFileWithMeta } from '../lib/write_file_with_meta.js';

// JSON
import featureCollectionJSON from '../dist/featureCollection.json' assert {type: 'json'};
import resourcesJSON from '../dist/resources.json' assert {type: 'json'};
import defaultsJSON from '../defaults.json' assert {type: 'json'};
const featureCollectionJSON = JSON5.parse(fs.readFileSync('dist/featureCollection.json', 'utf8'));
const resourcesJSON = JSON5.parse(fs.readFileSync('dist/resources.json', 'utf8'));
const defaultsJSON = JSON5.parse(fs.readFileSync('defaults.json', 'utf8'));

const resources = resourcesJSON.resources;
const defaults = defaultsJSON.defaults;

Expand Down

0 comments on commit b044a95

Please sign in to comment.