@hebcal/geo-sqlite 5.9.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.
- package/bin/make-zips-sqlite +3 -10
- package/dist/index.js +5 -3
- package/package.json +1 -1
package/bin/make-zips-sqlite
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
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
4
|
|
|
11
5
|
const args = process.argv.slice(2);
|
|
12
|
-
if (args.length
|
|
13
|
-
console.log('Usage: make-zips-sqlite zips.sqlite3
|
|
6
|
+
if (args.length !== 2) {
|
|
7
|
+
console.log('Usage: make-zips-sqlite zips.sqlite3 zips-dummy.sql');
|
|
14
8
|
process.exit(1);
|
|
15
9
|
}
|
|
16
10
|
|
|
17
11
|
const dbFilename = args[0];
|
|
18
|
-
const sqlFile = args[1]
|
|
12
|
+
const sqlFile = args[1];
|
|
19
13
|
makeZipsSqlite(dbFilename, sqlFile);
|
|
20
|
-
console.log('Done!');
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/geo-sqlite v5.9.
|
|
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.9.
|
|
515
|
+
const version = '5.9.1';
|
|
515
516
|
|
|
516
517
|
const GEONAME_SQL = `SELECT
|
|
517
518
|
g.name as name,
|
|
@@ -1442,8 +1443,9 @@ async function doFile(logger, db, infile, tableName, expectedFields, callback) {
|
|
|
1442
1443
|
* @param {string} sqlFile path to the SQL schema file
|
|
1443
1444
|
*/
|
|
1444
1445
|
function makeZipsSqlite(dbFilename, sqlFile) {
|
|
1445
|
-
const sql = fs.readFileSync(sqlFile, 'utf8');
|
|
1446
|
+
const sql = fs$1.readFileSync(sqlFile, 'utf8');
|
|
1446
1447
|
const db = new Database(dbFilename);
|
|
1448
|
+
console.log(sql);
|
|
1447
1449
|
db.exec(sql);
|
|
1448
1450
|
db.close();
|
|
1449
1451
|
}
|