Skip to content

Commit 64fdd65

Browse files
authored
Version 3 (#95)
This is a complete rewrite using Typescript built on version 3 of `ogr2ogr`. The Ogre API and CLI remains mostly the same with the following notable changes: - BREAKING: Removed support for Node 10 - BREAKING: Using ogr2ogr version 3 as a backend. It may behave differently for some file types. - The CLI can now optionally take a `limit` parameter specifying the upload/body limit in bytes. - The UI now has the ability to input a `format`.
1 parent fe040fa commit 64fdd65

Some content is hidden

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

43 files changed

+671
-8226
lines changed

.eslintrc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
{
22
"root": true,
3-
"extends": ["eslint:recommended"],
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/recommended",
8+
"prettier"
9+
],
410
"env": {
511
"node": true,
612
"es6": true
713
},
814
"parserOptions": {
9-
"ecmaVersion": 8
15+
"sourceType": "module",
16+
"project": "./tsconfig.json",
17+
"ecmaVersion": 2019
1018
},
1119
"rules": {
12-
"no-console": 0,
13-
"no-var": 2,
14-
"require-atomic-updates": 0
20+
"prefer-const": 0,
21+
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_"}]
1522
}
1623
}

.github/workflows/build.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@ on:
77
jobs:
88
build:
99
runs-on: ubuntu-latest
10+
container:
11+
image: osgeo/gdal:ubuntu-small-latest
1012
strategy:
1113
matrix:
12-
node: ['10', '12', '14']
14+
node: ['12', '14']
1315
name: Node v${{ matrix.node }}
1416
steps:
1517
- uses: actions/checkout@v2
16-
- uses: actions/setup-node@v1
18+
- uses: actions/setup-node@v2
1719
with:
1820
node-version: ${{ matrix.node }}
19-
- run: sudo apt-get install gdal-bin
20-
- run: yarn install
21-
- run: yarn fmt-check
22-
- run: yarn lint
23-
- run: yarn test
21+
- run: npm install
22+
- run: npm run fmt-check
23+
- run: npm run lint
24+
- run: npm run test

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
node_modules
22
npm_debug.log
3+
ogr_*
34
.DS_Store
4-
.tern-port
5-
yarn-error.log
5+
coverage
6+
.nyc_output
67
yarn.lock
8+
dist

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testdata

changelog.md

Lines changed: 0 additions & 143 deletions
This file was deleted.

bin/ogre.js renamed to cli.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env node
2-
const ogre = require('../')
2+
import Ogre from './'
3+
import {version} from './package.json'
34

45
let args = process.argv.slice(2)
5-
let version = require('../package.json').version
66

77
let usage =
88
'' +
@@ -12,10 +12,12 @@ let usage =
1212
' -h, --help help\n' +
1313
' -p, --port port number (default 3000)\n' +
1414
' -v, --version version number\n' +
15-
' -t, --timeout timeout before ogre kills a job in ms (default 15000)\n'
15+
' -t, --timeout timeout before ogre kills a job in ms (default 15000)\n' +
16+
' -l, --limit byte limit for uploads (default 50000000)\n'
1617

1718
let port = 3000
18-
let timeout
19+
let timeout = 15000
20+
let limit = 50000000
1921

2022
let arg
2123
while (args.length) {
@@ -35,17 +37,23 @@ while (args.length) {
3537

3638
case '-p':
3739
case '--port':
38-
port = args.shift()
40+
port = Number(args.shift())
3941
break
4042

4143
case '-t':
4244
case '--timeout':
4345
timeout = Number(args.shift())
4446
break
4547

48+
case '-l':
49+
case '--limit':
50+
limit = Number(args.shift())
51+
break
52+
4653
default:
4754
}
4855
}
4956

50-
ogre.createServer({timeout: timeout}).listen(port)
51-
console.log('Ogre listening on port', port)
57+
let ogre = new Ogre({port, timeout, limit})
58+
ogre.start()
59+
console.log('Ogre (%s) ready. Port %d', version, port)

0 commit comments

Comments
 (0)