@hebcal/geo-sqlite 5.8.0 → 5.9.0

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,20 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {makeZipsSqlite} from '@hebcal/geo-sqlite';
4
+ import {createRequire} from 'module';
5
+ import path from 'path';
6
+
7
+ const require = createRequire(import.meta.url);
8
+ const pkgPath = require.resolve('@hebcal/geo-sqlite/package.json');
9
+ const defaultSqlFile = path.join(path.dirname(pkgPath), 'zips-dummy.sql');
10
+
11
+ const args = process.argv.slice(2);
12
+ if (args.length < 1 || args.length > 2) {
13
+ console.log('Usage: make-zips-sqlite zips.sqlite3 [zips-dummy.sql]');
14
+ process.exit(1);
15
+ }
16
+
17
+ const dbFilename = args[0];
18
+ const sqlFile = args[1] || defaultSqlFile;
19
+ makeZipsSqlite(dbFilename, sqlFile);
20
+ console.log('Done!');
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/geo-sqlite v5.8.0 */
1
+ /*! @hebcal/geo-sqlite v5.9.0 */
2
2
  import Database from 'better-sqlite3';
3
3
  import QuickLRU from 'quick-lru';
4
4
  import { Location, Locale } from '@hebcal/core';
@@ -511,7 +511,7 @@ function munge(s) {
511
511
  }
512
512
 
513
513
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
514
- const version = '5.8.0';
514
+ const version = '5.9.0';
515
515
 
516
516
  const GEONAME_SQL = `SELECT
517
517
  g.name as name,
@@ -1436,4 +1436,16 @@ async function doFile(logger, db, infile, tableName, expectedFields, callback) {
1436
1436
  });
1437
1437
  }
1438
1438
 
1439
- export { GeoDb, buildGeonamesSqlite };
1439
+ /**
1440
+ * Builds `zips.sqlite3` from the bundled zips-dummy.sql schema file
1441
+ * @param {string} dbFilename path to the output SQLite database file
1442
+ * @param {string} sqlFile path to the SQL schema file
1443
+ */
1444
+ function makeZipsSqlite(dbFilename, sqlFile) {
1445
+ const sql = fs.readFileSync(sqlFile, 'utf8');
1446
+ const db = new Database(dbFilename);
1447
+ db.exec(sql);
1448
+ db.close();
1449
+ }
1450
+
1451
+ 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.0",
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",