@ham2k/lib-cqmag-data 0.0.15 β 0.1.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.
- package/jest.config.js +1 -0
- package/package.json +4 -3
- package/scripts/generate.js +6 -6
- package/src/index.js +7 -8
- package/src/lib/preprocessing.js +3 -6
- package/src/lib/preprocessing.spec.js +3 -2
package/jest.config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default { transform: {} }
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ham2k/lib-cqmag-data",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./src/index.js",
|
|
5
6
|
"exports": {
|
|
6
7
|
".": "./src/index.js"
|
|
7
8
|
},
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
},
|
|
14
15
|
"scripts": {
|
|
15
16
|
"generate": "node ./scripts/generate.js",
|
|
16
|
-
"test": "jest"
|
|
17
|
+
"test": "node --experimental-vm-modules ./node_modules/.bin/jest"
|
|
17
18
|
},
|
|
18
19
|
"standard": {
|
|
19
20
|
"env": [
|
package/scripts/generate.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import { preprocessCQWWData } from '../src/lib/preprocessing.js'
|
|
4
|
+
import { ENTITIES } from '@ham2k/lib-dxcc-data'
|
|
5
5
|
|
|
6
6
|
console.log('Generating CQWW json')
|
|
7
7
|
|
|
8
8
|
const cqww = preprocessCQWWData(ENTITIES)
|
|
9
9
|
|
|
10
|
-
fs.writeFileSync(
|
|
11
|
-
fs.writeFileSync(
|
|
10
|
+
fs.writeFileSync('src/data/cqwwByPrefix.json', JSON.stringify(cqww), 'utf8')
|
|
11
|
+
fs.writeFileSync('src/data/cqww.json', JSON.stringify(Object.values(cqww)), 'utf8')
|
|
12
12
|
|
|
13
13
|
console.log('CQ WW Entities written to data/cqww.json and cqwwByPrefix.json')
|
|
14
14
|
console.log('')
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import cqZones from '../data/cqzones.json' assert { type: 'json' }
|
|
2
|
+
import stateZones from '../data/cqz-for-states.json' assert { type: 'json' }
|
|
3
|
+
import cqww from './data/cqwwByPrefix.json' assert { type: 'json' }
|
|
4
|
+
|
|
5
|
+
export const CQZONES = cqZones
|
|
6
|
+
export const CQZONES_FOR_STATES = stateZones
|
|
7
|
+
export const CQWW_ENTITIES = cqww
|
|
4
8
|
|
|
5
|
-
module.exports = {
|
|
6
|
-
CQZONES,
|
|
7
|
-
CQZONES_FOR_STATES,
|
|
8
|
-
CQWW_ENTITIES
|
|
9
|
-
}
|
package/src/lib/preprocessing.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// const { parse } = require("csv/dist/cjs/sync.cjs") // Use this line when running tests
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { CTYData } from '@ham2k/lib-country-files/builtinData'
|
|
4
|
+
import WAE from '../../data/wae.json' assert { type: 'json' }
|
|
5
5
|
|
|
6
|
-
function preprocessCQWWData (dxcc) {
|
|
6
|
+
export function preprocessCQWWData (dxcc) {
|
|
7
7
|
const cqww = {}
|
|
8
8
|
|
|
9
9
|
Object.keys(dxcc).forEach((code) => {
|
|
@@ -28,6 +28,3 @@ function preprocessCQWWData (dxcc) {
|
|
|
28
28
|
return cqww
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
module.exports = {
|
|
32
|
-
preprocessCQWWData
|
|
33
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { preprocessCQWWData } from './preprocessing'
|
|
2
|
+
import { ENTITIES } from '@ham2k/lib-dxcc-data'
|
|
3
3
|
|
|
4
4
|
/* eslint dot-notation: 0 */
|
|
5
5
|
|
|
@@ -26,6 +26,7 @@ describe('preprocessCQWWData', () => {
|
|
|
26
26
|
|
|
27
27
|
expect(cqww['*4U1V'].dxccName).toEqual('Austria')
|
|
28
28
|
expect(cqww['*4U1V'].name).toEqual('UN Vienna Int. Center')
|
|
29
|
+
expect(cqww['*4U1V'].flag).toEqual('πΊπ³')
|
|
29
30
|
|
|
30
31
|
expect(cqww['*GM/s'].dxccName).toEqual('Scotland')
|
|
31
32
|
expect(cqww['*GM/s'].name).toEqual('Shetland Is.')
|