Skip to content

Commit

Permalink
Version 4.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezze committed Jan 21, 2020
2 parents dadca4f + bcaff9f commit 91f714d
Show file tree
Hide file tree
Showing 17 changed files with 3,063 additions and 2,258 deletions.
11 changes: 5 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.idea
/coverage
/dist
/node_modules
/lib
/sgp4_verification/lib/sgp4
coverage
dist
node_modules
lib
sgp4_verification/lib/sgp4
*.log
package-lock.json

13 changes: 8 additions & 5 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
.idea
/commands
/coverage
/sgp4_verification
/src
/test
commands
coverage
sgp4_verification
src
test
.babelrc
.eslintignore
.eslintrc.json
.npmignore
.npmrc
.travis.yml
copyright-template.txt
rollup.*
package-lock.json
yarn.lock
*.log
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
language: node_js
node_js:
- "13"
- "12"
- "11"
- "10"
- "9"
- "8"
- "7"
- "6"
branches:
only:
- master
Expand Down
15 changes: 9 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Changelog

### 4.0.0 (2020-01-21)

- Node.js 12 support is added. Node.js 6 and Node.js 8 support is dropped (breaking change).
- Mocha, Chai and Istanbul are replaced by [Jest](https://jestjs.io/).
- Dependencies are upgraded.

### 3.0.1 (2019-03-14)

- Unnecessary calculations in `sgp4` function are reduced (#47).
Expand All @@ -19,8 +25,7 @@

### 2.0.2 (2018-04-16)

- [Wrong predictions for Molniya 3-47 orbits](https://github.com/shashwatak/satellite-js/issues/43) are fixed. Special
thanks to [@nhamer](https://github.com/nhamer).
- [Wrong predictions for Molniya 3-47 orbits](https://github.com/shashwatak/satellite-js/issues/43) are fixed. Special thanks to [@nhamer](https://github.com/nhamer).

### 2.0.1 (2018-03-01)

Expand All @@ -31,12 +36,10 @@ thanks to [@nhamer](https://github.com/nhamer).

- Library became ES and Common.js compatible.
- Source code is reorganized to match [original Python library](https://pypi.python.org/pypi/sgp4/).
- `degreesLat` and `degreesLong` don't adjust input radians value and throw `RangeError` if it's out of bounds
(breaking change).
- `degreesLat` and `degreesLong` don't adjust input radians value and throw `RangeError` if it's out of bounds (breaking change).
- `invjday` function is added.
- [Julian day calculations take account of milliseconds](https://github.com/shashwatak/satellite-js/issues/31)
([#38](https://github.com/shashwatak/satellite-js/pull/38)).
- [Incorrect position and velocity bug](https://github.com/shashwatak/satellite-js/issues/26) for times not close to
TLE epoch is fixed ([#37](https://github.com/shashwatak/satellite-js/pull/37)).
- [Incorrect position and velocity bug](https://github.com/shashwatak/satellite-js/issues/26) for times not close to TLE epoch is fixed ([#37](https://github.com/shashwatak/satellite-js/pull/37)).
- Continuous integration and test coverage are provided.
- [Bower support is dropped](https://github.com/shashwatak/satellite-js/issues/40).
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ var positionAndVelocity = satellite.sgp4(satrec, time);

```js
// Sample TLE
var tleLine1 = '1 25544U 98067A 13149.87225694 .00009369 00000-0 16828-3 0 9031',
tleLine2 = '2 25544 051.6485 199.1576 0010128 012.7275 352.5669 15.50581403831869';
var tleLine1 = '1 25544U 98067A 19156.50900463 .00003075 00000-0 59442-4 0 9992',
tleLine2 = '2 25544 51.6433 59.2583 0008217 16.4489 347.6017 15.51174618173442';

// Initialize a satellite record
var satrec = satellite.twoline2satrec(tleLine1, tleLine2);
Expand Down
56 changes: 27 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "satellite.js",
"version": "3.0.1",
"version": "4.0.0",
"description": "SGP4/SDP4 calculation library",
"main": "lib/index.js",
"jsnext:main": "dist/satellite.es.js",
Expand All @@ -15,11 +15,11 @@
"dist:umd:prod": "cross-env NODE_ENV=production npm run dist:umd && node --require @babel/register commands/add-copyright.js 'dist/**/satellite.min.js'",
"watch:es": "node --require @babel/register rollup.watch.es.js",
"copy": "copyfiles -u 1 'dist/**/*' sgp4_verification/lib/sgp4",
"lint": "eslint ./src",
"lint:test": "eslint -c test/.eslintrc.json ./test",
"test": "mocha --recursive --require @babel/register test",
"test:coverage": "rimraf coverage && istanbul cover _mocha -- --recursive --require @babel/register test",
"test:coveralls": "npm run test:coverage && cat ./coverage/lcov.info | coveralls",
"lint": "eslint src",
"lint:test": "eslint test",
"test": "jest",
"test:coverage": "jest --coverage",
"test:coveralls": "npm run test:coverage && cat coverage/lcov.info | coveralls",
"prepublishOnly": "npm run lint && npm run lint:test && npm test && npm run build"
},
"repository": {
Expand All @@ -40,30 +40,28 @@
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.1.5",
"@babel/core": "^7.1.6",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"@babel/register": "^7.0.0",
"chai": "^4.2.0",
"chokidar": "^2.0.4",
"copyfiles": "^2.1.0",
"coveralls": "^3.0.2",
"cross-env": "^5.2.0",
"eslint": "^5.9.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.14.0",
"glob": "^7.1.3",
"istanbul": "^1.1.0-alpha.1",
"mocha": "^5.2.0",
"@babel/cli": "^7.8.3",
"@babel/core": "^7.8.3",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-json-strings": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@babel/register": "^7.8.3",
"chokidar": "^3.3.1",
"copyfiles": "^2.2.0",
"coveralls": "^3.0.9",
"cross-env": "^6.0.3",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.20.0",
"glob": "^7.1.6",
"jest": "^24.9.0",
"prepend-file": "^1.3.1",
"rimraf": "^2.6.2",
"rollup": "^0.67.3",
"rollup-plugin-babel": "^4.0.3",
"rollup-plugin-uglify": "^6.0.0",
"rimraf": "^3.0.0",
"rollup": "^1.29.1",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-uglify": "^6.0.4",
"uglify-es": "^3.3.9"
},
"homepage": "https://github.com/shashwatak/satellite-js",
Expand Down
5 changes: 1 addition & 4 deletions test/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"extends": "airbnb-base",
"env": {
"mocha": true
},
"rules": {
"function-paren-newline": "off"
"jest": true
}
}
20 changes: 8 additions & 12 deletions test/compareVectors.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import chai from 'chai';

chai.should();

export default function compareVectors(vector1, vector2, epsilon) {
if (!epsilon) {
vector1.x.should.equal(vector2.x);
vector1.y.should.equal(vector2.y);
vector1.z.should.equal(vector2.z);
export default function compareVectors(vector1, vector2, numDigits) {
if (!numDigits) {
expect(vector1.x).toEqual(vector2.x);
expect(vector1.y).toEqual(vector2.y);
expect(vector1.z).toEqual(vector2.z);
} else {
vector1.x.should.be.closeTo(vector2.x, epsilon);
vector1.y.should.be.closeTo(vector2.y, epsilon);
vector1.z.should.be.closeTo(vector2.z, epsilon);
expect(vector1.x).toBeCloseTo(vector2.x, numDigits);
expect(vector1.y).toBeCloseTo(vector2.y, numDigits);
expect(vector1.z).toBeCloseTo(vector2.z, numDigits);
}
}
4 changes: 0 additions & 4 deletions test/dopplerFactor.spec.js → test/dopplerFactor.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import chai from 'chai';

import dopplerFactor from '../src/dopplerFactor'; // eslint-disable-line

chai.should();

describe('Doppler factor', () => {
it('doppler factor', () => {
// TODO:
Expand Down
30 changes: 13 additions & 17 deletions test/ext.spec.js → test/ext.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import chai from 'chai';

import compareVectors from './compareVectors';

import {
Expand All @@ -9,17 +7,15 @@ import {
import twoline2satrec from '../src/io';
import { propagate, gstime } from '../src/propagation';

chai.should();

describe('Julian date / time', () => {
let now;
before(() => {
beforeAll(() => {
now = new Date();
});

describe('jday & invjday', () => {
it('gives the same result with different arguments describing the same time', () => {
jday(now).should.equal(jday(
expect(jday(now)).toEqual(jday(
now.getUTCFullYear(),
now.getUTCMonth() + 1,
now.getUTCDate(),
Expand Down Expand Up @@ -52,7 +48,7 @@ describe('Julian date / time', () => {
date.getUTCMilliseconds(),
);

jdayNoMs.should.not.equal(jdayMs);
expect(jdayNoMs).not.toEqual(jdayMs);
});

it('outputs different results with millisecond precision', () => {
Expand All @@ -76,30 +72,30 @@ describe('Julian date / time', () => {
now.getUTCMilliseconds(),
);

jday1.should.not.equal(jday2);
expect(jday1).not.toEqual(jday2);
});

it('invjday gives the same result as date and array', () => {
const jd = jday(now);
const date = invjday(jd);
const dateArray = invjday(jd, true);
date.getUTCFullYear().should.equal(dateArray[0]);
(date.getUTCMonth() + 1).should.equal(dateArray[1]);
date.getUTCDate().should.equal(dateArray[2]);
date.getUTCHours().should.equal(dateArray[3]);
date.getUTCMinutes().should.equal(dateArray[4]);
date.getUTCSeconds().should.equal(dateArray[5]);
expect(date.getUTCFullYear()).toEqual(dateArray[0]);
expect(date.getUTCMonth() + 1).toEqual(dateArray[1]);
expect(date.getUTCDate()).toEqual(dateArray[2]);
expect(date.getUTCHours()).toEqual(dateArray[3]);
expect(date.getUTCMinutes()).toEqual(dateArray[4]);
expect(date.getUTCSeconds()).toEqual(dateArray[5]);
});

it('date to jday and inverse conversion', () => {
const jd = jday(now);
(invjday(jd).getTime() / 1000).should.be.closeTo(
((now.getTime() - now.getMilliseconds()) / 1000), 1);
const expected = ((now.getTime() - now.getMilliseconds()) / 1000);
expect(invjday(jd).getTime() / 1000).toEqual(expected);
});
});

it('gstime gives the same result with different arguments describing the same time', () => {
gstime(now).should.equal(gstime(
expect(gstime(now)).toEqual(gstime(
now.getUTCFullYear(),
now.getUTCMonth() + 1,
now.getUTCDate(),
Expand Down
Loading

0 comments on commit 91f714d

Please sign in to comment.