Skip to content

Commit

Permalink
Updates for generating a slimmer npm build. (#39)
Browse files Browse the repository at this point in the history
* Updates for generating a slimmer npm build.

* Finishing uncomitted thought.
  • Loading branch information
KD0NKS authored Sep 13, 2020
1 parent 174746b commit a5d1569
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 46 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.vscode
build/
coverage/
node_modules/
*.js
lib/
dist/
.nyc_output/

package-lock.json
package-lock.json
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.vscode
build/
coverage/
lib/
.nyc_output
node_modules/

package-lock.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# js-aprs-fap [![Build Status](https://travis-ci.org/KD0NKS/js-aprs-fap.svg?branch=master)](https://travis-ci.org/KD0NKS/js-aprs-fap) [![Coverage Status](https://coveralls.io/repos/github/KD0NKS/js-aprs-fap/badge.svg?branch=2019-03-18_CIIntegrations)](https://coveralls.io/github/KD0NKS/js-aprs-fap?branch=2019-03-18_CIIntegrations)
# js-aprs-fap ![npm](https://img.shields.io/npm/v/js-aprs-fap) [![Build Status](https://travis-ci.org/KD0NKS/js-aprs-fap.svg?branch=master)](https://travis-ci.org/KD0NKS/js-aprs-fap) [![Coverage Status](https://coveralls.io/repos/github/KD0NKS/js-aprs-fap/badge.svg?branch=2019-03-18_CIIntegrations)](https://coveralls.io/github/KD0NKS/js-aprs-fap?branch=2019-03-18_CIIntegrations)
APRS is a registered trademark Bob Bruninga, WB4APR.

This is an APRS parser based on [Ham::APRS::FAP](https://github.com/hessu/perl-aprs-fap) rewritten in JavaScript. Therefore, much of what
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@
"scripts": {
"tsc": "./node_modules/.bin/tsc",
"setup": "npm install",
"build": "tsc",
"build": "npm run tsc",
"test": "nyc mocha",
"coverage": "nyc report --reporter=text-lcov | coveralls"
"coverage": "nyc report --reporter=text-lcov | coveralls",
"prepare": "npm run build"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@types/chai": "^4.2.12",
"@types/mocha": "^8.0.3",
"@types/node": "^14.10.0",
"@types/node": "^14.10.1",
"chai": "^4.2.0",
"coveralls": "^3.1.0",
"mocha": "^8.1.3",
Expand Down
26 changes: 10 additions & 16 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ export default class aprsParser {
return this.addError(retVal, 'wx_unsupp', 'Positionless');
}
// Object
} else if($packettype == ';') {
} else if ($packettype == ';') {
// if($paclen >= 31) { is there a case where this couldn't be
retVal.type = 'object';

retVal = this.objectToDecimal(options, body, srcCallsign, retVal);
Expand All @@ -483,9 +484,12 @@ export default class aprsParser {
} else if(body.substr(0, 5) == '$ULTW') {
retVal.type = 'wx';
retVal = this._wx_parse_peet_packet(body.substr(5), srcCallsign, retVal);
} else {
}
/*
else {
throw new Error(`test 1 - ${retVal.origpacket}`);
}
*/
// Item
} else if ($packettype == ')') {
retVal.type = 'item';
Expand All @@ -497,9 +501,12 @@ export default class aprsParser {
retVal.type = 'message';

retVal = this.messageParse(body, retVal);
} else {
}
/*
else {
throw new Error(`test 2 - ${retVal.origpacket}`);
}
*/
// Station capabilities
} else if($packettype == '<') {
// at least one other character besides '<' required
Expand Down Expand Up @@ -1082,18 +1089,6 @@ export default class aprsParser {
let $second;

if((tmp = nmeafields[1].match(/^\s*(\d{2})(\d{2})(\d{2})(|\.\d+)\s*$/))) {
if(parseInt(tmp[1]) > 23) {
console.log(`if 1 - ${$rethash.origpacket}`);
}

if(parseInt(tmp[2]) > 59) {
console.log(`if 2 - ${$rethash.origpacket}`);
}

if(parseInt(tmp[3]) > 59) {
console.log(`if 3 - ${$rethash.origpacket}`);
}

// if seconds has a decimal part, ignore it
// leap seconds are not taken into account...
if(parseInt(tmp[1]) > 23 || parseInt(tmp[2]) > 59 || parseInt(tmp[3]) > 59) {
Expand Down Expand Up @@ -1682,7 +1677,6 @@ export default class aprsParser {
let $mice_fixed;
let $symboltable = $packet.charAt(7);

// TODO: Too sober to figure this out right now...
if(!(tmp = $packet.match(/^[\x26-\x7f][\x26-\x61][\x1c-\x7f]{2}[\x1c-\x7d][\x1c-\x7f][\x21-\x7b\x7d][\/\\A-Z0-9]/))) {
// If the accept_broken_mice option is given, check for a known
// corruption in the packets and try to fix it - aprsd is
Expand Down
50 changes: 25 additions & 25 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"target": "esnext",
"noImplicitAny": true,
"removeComments": true,
"allowJs": false,
"preserveConstEnums": true,
"outDir": "dist",
"sourceMap": true,
"declaration": true
},
"include": [
"index.ts"
, "src/**/*"
, "test/**/*"
],
"exclude": [
".nyc_output",
"bin",
"dist",
"coverage",
"node_modules"
]
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"target": "esnext",
"noImplicitAny": true,
"removeComments": true,
"allowJs": false,
"preserveConstEnums": true,
"outDir": "dist",
"sourceMap": true,
"declaration": true,
"resolveJsonModule": true
},
"include": [
"index.ts"
, "src/**/*"
],
"exclude": [
".nyc_output",
"bin",
"dist",
"coverage",
"node_modules"
]
}

0 comments on commit a5d1569

Please sign in to comment.