Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Candidate for 1.0.0 #1

Merged
merged 33 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3215f22
fix: :bug: use date object instead of realtime date
thkruz Jan 11, 2024
7f5d7c7
refactor: :recycle: move moon code to moon
thkruz Jan 11, 2024
4c2d701
test: :white_check_mark: fix tests
thkruz Jan 11, 2024
65a6782
refactor: :recycle: refactor GroundPosition from Sensor
thkruz Jan 11, 2024
16c336b
refactor: :truck: organize interfaces and enums
thkruz Jan 11, 2024
64116c8
feat: :sparkles: add examples and reduce dependencies
thkruz Jan 11, 2024
b5b506a
refactor: :recycle: combine Tle classes and improve documentation
thkruz Jan 11, 2024
d4ddcf3
fix: :white_check_mark: fix broken tests
thkruz Jan 11, 2024
732a270
fix: :sparkles: implement both commonjs and modules
thkruz Jan 13, 2024
423b80d
1.0.0-1
thkruz Jan 13, 2024
b1515cb
refactor: :recycle: implement strict checks in tsconfig
thkruz Jan 13, 2024
5581a18
refactor: :recycle: standardize eci and rae methods
thkruz Jan 13, 2024
2e2672f
docs: :memo: update package.json
thkruz Jan 13, 2024
adb58fa
feat: :sparkles: sync all commonjs es5 and typescript examples
thkruz Jan 13, 2024
8f29fcc
1.0.0-2
thkruz Jan 13, 2024
02f0922
docs: :memo: update docs
thkruz Jan 13, 2024
531a0da
fix: :adhesive_bandage: fix case-sensitive issue
thkruz Jan 13, 2024
7b8149f
ci: :construction_worker: update ci pipeline
thkruz Jan 13, 2024
54612c5
build: :green_heart: fix eslint scripts
thkruz Jan 13, 2024
d82cb6c
ci: :construction_worker: update ci pipeline
thkruz Jan 13, 2024
af82e8a
build: :heavy_plus_sign: add rimraf
thkruz Jan 13, 2024
06340e0
build: :heavy_minus_sign: replace rimraf with fs
thkruz Jan 13, 2024
3f8f78b
ci: :green_heart: fix issue with package.json
thkruz Jan 13, 2024
a8c2128
ci: :green_heart: reorder ci
thkruz Jan 13, 2024
21a2971
ci: :green_heart: fix ci pipeline
thkruz Jan 13, 2024
25ce2b5
ci: :adhesive_bandage: make ci pipeline sequential
thkruz Jan 13, 2024
834e559
ci: :adhesive_bandage: make ci pipeline sequential
thkruz Jan 13, 2024
e5444c3
Merge branch 'develop' of https://github.com/thkruz/ootk-core into de…
thkruz Jan 13, 2024
092de4e
ci: :adhesive_bandage: make ci pipeline sequential
thkruz Jan 13, 2024
f855124
Merge branch 'develop' of https://github.com/thkruz/ootk-core into de…
thkruz Jan 13, 2024
4248aba
test: :white_check_mark: fix tests
thkruz Jan 13, 2024
dd51ed2
fix: :bug: fix time object being mutated
thkruz Jan 13, 2024
a13c511
test: :white_check_mark: fix test impacted by time zone differences
thkruz Jan 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/dist
/lib
/src/sgp4/asc
/examples/commonjs/satellite-js-migration.js
/examples/mjs/satellite-js-migration.mjs
95 changes: 46 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,78 +3,75 @@ name: CI
on: [pull_request]

jobs:
build:
compliance:
name: NPM Audit Report
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Load cached modules
uses: actions/cache@v2
# Checkout Code
- name: Checkout Code
uses: actions/checkout@v4
# Audit Package.json
- name: NPM Audit Action
uses: oke-py/npm-audit-action@main
with:
path: |
**/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
github_token: ${{ secrets.GITHUB_TOKEN }}
lint:
needs: compliance
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- name: Load Node.js latest
uses: actions/setup-node@v2-beta
- uses: actions/[email protected]
with:
node-version: '17.x'
node-version: '20.x'

- name: Install all dependencies
run: npm install
- run: npm ci --ignore-scripts

- name: Compile TypeScript and build UMD files
run: npm run build

lint:
name: lint
needs: build
- run: npm run lint
build:
needs: lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/[email protected]

- name: Use Node.js latest
uses: actions/setup-node@v2-beta
- uses: actions/[email protected]
with:
node-version: '17.x'
node-version: '20.x'

- name: Get cached modules
uses: actions/cache@v2
- uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
**/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
**/lib
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Run ESLint
run: npm run lint
- run: npm ci --ignore-scripts

test-coverage:
name: test-coverage
- run: npm run build
test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/[email protected]

- name: Use Node.js latest
uses: actions/setup-node@v2-beta
- uses: actions/[email protected]
with:
node-version: '17.x'
node-version: '20.x'

- name: Get cached modules
uses: actions/cache@v2
- uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
**/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}

- name: Compile TypeScript and build UMD files
run: npm run build
**/lib
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Build coverage
run: npm run test:coverage
- run: npm ci --ignore-scripts

- name: Run codecov
run: node ./node_modules/.bin/codecov
- name: Test
run: npm run test:nobuild
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.idea
.vscode
.vscode/settings.json
coverage
lib
/commonjs/
/lib/
node_modules
*.log

Expand Down
67 changes: 67 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"command": "npm run build",
"type": "shell",
"args": [],
"isBackground": true,
"problemMatcher": [],
"icon": {
"id": "symbol-method",
"color": "terminal.ansiBlue"
}
},
{
"label": "Test with Jest",
"command": "npm test",
"type": "shell",
"args": [],
"isBackground": true,
"problemMatcher": [],
"icon": {
"id": "go-to-file",
"color": "terminal.ansiGreen"
}
},
{
"label": "Test without Building",
"command": "npm run test:nobuild",
"type": "shell",
"args": [],
"isBackground": true,
"problemMatcher": [],
"icon": {
"id": "go-to-file",
"color": "terminal.ansiGreen"
}
},
{
"label": "Open Test Coverage",
"command": "npm run lcov",
"type": "shell",
"args": [],
"isBackground": true,
"problemMatcher": [],
"icon": {
"id": "file-code",
"color": "terminal.ansiYellow"
}
}
],
"extensions": {
"recommendations": [
"prettier.prettier-vscode",
"dbaeumer.vscode-eslint",
"steoates.autoimport",
"vivaxy.vscode-conventional-commits",
"usernamehw.errorlens",
"usernamehw.remove-empty-lines",
"aljazsim.tsco"
]
},
"settings": {
"typescript.tsdk": "node_modules/typescript/lib"
}
}
31 changes: 27 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,33 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v1.0.0-0](https://github.com/thkruz/ootk-core/compare/v0.0.1-0...v1.0.0-0)
#### [v1.0.0-2](https://github.com/thkruz/ootk-core/compare/v1.0.0-1...v1.0.0-2)

- refactor: :recycle: implement strict checks in tsconfig
[`b1515cb`](https://github.com/thkruz/ootk-core/commit/b1515cb07794b7ac465bf27ebfb48232140f2e25)
- feat: :sparkles: sync all commonjs es6 and typescript examples
[`adb58fa`](https://github.com/thkruz/ootk-core/commit/adb58faf46de6af12568064d5941026a31942ecf)
- refactor: :recycle: standardize eci and rae methods
[`5581a18`](https://github.com/thkruz/ootk-core/commit/5581a18ffcb7ebbc04365e36fe49b51534c99137)

#### [v1.0.0-1](https://github.com/thkruz/ootk-core/compare/v1.0.0-0...v1.0.0-1)

> 12 January 2024

- refactor: :recycle: combine Tle classes and improve documentation
[`b5b506a`](https://github.com/thkruz/ootk-core/commit/b5b506af622d673fbf03fa4edbb11b405f27099f)
- test: :white_check_mark: fix tests
[`4c2d701`](https://github.com/thkruz/ootk-core/commit/4c2d701dfc25d04a3929956e0ff2d5f94466bd05)
- refactor: :recycle: move moon code to moon
[`7f5d7c7`](https://github.com/thkruz/ootk-core/commit/7f5d7c74b41216e75b94fbb32b07c6303cf044ec)

#### v1.0.0-0

> 7 January 2024

- feat: :boom: initial commit [`9893a6a`](https://github.com/thkruz/ootk-core/commit/9893a6acfb5dd51b12d755518c3af120fecc28be)
- test: :truck: update names and paths [`c48aece`](https://github.com/thkruz/ootk-core/commit/c48aece9a4c8a328cc7778292c4397312c162982)
- fix: :white_check_mark: fix test paths [`b784f3e`](https://github.com/thkruz/ootk-core/commit/b784f3eab311661415bfc9aa4001d9d8b8acd19f)
- feat: :boom: initial commit
[`9893a6a`](https://github.com/thkruz/ootk-core/commit/9893a6acfb5dd51b12d755518c3af120fecc28be)
- test: :truck: update names and paths
[`c48aece`](https://github.com/thkruz/ootk-core/commit/c48aece9a4c8a328cc7778292c4397312c162982)
- fix: :white_check_mark: fix test paths
[`b784f3e`](https://github.com/thkruz/ootk-core/commit/b784f3eab311661415bfc9aa4001d9d8b8acd19f)
72 changes: 42 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# ootk
# ootk-core

<!-- [![Release](https://img.shields.io/github/v/release/thkruz/ootk-core?style=flat-square)](https://www.npmjs.com/package/ootk-core) -->

![Size](https://img.shields.io/github/languages/code-size/thkruz/ootk-core?style=flat-square)
[![Release](https://img.shields.io/github/v/release/thkruz/ootk-core?style=flat-square)](https://www.npmjs.com/package/ootk)
[![Issues](https://img.shields.io/github/issues/thkruz/ootk-core?style=flat-square)](https://github.com/thkruz/ootk/issues)
[![Coverage](https://img.shields.io/codecov/c/github/thkruz/ootk-core?style=flat-square)](https://codecov.io/gh/thkruz/ootk)
[![License](https://img.shields.io/github/license/thkruz/ootk-core?style=flat-square)](LICENSE.md)

> An Orbital Object Toolkit in Your Web Browser

**ootk-core** is the core libraries of [ootk](https://github.com/thkruz/ootk) for doing math related to orbital objects
written in TypeScript. **ootk-core** was developed to simplify the math and let you focus on using the results.
written in TypeScript and built for both CommonJS and ES6 JavaScript or TypeScript. **ootk-core** was developed to
simplify the math and let you focus on using the results. It is the culmination of years of fixes and improvements to
other libraries.

If you would like more functionality the expanded **ootk** library is available free under the AGPL license
[here](https://github.com/thkruz/ootk). The full library has features for doing initial orbit determination, maneuver
Expand Down Expand Up @@ -42,22 +44,38 @@ npm i ootk-core
### Loading the Library

```js
import { Sgp4 } from 'ootk-core';
import { Satellite } from 'ootk-core';
...
const satrec = Sgp4.createSatrec(line1, line2, 'wgs72', 'i');
const satellite = new Satellite({
tle1: line1,
tle2: line2
});
```

## :satellite: Usage

### Propagating a TLE

```js
import { Sgp4 } from 'ootk-core';

const satrec = Sgp4.createSatrec(line1, line2);
const state = Sgp4.propagate(satrec, time);
console.log(state.position); // [x, y, z]
console.log(state.velocity); // [vx, vy, vz]
import { Satellite } from 'ootk-core';
...
const satellite = new Satellite({
tle1: line1,
tle2: line2
});
const state = satellite.eci();
console.log(state.position);
// {
// x: 1538.223335842895
// y: 5102.261204021967
// z: 4432.634965003577
// }
console.log(state.velocity);
// {
// x: -4.26262363267920
// y: 0.159169020320195
// z: 1.502351885030190
// }
```

### Creating a Satellite
Expand All @@ -74,7 +92,7 @@ console.log(sat.meanMoDev1); // Mean Motion Deviation 1
console.log(sat.meanMoDev2); // Mean Motion Deviation 2
console.log(sat.bstar); // Bstar (Drag Coefficient)
console.log(sat.inclination); // inclination in degrees
console.log(sat.raan); // right ascension of the ascending node in degrees
console.log(sat.rightAscension); // right ascension of the ascending node in degrees
console.log(sat.eccentricity); // eccentricity
console.log(sat.argOfPerigee); // argument of perigee in degrees
console.log(sat.meanAnomaly); // mean anomaly in degrees
Expand All @@ -83,19 +101,18 @@ console.log(sat.period); // period in seconds
console.log(sat.apogee); // apogee in kilometers
console.log(sat.perigee); // perigee in kilometers

sat.propagate(time); // Propagate the satellite to the given time
sat.getLla(); // Get the satellite's position in latitude, longitude, altitude at its current time
sat.getEci(time); // Get the satellite's position in Earth-Centered Inertial coordinates at the given time without changing its state
sat.getRae(sensor, time); // Get position in range, aziimuth, elevation relative to a sensor object at the given time without changing its state
sat.lla(); // Get the satellite's position in latitude, longitude, altitude at its current time
sat.eci(time); // Get the satellite's position in Earth-Centered Inertial coordinates at the given time
sat.rae(sensor, time); // Get position in range, aziimuth, elevation relative to a sensor object at the given time
```

### Creating a Sensor

```js
const sensor = new Ootk.Sensor({ name: 'Test', lat: lat, lon: lon, alt: alt });
sensor.setTime(time); // Set the sensor's time to the given time
sensor.getRae(sat); // Get satellite position in range, aziimuth, elevation at the sensor's current time
sensor.getRae(sat, time); // Get position in range, aziimuth, elevation relative to a satellite object at the given time without changing its state
sensor.rae(sat); // Get satellite position in range, aziimuth, elevation at the sensor's current time
sensor.rae(sat, time); // Get position in range, aziimuth, elevation relative to a satellite object at the given time
sensor.eci() // Get the sensor's position in ECI coordinates
```

## :desktop_computer: Building
Expand All @@ -116,12 +133,9 @@ sensor.getRae(sat, time); // Get position in range, aziimuth, elevation relative

## :gem: NPM Scripts

- `build` compiles TypeScript into ES6 Modules and combines them into a single file in the `dist` directory.
- `build` compiles TypeScript into ES6 Modules in `lib` directory and CommonJs in `commonjs` directory
- `lint` lints source code located in `src` directory with [ESLint](http://eslint.org/)
- `lint:fix` lints tests located in `src` directory with ESLint and attempts to auto-fix errors
- `lint:test` lints tests located in `test` directory with ESLint
- `test` builds the software and then runs jest to verify the final library remains functional
- `test:coverage` generates lcov report to view code coverage

## :man_teacher: Contributing

Expand All @@ -137,17 +151,15 @@ git merge origin/develop
git checkout -b my-feature
```

Make sure that your changes don't break the existing code by running:
When you are done, make sure that your changes don't break the existing code by running:

```bash
npm test
```

Check that your code follows the rules established in eslint.rc:
After you have pushed your branch you can [create a pull request here](https://github.com/thkruz/ootk-core/pulls).

```bash
npm run lint
```
If you need help, just open an issue and I'll happily walk you through the process.

## :man_scientist: Contributors

Expand All @@ -164,6 +176,6 @@ the previous work of the following:

## :balance_scale: License

In order to maximize the usabiltiy of the core modules of OOTK with other projects I support, I have placed this
In order to maximize the usabiltiy of the core modules of ootk with other projects I support, I have placed this
repository under the [MIT License](LICENSE.md). I strongly encourage you to conisder a GPL license for your own project
to keep your project free for everyone to use. [Learn more here](https://www.gnu.org/philosophy/philosophy.html).
Loading