Skip to content

Commit

Permalink
Merge pull request #18 from koopjs/updates
Browse files Browse the repository at this point in the history
feat: read .json files
  • Loading branch information
rgwozdz authored Aug 21, 2023
2 parents 9dac95b + df98b60 commit 4bad149
Show file tree
Hide file tree
Showing 21 changed files with 13,438 additions and 4,302 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
env: {
commonjs: true,
es6: true,
mocha: true,
jest: true,
node: true
},
extends: 'eslint:recommended',
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
process: 'readonly',
console: 'readonly',
__dirname: 'readonly',
fail: 'readonly'
},
parserOptions: {
ecmaVersion: 2022,
},
rules: {
'no-unused-vars': ['error', { ignoreRestSiblings: true }],
indent: ['error', 2, {'SwitchCase': 1}],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'always'],
},
};
45 changes: 45 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI tests

on:
push:
branches: [ master ]
pull_request:
branches:
- master
- next
- beta
paths:
- "./.github/**.yml"
- "**/src/**.js"
- "./package.json"

jobs:
pr-tests:
name: Install, lint, test
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
os: [ubuntu-latest]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install npm 7
run: npm i -g npm@7 --registry=https://registry.npmjs.org

- name: Install
run: npm ci

- name: Lint
run: npm run lint:ci

- name: Unit tests
run: npm test

- name: E2E tests
run: npm test
74 changes: 74 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '35 13 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ test/test.log.**
.vscode
.idea
dist
.DS_Store
.DS_Store
coverage
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2,
"useTabs": false
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased
* allow files with .geojson or .json file extension

## [2.1.0] - 2023-01-24
### Changed
* prefer use of data directory path from Model's options argument
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2018 Esri
Copyright 2023 Esri

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
6 changes: 6 additions & 0 deletions demo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const Koop = require('@koopjs/koop-core');
const provider = require('../index');

const koop = new Koop({ });
koop.register(provider, { dataDir: './demo/provider-data'});
koop.server.listen(9999);
83 changes: 83 additions & 0 deletions demo/provider-data/line.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"foo": "bar"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-120.948486328125,
46.882723010671945
],
[
-121.47583007812501,
47.53203824675999
],
[
-121.058349609375,
47.64318610543658
],
[
-121.19018554687499,
47.96785877999251
],
[
-121.6845703125,
47.87214396888731
],
[
-121.761474609375,
48.011975126709956
],
[
-121.59667968749999,
48.100094697973795
]
]
}
},
{
"type": "Feature",
"properties": {
"foo": "baz"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-120.948486328125,
46.882723010671945
],
[
-121.47583007812501,
47.53203824675999
],
[
-121.058349609375,
47.64318610543658
],
[
-121.19018554687499,
47.96785877999251
],
[
-121.6845703125,
47.87214396888731
],
[
-121.761474609375,
48.011975126709956
],
[
-121.59667968749999,
48.100094697973795
]
]
}
}
]
}
18 changes: 18 additions & 0 deletions demo/provider-data/point-3857.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"type": "FeatureCollection",
"crs": {
"properties": {
"name": "urn:ogc:def:crs:EPSG::3857"
}
},
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [-11682713.391976157203317, 4857924.005275469273329]
}
}
]
}
44 changes: 44 additions & 0 deletions demo/provider-data/point-fc.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"foo": "2023-04-10T16:15:30.000Z"
},
"geometry": {
"type": "Point",
"coordinates": [
-104.9476,
39.9448
]
}
},
{
"type": "Feature",
"properties": {
"foo": "2020-04-10T16:15:30.000Z"
},
"geometry": {
"type": "Point",
"coordinates": [
-104.9476,
39.9448
]
}
},
{
"type": "Feature",
"properties": {
"foo": "2015-04-10T16:15:30.000Z"
},
"geometry": {
"type": "Point",
"coordinates": [
-104.9476,
39.9448
]
}
}
]
}
16 changes: 16 additions & 0 deletions demo/provider-data/point.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
-104.9476,
39.9448
]
}
}
]
}
Loading

0 comments on commit 4bad149

Please sign in to comment.