@hebcal/geo-sqlite 5.8.0 → 5.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,6 +39,8 @@ $CURDIR/node_modules/.bin/build-geonames-sqlite \
39
39
 
40
40
  rm -rf $TMPDIR
41
41
 
42
- sqlite3 -echo zips.sqlite3 < "$CURDIR/node_modules/@hebcal/geo-sqlite/zips-dummy.sql"
42
+ $CURDIR/node_modules/.bin/make-zips-sqlite \
43
+ $CURDIR/zips.sqlite3 \
44
+ "$CURDIR/node_modules/@hebcal/geo-sqlite/zips-dummy.sql"
43
45
 
44
46
  ls -lh geonames.sqlite3 zips.sqlite3
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {makeZipsSqlite} from '@hebcal/geo-sqlite';
4
+
5
+ const args = process.argv.slice(2);
6
+ if (args.length !== 2) {
7
+ console.log('Usage: make-zips-sqlite zips.sqlite3 zips-dummy.sql');
8
+ process.exit(1);
9
+ }
10
+
11
+ const dbFilename = args[0];
12
+ const sqlFile = args[1];
13
+ makeZipsSqlite(dbFilename, sqlFile);
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/geo-sqlite v5.8.0 */
1
+ /*! @hebcal/geo-sqlite v5.9.1 */
2
2
  import Database from 'better-sqlite3';
3
3
  import QuickLRU from 'quick-lru';
4
4
  import { Location, Locale } from '@hebcal/core';
@@ -7,6 +7,7 @@ import { transliterate } from 'transliteration';
7
7
  import events from 'events';
8
8
  import fs from 'fs';
9
9
  import readline from 'readline';
10
+ import fs$1 from 'node:fs';
10
11
 
11
12
  var city2geonameid = {
12
13
  "AD-Andorra La Vella":3041563,
@@ -511,7 +512,7 @@ function munge(s) {
511
512
  }
512
513
 
513
514
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
514
- const version = '5.8.0';
515
+ const version = '5.9.1';
515
516
 
516
517
  const GEONAME_SQL = `SELECT
517
518
  g.name as name,
@@ -1436,4 +1437,17 @@ async function doFile(logger, db, infile, tableName, expectedFields, callback) {
1436
1437
  });
1437
1438
  }
1438
1439
 
1439
- export { GeoDb, buildGeonamesSqlite };
1440
+ /**
1441
+ * Builds `zips.sqlite3` from the bundled zips-dummy.sql schema file
1442
+ * @param {string} dbFilename path to the output SQLite database file
1443
+ * @param {string} sqlFile path to the SQL schema file
1444
+ */
1445
+ function makeZipsSqlite(dbFilename, sqlFile) {
1446
+ const sql = fs$1.readFileSync(sqlFile, 'utf8');
1447
+ const db = new Database(dbFilename);
1448
+ console.log(sql);
1449
+ db.exec(sql);
1450
+ db.close();
1451
+ }
1452
+
1453
+ export { GeoDb, buildGeonamesSqlite, makeZipsSqlite };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/geo-sqlite",
3
- "version": "5.8.0",
3
+ "version": "5.9.1",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "hebcal"
@@ -14,7 +14,8 @@
14
14
  },
15
15
  "bin": {
16
16
  "build-geonames-sqlite": "bin/build-geonames-sqlite",
17
- "download-and-make-dbs": "bin/download-and-make-dbs"
17
+ "download-and-make-dbs": "bin/download-and-make-dbs",
18
+ "make-zips-sqlite": "bin/make-zips-sqlite"
18
19
  },
19
20
  "repository": {
20
21
  "type": "git",
@@ -64,7 +65,7 @@
64
65
  "@rollup/plugin-json": "^6.1.0",
65
66
  "@rollup/plugin-node-resolve": "^16.0.3",
66
67
  "ava": "^6.4.1",
67
- "eslint": "^10.0.1",
68
+ "eslint": "^10.0.2",
68
69
  "eslint-config-google": "^0.14.0",
69
70
  "eslint-plugin-n": "^17.24.0",
70
71
  "globals": "^17.3.0",