File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+
4+ < head >
5+ < title > Tide Predictor in the browser</ title >
6+ < link rel ="stylesheet " href ="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css " />
7+ </ head >
8+
9+ < body >
10+ < div class ="container ">
11+ < h1 > High/low tides for Monterey, CA</ h1 >
12+ < table class ="table ">
13+ < thead >
14+ < tr >
15+ < th > Time</ th >
16+ < th > High/Low</ th >
17+ < th > Level (meters)</ th >
18+ </ tr >
19+ < tbody id ="tides "> </ tbody >
20+ </ thead >
21+ </ table >
22+ </ div >
23+
24+ < script type ="module ">
25+ import tidePredictor from './src/index.js'
26+
27+ ( ( ) => {
28+ fetch ( 'https://api.tidesandcurrents.noaa.gov/mdapi/prod/webapi/stations/9413450/harcon.json?units=metric' )
29+ . then ( response => {
30+ return response . json ( )
31+ } )
32+ . then ( harmonics => {
33+ const start = new Date ( )
34+ const end = new Date ( start . getTime ( ) + ( 10 * 24 * 60 * 60 * 1000 ) )
35+
36+ const highLow = tidePredictor ( harmonics . HarmonicConstituents ) . getExtremesPrediction ( { start, end } )
37+
38+ highLow . forEach ( level => {
39+ const tableRow = document . createElement ( 'tr' )
40+ tableRow . innerHTML = `
41+ <td>${ level
42+ . time } </td>
43+ <td>${ level
44+ . label } </td>
45+ <td>${ level
46+ . level } </td>
47+ `
48+ document
49+ . getElementById ( 'tides' )
50+ . appendChild ( tableRow )
51+ } )
52+ } )
53+ } ) ( )
54+ </ script >
55+ </ body >
56+
57+ </ html >
Original file line number Diff line number Diff line change 66 "author" : " Kevin Miller <keveemiller@gmail.com>" ,
77 "license" : " MIT" ,
88 "type" : " module" ,
9+ "main" : " dist/index.umd.cjs" ,
910 "exports" : {
1011 "." : {
12+ "types" : " ./dist/index.d.ts" ,
1113 "import" : " ./dist/index.js" ,
12- "types " : " ./dist/index.d.ts "
14+ "require " : " ./dist/index.umd.cjs "
1315 }
1416 },
1517 "files" : [
2527 "mocha" : " ^10.0.0" ,
2628 "npm-run-all" : " ^4.1.5" ,
2729 "tsx" : " ^4.7.0" ,
28- "typescript" : " ^5.3.3"
30+ "typescript" : " ^5.3.3" ,
31+ "vite" : " ^7.2.7" ,
32+ "vite-plugin-dts" : " ^4.5.4"
2933 },
3034 "scripts" : {
31- "build" : " tsc" ,
32- "test" : " mocha --require tsx --extension ts --extension js --recursive" ,
35+ "dev" : " vite" ,
36+ "build" : " vite build" ,
37+ "test" : " tsc && mocha --require tsx --extension ts --extension js --recursive" ,
3338 "lint" : " eslint ./src --ext .ts,.tsx,.js" ,
3439 "coverage" : " c8 --reporter=lcov mocha --require tsx --extension ts --extension js --recursive" ,
3540 "ci" : " run-s lint build coverage" ,
Original file line number Diff line number Diff line change 66 "moduleResolution" : " bundler" ,
77 "allowSyntheticDefaultImports" : true ,
88 "esModuleInterop" : true ,
9- "declaration" : true ,
10- "declarationMap" : true ,
11- "sourceMap" : true ,
12- "outDir" : " ./dist" ,
139 "rootDir" : " ./src" ,
1410 "strict" : true ,
1511 "skipLibCheck" : true ,
1612 "forceConsistentCasingInFileNames" : true ,
1713 "resolveJsonModule" : true ,
1814 "allowImportingTsExtensions" : false ,
19- "noEmit" : false
15+ "noEmit" : true
2016 },
2117 "include" : [" src/**/*" ],
2218 "exclude" : [" node_modules" , " dist" , " test" ]
Original file line number Diff line number Diff line change 1+ import { dirname , resolve } from 'node:path'
2+ import { fileURLToPath } from 'node:url'
3+ import { defineConfig } from 'vite'
4+ import dts from 'vite-plugin-dts'
5+
6+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) )
7+
8+ export default defineConfig ( {
9+ build : {
10+ lib : {
11+ entry : resolve ( __dirname , 'src/index.ts' ) ,
12+ name : 'TidePredictor' ,
13+ fileName : 'index'
14+ } ,
15+ sourcemap : true
16+ } ,
17+ plugins : [ dts ( { rollupTypes : true } ) ]
18+ } )
You can’t perform that action at this time.
0 commit comments