Skip to content

Commit

Permalink
feat: ✨ add examples and reduce dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Jan 11, 2024
1 parent 16c336b commit 64116c8
Show file tree
Hide file tree
Showing 19 changed files with 174 additions and 765 deletions.
4 changes: 0 additions & 4 deletions examples/README

This file was deleted.

3 changes: 3 additions & 0 deletions examples/commonjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Run the examples using node.

Example: node ./examples/commonjs/satellite.js
12 changes: 12 additions & 0 deletions examples/commonjs/satellite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { Satellite } = require('../../lib/ootk-core');

const tle1 = '1 25544U 98067A 19156.50900463 .00003075 00000-0 59442-4 0 9992';
const tle2 = '2 25544 51.6433 59.2583 0008217 16.4489 347.6017 15.51174618173442';

const satellite = new Satellite({
tle1,
tle2,
});

// eslint-disable-next-line no-console
console.log(satellite.eci());
3 changes: 3 additions & 0 deletions examples/mjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Run the examples using tsx.

Example: npx tsx ./examples/satellite.mjs
12 changes: 12 additions & 0 deletions examples/mjs/satellite.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Satellite } from '../../lib/ootk-core.mjs';

const tle1 = '1 25544U 98067A 19156.50900463 .00003075 00000-0 59442-4 0 9992';
const tle2 = '2 25544 51.6433 59.2583 0008217 16.4489 347.6017 15.51174618173442';

const satellite = new Satellite({
tle1,
tle2,
});

// eslint-disable-next-line no-console
console.log(satellite.eci());
16 changes: 0 additions & 16 deletions examples/tsconfig.json

This file was deleted.

3 changes: 3 additions & 0 deletions examples/typescript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Run the examples using ts-node.

Example: npx ts-node ./examples/julian.ts -p ./examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
Sgp4,
TleLine1,
TleLine2,
} from '../src/ootk-core';
} from '../../src/ootk-core';

// Sample TLE
const tle1 = '1 25544U 98067A 19156.50900463 .00003075 00000-0 59442-4 0 9992' as TleLine1;
Expand Down
2 changes: 1 addition & 1 deletion examples/sun.ts → examples/typescript/sun.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Degrees, Meters, Sun } from '../lib/ootk-core';
import { Degrees, Meters, Sun } from '../../lib/ootk-core';
/* eslint-disable no-console */

console.log(Sun.getTimes(new Date(), 41 as Degrees, -71 as Degrees, 0 as Meters));
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-console */
import { Degrees, ecf2rae, EcfVec3, GroundPosition, Kilometers, lla2ecf, lla2sez, RAD2DEG } from '../src/ootk-core';
import { Degrees, ecf2rae, EcfVec3, GroundPosition, Kilometers, lla2ecf, lla2sez, RAD2DEG } from '../../src/ootk-core';

const observer = new GroundPosition({
name: 'ground-position',
Expand Down
7 changes: 7 additions & 0 deletions examples/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2015",
"baseUrl": "../"
}
}
Loading

0 comments on commit 64116c8

Please sign in to comment.