Skip to content

Commit 723acb2

Browse files
author
Phil Varner
authored
Convert CommonJS module use to ESM (#371)
1 parent 9e45dce commit 723acb2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+7821
-5791
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
tsconfig.tsbuildinfo
12
coverage
23
node_modules
34
dist/

.npm-upgrade.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111
"@types/node": {
1212
"versions": "^18",
1313
"reason": "using 16"
14-
},
15-
"got": {
16-
"versions": "^12",
17-
"reason": "esm"
18-
},
19-
"crypto-random-string": {
20-
"versions": "",
21-
"reason": "esm"
2214
}
2315
}
2416
}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased - TBD
9+
10+
### Changed
11+
12+
- ESM modules are used instead of CommonJS
13+
814
## [0.6.0] - 2023-01-24
915

1016
### Fixed

fixtures/collections.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const dynamicTemplates = require('./dynamicTemplates')
1+
import dynamicTemplates from './dynamicTemplates.js'
22

3-
const collectionsIndexConfiguration = function () {
3+
export default function () {
44
return {
55
mappings: {
66
numeric_detection: false,
7-
dynamic_templates: dynamicTemplates.templates,
7+
dynamic_templates: dynamicTemplates,
88
properties: {
99
'extent.spatial.bbox': { type: 'long' },
1010
'extent.temporal.interval': { type: 'date' },
@@ -15,7 +15,3 @@ const collectionsIndexConfiguration = function () {
1515
}
1616
}
1717
}
18-
19-
module.exports = {
20-
collectionsIndexConfiguration
21-
}

fixtures/dynamicTemplates.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// these are attributes that can appear in multiple places in a STAC entity
2-
const templates = [
2+
export default [
33
// Common https://github.com/radiantearth/stac-spec/blob/master/item-spec/common-metadata.md
44
{
55
descriptions: {
@@ -64,7 +64,3 @@ const templates = [
6464
}
6565
}
6666
]
67-
68-
module.exports = {
69-
templates
70-
}

fixtures/items.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const dynamicTemplates = require('./dynamicTemplates')
1+
import dynamicTemplates from './dynamicTemplates.js'
22

3-
const itemsIndexConfiguration = function () {
4-
const numberOfShards = process.env.ITEMS_INDICIES_NUM_OF_SHARDS
5-
const numberOfReplicas = process.env.ITEMS_INDICIES_NUM_OF_REPLICAS
3+
export default function () {
4+
const numberOfShards = process.env['ITEMS_INDICIES_NUM_OF_SHARDS']
5+
const numberOfReplicas = process.env['ITEMS_INDICIES_NUM_OF_REPLICAS']
66

77
const config = {}
88

@@ -16,7 +16,7 @@ const itemsIndexConfiguration = function () {
1616

1717
config.mappings = {
1818
numeric_detection: false,
19-
dynamic_templates: dynamicTemplates.templates,
19+
dynamic_templates: dynamicTemplates,
2020
properties: {
2121
geometry: { type: 'geo_shape' },
2222
assets: { type: 'object', enabled: false },
@@ -44,7 +44,3 @@ const itemsIndexConfiguration = function () {
4444

4545
return config
4646
}
47-
48-
module.exports = {
49-
itemsIndexConfiguration
50-
}

0 commit comments

Comments
 (0)