liftie 3.56.5 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Makefile +2 -2
- package/app.js +33 -25
- package/lib/checker.js +1 -1
- package/lib/cli/curl.js +8 -8
- package/lib/cli/dirs.js +8 -6
- package/lib/cli/fetch.js +16 -17
- package/lib/cli/for-each-resort.js +4 -11
- package/lib/cli/generate.js +11 -11
- package/lib/cli/noaa.js +28 -42
- package/lib/client/about/index.js +2 -6
- package/lib/client/boot/height.js +2 -6
- package/lib/client/boot/index.js +8 -11
- package/lib/client/boot/service-worker.js +1 -5
- package/lib/client/minimax/index.js +1 -3
- package/lib/client/resort/dom.js +2 -7
- package/lib/client/resort/index.js +7 -10
- package/lib/client/resort/lifts.js +4 -5
- package/lib/client/resort/snow.js +3 -4
- package/lib/client/resort/weather.js +3 -4
- package/lib/client/resort/webcams.js +5 -8
- package/lib/client/state/index.js +4 -7
- package/lib/client/stats/index.js +1 -5
- package/lib/client/tag/index.js +1 -3
- package/lib/embed/index.js +0 -2
- package/lib/lifts/index.js +12 -12
- package/lib/lifts/parse.js +5 -5
- package/lib/lifts/parser.js +6 -10
- package/lib/lifts/pipe.js +3 -3
- package/lib/lifts/request.js +1 -3
- package/lib/lifts/rest.js +2 -4
- package/lib/lifts/stats.js +2 -5
- package/lib/loader.js +9 -12
- package/lib/loaders.js +7 -8
- package/lib/opening.js +6 -5
- package/lib/plugins.js +3 -8
- package/lib/resorts/3cime/index.js +1 -1
- package/lib/resorts/3cime/resort.json +1 -1
- package/lib/resorts/49-degrees-north/index.js +1 -1
- package/lib/resorts/abasin/index.js +2 -2
- package/lib/resorts/alpe-lusia-san-pellegrino/index.js +1 -1
- package/lib/resorts/alpe-lusia-san-pellegrino/resort.json +1 -1
- package/lib/resorts/alpine/index.js +1 -1
- package/lib/resorts/alta/index.js +6 -7
- package/lib/resorts/alta-badia/index.js +1 -1
- package/lib/resorts/alta-badia/resort.json +1 -1
- package/lib/resorts/alyeska/index.js +1 -1
- package/lib/resorts/alyeska/resort.json +1 -1
- package/lib/resorts/angel-fire/index.js +1 -1
- package/lib/resorts/arabba/index.js +1 -1
- package/lib/resorts/arabba/resort.json +1 -1
- package/lib/resorts/aspen-highlands/index.js +1 -1
- package/lib/resorts/aspen-mountain/index.js +1 -1
- package/lib/resorts/attitash/index.js +1 -1
- package/lib/resorts/attitash/resort.json +1 -1
- package/lib/resorts/beavercreek/index.js +1 -1
- package/lib/resorts/berkshire-east/index.js +1 -1
- package/lib/resorts/big-sky/index.js +1 -1
- package/lib/resorts/big-white/index.js +1 -1
- package/lib/resorts/big-white/resort.json +1 -1
- package/lib/resorts/blue-mountain-pa/index.js +1 -1
- package/lib/resorts/bluemountain/index.js +1 -1
- package/lib/resorts/bogusbasin/index.js +5 -4
- package/lib/resorts/bolton-valley/index.js +2 -3
- package/lib/resorts/boreal/index.js +1 -1
- package/lib/resorts/breck/index.js +1 -1
- package/lib/resorts/brettonwoods/index.js +7 -5
- package/lib/resorts/brettonwoods/resort.json +1 -1
- package/lib/resorts/brianhead/index.js +1 -1
- package/lib/resorts/bridger-bowl/index.js +4 -3
- package/lib/resorts/brighton/index.js +1 -1
- package/lib/resorts/bromley-mountain/index.js +1 -1
- package/lib/resorts/burke-mountain/index.js +1 -1
- package/lib/resorts/buttermilk/index.js +1 -1
- package/lib/resorts/caberfae-peaks/index.js +1 -1
- package/lib/resorts/camelback/index.js +1 -1
- package/lib/resorts/campo-felice/index.js +1 -1
- package/lib/resorts/campo-felice/resort.json +1 -1
- package/lib/resorts/canada-olympic-park/index.js +1 -1
- package/lib/resorts/cannon/index.js +1 -1
- package/lib/resorts/cannon/resort.json +1 -1
- package/lib/resorts/cataloochee/index.js +1 -1
- package/lib/resorts/catedral/index.js +1 -1
- package/lib/resorts/cervino/index.js +2 -2
- package/lib/resorts/chamonix/index.js +2 -2
- package/lib/resorts/chamonix/resort.json +1 -1
- package/lib/resorts/chinapeak/index.js +1 -1
- package/lib/resorts/civetta/index.js +1 -1
- package/lib/resorts/civetta/resort.json +1 -1
- package/lib/resorts/claviere/index.js +1 -1
- package/lib/resorts/copper/index.js +1 -1
- package/lib/resorts/coronetpeak/index.js +1 -1
- package/lib/resorts/coronetpeak/resort.json +1 -1
- package/lib/resorts/cortina-d-ampezzo/index.js +1 -1
- package/lib/resorts/cortina-d-ampezzo/resort.json +1 -1
- package/lib/resorts/courchevel/index.js +1 -1
- package/lib/resorts/courchevel/resort.json +2 -1
- package/lib/resorts/cranmore-mountain/index.js +1 -1
- package/lib/resorts/cranmore-mountain/resort.json +1 -1
- package/lib/resorts/cransmontana/index.js +2 -2
- package/lib/resorts/crested-butte/index.js +1 -1
- package/lib/resorts/crystal-mountain/index.js +1 -1
- package/lib/resorts/cypress-mountain/index.js +1 -1
- package/lib/resorts/deer-valley/index.js +1 -1
- package/lib/resorts/devils-head/index.js +1 -1
- package/lib/resorts/diamondpeak/index.js +1 -1
- package/lib/resorts/falls-creek/index.js +5 -3
- package/lib/resorts/falls-creek/resort.json +1 -1
- package/lib/resorts/flims-laax-falera/index.js +1 -1
- package/lib/resorts/flims-laax-falera/resort.json +1 -1
- package/lib/resorts/folgaria/index.js +1 -1
- package/lib/resorts/folgaria/resort.json +1 -1
- package/lib/resorts/folgarida-marilleva/index.js +2 -1
- package/lib/resorts/forni/index.js +1 -1
- package/lib/resorts/forni/resort.json +1 -1
- package/lib/resorts/gore-mountain/index.js +1 -1
- package/lib/resorts/grand-targhee/index.js +1 -1
- package/lib/resorts/grouse/index.js +1 -1
- package/lib/resorts/gunstock/index.js +1 -1
- package/lib/resorts/gunstock/resort.json +1 -1
- package/lib/resorts/heavenly/index.js +1 -1
- package/lib/resorts/hochfuegen/index.js +2 -2
- package/lib/resorts/homewood/index.js +1 -1
- package/lib/resorts/hoodoo/index.js +1 -1
- package/lib/resorts/hunter/index.js +1 -1
- package/lib/resorts/ischgl-silvretta-arena/index.js +1 -1
- package/lib/resorts/jackson-hole/index.js +5 -3
- package/lib/resorts/jay-peak/index.js +1 -1
- package/lib/resorts/jiminypeak/index.js +1 -1
- package/lib/resorts/june-mountain/index.js +1 -1
- package/lib/resorts/keystone/index.js +1 -1
- package/lib/resorts/killington/index.js +1 -1
- package/lib/resorts/king-pine/index.js +5 -3
- package/lib/resorts/king-pine/resort.json +1 -1
- package/lib/resorts/kirkwood/index.js +1 -1
- package/lib/resorts/kitzbuehel/index.js +1 -1
- package/lib/resorts/lamolina/index.js +1 -1
- package/lib/resorts/lamolina/resort.json +1 -1
- package/lib/resorts/laplagne/index.js +1 -1
- package/lib/resorts/laplagne/resort.json +2 -1
- package/lib/resorts/larosiere/index.js +1 -1
- package/lib/resorts/lavarone/index.js +1 -1
- package/lib/resorts/lavarone/resort.json +1 -1
- package/lib/resorts/lesarcs/index.js +1 -1
- package/lib/resorts/lesmenuires/index.js +1 -1
- package/lib/resorts/lesmenuires/resort.json +2 -1
- package/lib/resorts/loon/index.js +1 -1
- package/lib/resorts/loon/resort.json +1 -1
- package/lib/resorts/loveland/index.js +2 -2
- package/lib/resorts/mad-river-glen/index.js +2 -2
- package/lib/resorts/madonna-di-campiglio/index.js +2 -1
- package/lib/resorts/mammoth-lakes/index.js +1 -1
- package/lib/resorts/manning-park/index.js +1 -1
- package/lib/resorts/manning-park/resort.json +1 -1
- package/lib/resorts/megeve/index.js +1 -1
- package/lib/resorts/megeve/resort.json +2 -1
- package/lib/resorts/meribel/index.js +1 -1
- package/lib/resorts/meribel/resort.json +2 -1
- package/lib/resorts/monarch/index.js +2 -2
- package/lib/resorts/monte-amiata/index.js +1 -1
- package/lib/resorts/monte-amiata/resort.json +1 -1
- package/lib/resorts/monte-bondone/index.js +1 -1
- package/lib/resorts/montegenevre/index.js +1 -1
- package/lib/resorts/monterosa/index.js +1 -1
- package/lib/resorts/morzine/index.js +1 -1
- package/lib/resorts/morzine/resort.json +6 -2
- package/lib/resorts/mount-sunapee/index.js +1 -1
- package/lib/resorts/mount-sunapee/resort.json +1 -1
- package/lib/resorts/mountsnow/index.js +1 -1
- package/lib/resorts/mt-buller/index.js +1 -1
- package/lib/resorts/mt-hotham/index.js +5 -3
- package/lib/resorts/mt-seymour/index.js +1 -1
- package/lib/resorts/mt-spokane/index.js +1 -1
- package/lib/resorts/mtbachelor/index.js +1 -1
- package/lib/resorts/mtbrighton/index.js +1 -1
- package/lib/resorts/mthigh/index.js +1 -1
- package/lib/resorts/mthood/index.js +1 -1
- package/lib/resorts/mtpeter/index.js +1 -1
- package/lib/resorts/mtpeter/resort.json +1 -1
- package/lib/resorts/mtrose/index.js +1 -1
- package/lib/resorts/niseko/index.js +1 -1
- package/lib/resorts/niseko/resort.json +1 -1
- package/lib/resorts/northstar/index.js +1 -1
- package/lib/resorts/okemo/index.js +1 -1
- package/lib/resorts/ovindoli/index.js +1 -1
- package/lib/resorts/ovindoli/resort.json +1 -1
- package/lib/resorts/owlshead/index.js +1 -1
- package/lib/resorts/paganella/index.js +1 -1
- package/lib/resorts/paganella/resort.json +1 -1
- package/lib/resorts/palisades/index.js +1 -1
- package/lib/resorts/parkcity/index.js +1 -1
- package/lib/resorts/pats-peak/index.js +4 -2
- package/lib/resorts/pats-peak/resort.json +1 -1
- package/lib/resorts/peio/index.js +2 -2
- package/lib/resorts/perisher/index.js +1 -1
- package/lib/resorts/perisher/resort.json +1 -1
- package/lib/resorts/piancavallo/index.js +1 -1
- package/lib/resorts/piancavallo/resort.json +1 -1
- package/lib/resorts/pico/index.js +1 -1
- package/lib/resorts/pinzolo/index.js +2 -1
- package/lib/resorts/plan-de-corones/index.js +1 -1
- package/lib/resorts/plan-de-corones/resort.json +1 -1
- package/lib/resorts/pleasant-mountain/index.js +1 -1
- package/lib/resorts/pleasant-mountain/resort.json +1 -1
- package/lib/resorts/pontedilegno-tonale/index.js +1 -1
- package/lib/resorts/ragged-mountain/index.js +1 -1
- package/lib/resorts/ragged-mountain/resort.json +1 -1
- package/lib/resorts/ravascletto-zoncolan/index.js +1 -1
- package/lib/resorts/ravascletto-zoncolan/resort.json +1 -1
- package/lib/resorts/red-lodge-mountain/index.js +1 -1
- package/lib/resorts/red-mountain/index.js +2 -3
- package/lib/resorts/rio-pusteria-bressanone/index.js +1 -1
- package/lib/resorts/rio-pusteria-bressanone/resort.json +1 -1
- package/lib/resorts/roccaraso/index.js +1 -1
- package/lib/resorts/roccaraso/resort.json +1 -1
- package/lib/resorts/saddleback/index.js +1 -1
- package/lib/resorts/saddleback/resort.json +1 -1
- package/lib/resorts/san-martino-di-castrozza-passo-rolle/index.js +1 -1
- package/lib/resorts/san-martino-di-castrozza-passo-rolle/resort.json +1 -1
- package/lib/resorts/sansicario/index.js +1 -1
- package/lib/resorts/sappada/index.js +1 -1
- package/lib/resorts/sappada/resort.json +1 -1
- package/lib/resorts/sasquatch-mountain/index.js +1 -1
- package/lib/resorts/sauris/index.js +1 -1
- package/lib/resorts/sauris/resort.json +1 -1
- package/lib/resorts/sauze/index.js +1 -1
- package/lib/resorts/schweitzer/index.js +1 -1
- package/lib/resorts/sella/index.js +1 -1
- package/lib/resorts/sella/resort.json +1 -1
- package/lib/resorts/serfaus-fiss-ladis/index.js +1 -1
- package/lib/resorts/sestriere/index.js +1 -1
- package/lib/resorts/sestriere/resort.json +1 -1
- package/lib/resorts/shawnee-mountain/index.js +4 -2
- package/lib/resorts/sierra/index.js +1 -1
- package/lib/resorts/silver-star/index.js +2 -2
- package/lib/resorts/skiwelt/index.js +1 -1
- package/lib/resorts/smuggs/index.js +1 -1
- package/lib/resorts/snow-valley/index.js +2 -2
- package/lib/resorts/snowbasin/index.js +1 -1
- package/lib/resorts/snowbird/index.js +2 -3
- package/lib/resorts/snowmass/index.js +1 -1
- package/lib/resorts/snowshoe/index.js +1 -1
- package/lib/resorts/soelden/index.js +1 -1
- package/lib/resorts/solitude/index.js +1 -1
- package/lib/resorts/st-anton-am-arlberg/index.js +1 -1
- package/lib/resorts/steamboat/index.js +1 -1
- package/lib/resorts/stevens/index.js +1 -1
- package/lib/resorts/stowe/index.js +1 -1
- package/lib/resorts/stratton/index.js +1 -1
- package/lib/resorts/sugarbowl/index.js +1 -1
- package/lib/resorts/sugarbush/index.js +1 -1
- package/lib/resorts/sugarloaf/index.js +1 -1
- package/lib/resorts/sugarloaf/resort.json +1 -1
- package/lib/resorts/sun-peaks/index.js +1 -1
- package/lib/resorts/sun-peaks/resort.json +1 -1
- package/lib/resorts/sunday-river/index.js +1 -1
- package/lib/resorts/sunday-river/resort.json +1 -1
- package/lib/resorts/sunshine-village/index.js +6 -3
- package/lib/resorts/sunvalley/index.js +1 -1
- package/lib/resorts/tahoe-donner/index.js +1 -1
- package/lib/resorts/taos/index.js +1 -1
- package/lib/resorts/tarvisio/index.js +1 -1
- package/lib/resorts/tarvisio/resort.json +1 -1
- package/lib/resorts/telluride/index.js +1 -1
- package/lib/resorts/thredbo/index.js +1 -1
- package/lib/resorts/tignes/index.js +1 -1
- package/lib/resorts/tignes/resort.json +1 -1
- package/lib/resorts/timberline-lodge/index.js +1 -1
- package/lib/resorts/tremblant/index.js +1 -1
- package/lib/resorts/vail/index.js +1 -1
- package/lib/resorts/val-di-fassa/index.js +1 -1
- package/lib/resorts/val-di-fassa/resort.json +1 -1
- package/lib/resorts/val-di-fiemme/index.js +1 -1
- package/lib/resorts/val-di-fiemme/resort.json +1 -1
- package/lib/resorts/val-gardena/index.js +1 -1
- package/lib/resorts/val-gardena/resort.json +1 -1
- package/lib/resorts/valdisere/index.js +1 -1
- package/lib/resorts/valdisere/resort.json +1 -1
- package/lib/resorts/verbier/index.js +1 -1
- package/lib/resorts/waterville/index.js +1 -1
- package/lib/resorts/waterville/resort.json +1 -1
- package/lib/resorts/whistler-blackcomb/index.js +2 -2
- package/lib/resorts/whistler-blackcomb/resort.json +1 -1
- package/lib/resorts/whiteface/index.js +1 -1
- package/lib/resorts/whitefish/index.js +1 -1
- package/lib/resorts/wildcat/index.js +1 -1
- package/lib/resorts/wildcat/resort.json +1 -1
- package/lib/resorts/windham/index.js +1 -1
- package/lib/resorts/winter-park/index.js +1 -1
- package/lib/resorts/winterplace/index.js +1 -1
- package/lib/routes/cache.js +4 -4
- package/lib/routes/canonical.js +1 -3
- package/lib/routes/data.js +10 -12
- package/lib/routes/database.js +6 -7
- package/lib/routes/headers.js +2 -2
- package/lib/routes/index.js +9 -11
- package/lib/routes/plan.js +2 -4
- package/lib/routes/service-worker.js +6 -7
- package/lib/routes/sorter.js +2 -4
- package/lib/routes/tags.js +2 -4
- package/lib/select.js +3 -5
- package/lib/tools/aspen.js +4 -4
- package/lib/tools/boyne.js +4 -4
- package/lib/tools/campiglio-dolomiti.js +1 -1
- package/lib/tools/coerce.js +4 -4
- package/lib/tools/dolomitisuperski.js +1 -1
- package/lib/tools/domutil.js +11 -18
- package/lib/tools/infosnow.js +6 -6
- package/lib/tools/intrawest.js +3 -3
- package/lib/tools/limiter.js +2 -4
- package/lib/tools/lumiplan.js +2 -2
- package/lib/tools/millis.js +4 -11
- package/lib/tools/powdr.js +4 -4
- package/lib/tools/prism.js +5 -5
- package/lib/tools/skiplan.js +1 -1
- package/lib/tools/turismofvg.js +2 -2
- package/lib/tools/vail.js +8 -10
- package/lib/tools/vialattea.js +1 -1
- package/lib/weather/icons.js +3 -8
- package/lib/weather/index.js +5 -6
- package/lib/weather/noaa.js +5 -3
- package/lib/weather/openweather.js +6 -7
- package/lib/webcams.js +6 -6
- package/package.json +4 -3
- package/public/scripts/liftie-embed.js +41 -0
- package/public/scripts/liftie-embed.js.map +7 -0
- package/public/scripts/liftie.js +1561 -0
- package/public/scripts/liftie.js.map +7 -0
- package/public/stylesheets/style.css +864 -0
- package/public/stylesheets/style.mix.css +0 -1
package/Makefile
CHANGED
|
@@ -77,10 +77,10 @@ node_modules: package.json pnpm-lock.yaml
|
|
|
77
77
|
.NOTPARALLEL: node_modules
|
|
78
78
|
|
|
79
79
|
lint: | node_modules
|
|
80
|
-
$(NODE_BIN)/biome
|
|
80
|
+
$(NODE_BIN)/biome ci $(LINT_SRC)
|
|
81
81
|
|
|
82
82
|
format: | node_modules
|
|
83
|
-
$(NODE_BIN)/biome
|
|
83
|
+
$(NODE_BIN)/biome check --write $(LINT_SRC)
|
|
84
84
|
|
|
85
85
|
test: | node_modules
|
|
86
86
|
node --test $(TESTS)
|
package/app.js
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import http from 'node:http';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import connect from '@pirxpilot/connect';
|
|
4
|
+
import cookieParser from '@pirxpilot/cookie-parser';
|
|
5
|
+
import { compile } from '@pirxpilot/jade-core';
|
|
6
|
+
import cachifyStatic from 'connect-cachify-static';
|
|
7
|
+
import gzip from 'connect-gzip-static';
|
|
8
|
+
import renderer from 'connect-renderer';
|
|
9
|
+
import errorHandler from 'errorhandler';
|
|
10
|
+
import logger from 'morgan';
|
|
11
|
+
import lifts from './lib/lifts/index.js';
|
|
12
|
+
import loader from './lib/loader.js';
|
|
13
|
+
import * as loaders from './lib/loaders.js';
|
|
14
|
+
import opening from './lib/opening.js';
|
|
15
|
+
import * as plugins from './lib/plugins.js';
|
|
16
|
+
import dataRoutes from './lib/routes/data.js';
|
|
17
|
+
import routes from './lib/routes/index.js';
|
|
18
|
+
import weather from './lib/weather/index.js';
|
|
19
|
+
import webcams from './lib/webcams.js';
|
|
20
|
+
|
|
21
|
+
const app = connect();
|
|
22
|
+
export default app;
|
|
15
23
|
|
|
16
24
|
process.env.PORT ??= 3000;
|
|
17
25
|
process.env.SITE_URL ??= `http://localhost:${process.env.PORT}`;
|
|
18
26
|
process.env.NODE_ENV ??= 'development';
|
|
19
27
|
|
|
20
|
-
const root = path.join(
|
|
28
|
+
const root = path.join(path.dirname(new URL(import.meta.url).pathname), 'public');
|
|
21
29
|
const { SITE_URL: siteUrl, LIFTIE_STATIC_HOST: staticHost = '' } = process.env;
|
|
22
30
|
|
|
23
31
|
const cachify = cachifyStatic(root);
|
|
@@ -34,8 +42,8 @@ app.locals = {
|
|
|
34
42
|
};
|
|
35
43
|
|
|
36
44
|
app.use(
|
|
37
|
-
renderer(`${
|
|
38
|
-
compile
|
|
45
|
+
renderer(`${path.dirname(new URL(import.meta.url).pathname)}/views`).engine('jade', {
|
|
46
|
+
compile,
|
|
39
47
|
options: { compileDebug: process.env.NODE_ENV !== 'production' }
|
|
40
48
|
})
|
|
41
49
|
);
|
|
@@ -59,17 +67,17 @@ if (process.env.NODE_ENV === 'development') {
|
|
|
59
67
|
}
|
|
60
68
|
|
|
61
69
|
app.loaders = loaders;
|
|
62
|
-
app.loaders.register(
|
|
70
|
+
app.loaders.register(loader);
|
|
63
71
|
|
|
64
72
|
app.plugins = plugins;
|
|
65
|
-
app.plugins.register('lifts',
|
|
66
|
-
app.plugins.register('opening',
|
|
67
|
-
app.plugins.register('weather',
|
|
68
|
-
app.plugins.register('webcams',
|
|
73
|
+
app.plugins.register('lifts', lifts);
|
|
74
|
+
app.plugins.register('opening', opening);
|
|
75
|
+
app.plugins.register('weather', weather);
|
|
76
|
+
app.plugins.register('webcams', webcams);
|
|
69
77
|
|
|
70
|
-
app.data =
|
|
78
|
+
app.data = dataRoutes();
|
|
71
79
|
|
|
72
|
-
|
|
80
|
+
routes(app);
|
|
73
81
|
|
|
74
82
|
app.run = function run() {
|
|
75
83
|
app.data.init(err => {
|
|
@@ -84,6 +92,6 @@ app.run = function run() {
|
|
|
84
92
|
});
|
|
85
93
|
};
|
|
86
94
|
|
|
87
|
-
if (
|
|
95
|
+
if (import.meta.main) {
|
|
88
96
|
app.run();
|
|
89
97
|
}
|
package/lib/checker.js
CHANGED
package/lib/cli/curl.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { pipeline } from 'node:stream/promises';
|
|
4
|
+
import request from '../lifts/request.js';
|
|
5
|
+
import * as dirs from './dirs.js';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function curl(url, resortId) {
|
|
7
|
+
export default async function curl(url, resortId) {
|
|
9
8
|
const dst = path.join(dirs.test, 'example', `${resortId}.html`);
|
|
10
9
|
const dstStream = fs.createWriteStream(dst);
|
|
11
10
|
|
|
12
11
|
console.log('Fetching %s to %s...', url.host + url.pathname, dst);
|
|
13
|
-
request(url)
|
|
12
|
+
const res = await request(url);
|
|
13
|
+
return pipeline(res.body, dstStream);
|
|
14
14
|
}
|
package/lib/cli/dirs.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export const templates = resolve(import.meta.dirname, '../../templates');
|
|
4
|
+
export const lib = resolve(import.meta.dirname, '../resorts');
|
|
5
|
+
export const test = resolve(import.meta.dirname, '../../test/resorts');
|
|
6
|
+
|
|
7
|
+
export function descriptorPath(resortId) {
|
|
8
|
+
return resolve(import.meta.dirname, '..', 'resorts', resortId, 'resort.json');
|
|
9
|
+
}
|
package/lib/cli/fetch.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function fetchExample(resortId) {
|
|
7
|
-
let resort;
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { program } from 'commander';
|
|
3
|
+
import curl from './curl.js';
|
|
4
|
+
import { descriptorPath } from './dirs.js';
|
|
8
5
|
|
|
6
|
+
async function fetchExample(resortId) {
|
|
9
7
|
try {
|
|
10
|
-
resort =
|
|
11
|
-
curl(resort.dataUrl || resort.api || resort.url, resortId);
|
|
12
|
-
done = true;
|
|
8
|
+
const resort = JSON.parse(readFileSync(descriptorPath(resortId), 'utf8'));
|
|
9
|
+
await curl(resort.dataUrl || resort.api || resort.url, resortId);
|
|
13
10
|
} catch {
|
|
14
|
-
console.error(resortId
|
|
11
|
+
console.error(`"${resortId}" is not a valid resort ID`);
|
|
15
12
|
process.exit(1);
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
15
|
|
|
19
|
-
program
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
program
|
|
17
|
+
.arguments('<resort-id>')
|
|
18
|
+
.action(fetchExample)
|
|
19
|
+
.parseAsync()
|
|
20
|
+
.catch(e => {
|
|
21
|
+
console.error(e);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
});
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
module.exports = forEachResort;
|
|
1
|
+
import { readdirSync } from 'node:fs';
|
|
2
|
+
import { lib } from './dirs.js';
|
|
3
|
+
export default forEachResort;
|
|
5
4
|
|
|
6
5
|
function forEachResort(fn) {
|
|
7
6
|
console.log('Reading:', lib);
|
|
8
|
-
|
|
9
|
-
if (err) {
|
|
10
|
-
console.error(err);
|
|
11
|
-
process.exit(1);
|
|
12
|
-
}
|
|
13
|
-
dirents.filter(dirent => dirent.isDirectory()).forEach(({ name }) => fn(name));
|
|
14
|
-
});
|
|
7
|
+
readdirSync(lib, { withFileTypes: true }).forEach(dirent => dirent.isDirectory() && fn(dirent.name));
|
|
15
8
|
}
|
package/lib/cli/generate.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import url from 'node:url';
|
|
4
|
+
import { program } from 'commander';
|
|
5
|
+
import _ from 'lodash';
|
|
6
|
+
import prompt from 'prompt';
|
|
7
|
+
import curl from './curl.js';
|
|
8
|
+
import * as dirs from './dirs.js';
|
|
9
9
|
|
|
10
10
|
let fname;
|
|
11
11
|
const schema = [
|
|
@@ -52,7 +52,7 @@ const schema = [
|
|
|
52
52
|
}
|
|
53
53
|
];
|
|
54
54
|
|
|
55
|
-
program.option('-j, --json <file>', 'JSON file with resort data', String).parse(
|
|
55
|
+
program.option('-j, --json <file>', 'JSON file with resort data', String).parse();
|
|
56
56
|
|
|
57
57
|
if (program.json) {
|
|
58
58
|
fname = path.resolve(program.json);
|
|
@@ -84,7 +84,7 @@ if (program.json) {
|
|
|
84
84
|
|
|
85
85
|
function generate(resort) {
|
|
86
86
|
console.log('Generating files for %s', resort.name);
|
|
87
|
-
const resortDir = path.
|
|
87
|
+
const resortDir = path.resolve(import.meta.dirname, '..', 'resorts', resort.id);
|
|
88
88
|
|
|
89
89
|
fs.mkdirSync(resortDir);
|
|
90
90
|
copy(path.join(dirs.templates, 'index.js'), path.join(resortDir, 'index.js'), resort);
|
|
@@ -113,7 +113,7 @@ function write(dst, json) {
|
|
|
113
113
|
function copy(src, dst, params) {
|
|
114
114
|
console.log('Generating %s...', dst);
|
|
115
115
|
fs.readFile(src, 'utf8', (_err, data) => {
|
|
116
|
-
data = template(data)(params);
|
|
116
|
+
data = _.template(data)(params);
|
|
117
117
|
fs.writeFileSync(dst, data);
|
|
118
118
|
});
|
|
119
119
|
}
|
package/lib/cli/noaa.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const forEachResort = require('./for-each-resort');
|
|
6
|
-
|
|
7
|
-
let done = false;
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { program } from 'commander';
|
|
3
|
+
import { descriptorPath } from './dirs.js';
|
|
4
|
+
import forEachResort from './for-each-resort.js';
|
|
8
5
|
|
|
9
6
|
const userAgent = 'Mozilla/5.0 (compatible; Liftie/1.0; +https://liftie.info)';
|
|
10
7
|
|
|
@@ -17,53 +14,47 @@ function points([lon, lat]) {
|
|
|
17
14
|
}
|
|
18
15
|
|
|
19
16
|
function fetchNoaa(resortId, options) {
|
|
20
|
-
done = true;
|
|
21
|
-
|
|
22
17
|
if (resortId) {
|
|
23
18
|
noaaForResort(resortId, options);
|
|
24
19
|
} else {
|
|
25
|
-
forEachResort(resortId => noaaForResort(resortId, options));
|
|
20
|
+
forEachResort(resortId => noaaForResort(resortId, options).catch(e => console.error(resortId, e)));
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
23
|
|
|
29
|
-
function noaaForResort(resortId, { overwrite }) {
|
|
30
|
-
const descriptor = readDescriptor(resortId);
|
|
24
|
+
async function noaaForResort(resortId, { overwrite }) {
|
|
25
|
+
const descriptor = await readDescriptor(resortId);
|
|
31
26
|
|
|
32
27
|
const { ll } = descriptor;
|
|
33
|
-
fetch(`https://api.weather.gov/points/${points(ll)}`, {
|
|
28
|
+
const res = await fetch(`https://api.weather.gov/points/${points(ll)}`, {
|
|
34
29
|
headers: {
|
|
35
30
|
'User-Agent': userAgent,
|
|
36
31
|
Accept: 'application/geo+json'
|
|
37
32
|
}
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function descriptorPath(resortId, absolute) {
|
|
55
|
-
const p = `../resorts/${resortId}/resort.json`;
|
|
56
|
-
return absolute ? resolve(__dirname, p) : p;
|
|
33
|
+
});
|
|
34
|
+
if (res.status !== 200) {
|
|
35
|
+
console.error('Cannot find NOAA station for:', resortId);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const {
|
|
39
|
+
properties: { gridId, gridX, gridY }
|
|
40
|
+
} = await res.json();
|
|
41
|
+
const noaa = `${gridId}/${gridX},${gridY}`;
|
|
42
|
+
if (overwrite) {
|
|
43
|
+
descriptor.noaa = noaa;
|
|
44
|
+
await writeDescriptor(resortId, descriptor);
|
|
45
|
+
}
|
|
46
|
+
console.log(resortId, noaa);
|
|
57
47
|
}
|
|
58
48
|
|
|
59
49
|
function writeDescriptor(resortId, descriptor) {
|
|
60
|
-
const filename = descriptorPath(resortId
|
|
61
|
-
|
|
50
|
+
const filename = descriptorPath(resortId);
|
|
51
|
+
return writeFile(filename, `${JSON.stringify(descriptor, null, 2)}\n`);
|
|
62
52
|
}
|
|
63
53
|
|
|
64
|
-
function readDescriptor(resortId) {
|
|
54
|
+
async function readDescriptor(resortId) {
|
|
65
55
|
try {
|
|
66
|
-
|
|
56
|
+
const filename = descriptorPath(resortId);
|
|
57
|
+
return JSON.parse(await readFile(filename, 'utf8'));
|
|
67
58
|
} catch {
|
|
68
59
|
console.error(resortId, 'is not a valid resort ID');
|
|
69
60
|
process.exit(1);
|
|
@@ -74,9 +65,4 @@ program
|
|
|
74
65
|
.option('--overwrite', 'overwrite resort descriptor with new value')
|
|
75
66
|
.arguments('[resort-id]')
|
|
76
67
|
.action(fetchNoaa)
|
|
77
|
-
.parse(
|
|
78
|
-
|
|
79
|
-
if (!done) {
|
|
80
|
-
program.outputHelp();
|
|
81
|
-
process.exit(1);
|
|
82
|
-
}
|
|
68
|
+
.parse();
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import cookie from 'js-cookie';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = about;
|
|
6
|
-
|
|
7
|
-
function about() {
|
|
3
|
+
export default function about() {
|
|
8
4
|
const s = document.querySelector('.hidden .about');
|
|
9
5
|
if (!s) {
|
|
10
6
|
// no hidden 'about' section - nothing to do
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
module.exports = postHeight;
|
|
4
|
-
|
|
5
|
-
/*global window, document*/
|
|
1
|
+
import debounce from 'debounce';
|
|
6
2
|
|
|
7
3
|
function notify() {
|
|
8
4
|
const widget = document.querySelector('.widget');
|
|
@@ -18,7 +14,7 @@ function notify() {
|
|
|
18
14
|
);
|
|
19
15
|
}
|
|
20
16
|
|
|
21
|
-
function postHeight() {
|
|
17
|
+
export default function postHeight() {
|
|
22
18
|
if (window === window.parent) {
|
|
23
19
|
// we are not embedded - nothing to do
|
|
24
20
|
return;
|
package/lib/client/boot/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/*global document */
|
|
11
|
-
/*global window */
|
|
1
|
+
import about from '../about/index.js';
|
|
2
|
+
import minimax from '../minimax/index.js';
|
|
3
|
+
import resort from '../resort/index.js';
|
|
4
|
+
import state from '../state/index.js';
|
|
5
|
+
import stats from '../stats/index.js';
|
|
6
|
+
import tag from '../tag/index.js';
|
|
7
|
+
import height from './height.js';
|
|
8
|
+
import serviceWorker from './service-worker.js';
|
|
12
9
|
|
|
13
10
|
serviceWorker();
|
|
14
11
|
init();
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
module.exports = register;
|
|
2
|
-
|
|
3
|
-
/* global navigator, console */
|
|
4
|
-
|
|
5
1
|
function registrationHandler({ scope, installing, waiting, active }) {
|
|
6
2
|
console.log('SW', scope);
|
|
7
3
|
|
|
@@ -16,7 +12,7 @@ function registrationHandler({ scope, installing, waiting, active }) {
|
|
|
16
12
|
}
|
|
17
13
|
}
|
|
18
14
|
|
|
19
|
-
function register(url = '/sw.js') {
|
|
15
|
+
export default function register(url = '/sw.js') {
|
|
20
16
|
if (navigator.serviceWorker && document.documentElement.hasAttribute('data-service-worker')) {
|
|
21
17
|
return navigator.serviceWorker
|
|
22
18
|
.register(url)
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
module.exports = minimax;
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* @param {Array} elements list of affected element
|
|
5
3
|
* @param {Element} trigger button|link that flips min, max state
|
|
6
4
|
*/
|
|
7
|
-
function minimax(node, selector) {
|
|
5
|
+
export default function minimax(node, selector) {
|
|
8
6
|
const my = {
|
|
9
7
|
trigger: node.querySelector(selector),
|
|
10
8
|
state: 'open', // by default trigger 'open' state
|
package/lib/client/resort/dom.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
function removeAllChildren(node) {
|
|
1
|
+
export function removeAllChildren(node) {
|
|
2
2
|
while (node.hasChildNodes()) {
|
|
3
3
|
node.removeChild(node.lastChild);
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
function next({ nextElementSibling, nextSibling }) {
|
|
7
|
+
export function next({ nextElementSibling, nextSibling }) {
|
|
8
8
|
return nextElementSibling || nextSibling;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
module.exports = {
|
|
12
|
-
next,
|
|
13
|
-
removeAllChildren
|
|
14
|
-
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as dom from './dom.js';
|
|
2
|
+
import lifts from './lifts.js';
|
|
3
|
+
import snow from './snow.js';
|
|
4
|
+
import weather from './weather.js';
|
|
5
|
+
import webcams from './webcams.js';
|
|
4
6
|
|
|
5
7
|
function renderOpening(node, opening) {
|
|
6
8
|
if (opening) {
|
|
@@ -13,12 +15,7 @@ function renderOpening(node, opening) {
|
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
const plugins = [
|
|
17
|
-
require('../resort/lifts'),
|
|
18
|
-
require('../resort/weather'),
|
|
19
|
-
require('../resort/webcams'),
|
|
20
|
-
require('../resort/snow')
|
|
21
|
-
];
|
|
18
|
+
const plugins = [lifts, weather, webcams, snow];
|
|
22
19
|
|
|
23
20
|
function renderPlugins(node, getData) {
|
|
24
21
|
const sec = dom.next(node); // extras section
|
|
@@ -60,7 +57,7 @@ function render(node, resort) {
|
|
|
60
57
|
|
|
61
58
|
const MAX = 12; // update every 12th time
|
|
62
59
|
|
|
63
|
-
function resort(node) {
|
|
60
|
+
export default function resort(node) {
|
|
64
61
|
let updateCounter = MAX;
|
|
65
62
|
|
|
66
63
|
function updateTimeToRefresh(counter) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import * as dom from './dom.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.type = 'lifts';
|
|
3
|
+
render.section = 0;
|
|
4
|
+
render.type = 'lifts';
|
|
6
5
|
|
|
7
6
|
const states = ['open', 'hold', 'scheduled', 'closed'];
|
|
8
7
|
|
|
@@ -29,7 +28,7 @@ function renderColorBar(node, percentage) {
|
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
function render(node, { status, stats }) {
|
|
31
|
+
export default function render(node, { status, stats }) {
|
|
33
32
|
renderStatus(node.querySelector('.lifts'), status);
|
|
34
33
|
renderStats(node.querySelector('.summary'), stats);
|
|
35
34
|
renderColorBar(node.querySelector('.summary-color-bar'), stats.percentage);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const day = 24 * 60 * 60 * 1000;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.type = 'snow';
|
|
3
|
+
render.section = 1;
|
|
4
|
+
render.type = 'snow';
|
|
6
5
|
|
|
7
6
|
// .snow
|
|
8
7
|
// .snowfall= resort.snow.snowfall
|
|
@@ -17,7 +16,7 @@ function renderField(div, field, snow) {
|
|
|
17
16
|
el.classList.toggle('hidden', !value);
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
function render(div, snow) {
|
|
19
|
+
export default function render(div, snow) {
|
|
21
20
|
if (Date.now() - snow.timestamp > day) {
|
|
22
21
|
return false;
|
|
23
22
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const day = 24 * 60 * 60 * 1000;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.type = 'weather';
|
|
3
|
+
render.section = 1;
|
|
4
|
+
render.type = 'weather';
|
|
6
5
|
|
|
7
6
|
// .weather
|
|
8
7
|
// .weather-icon
|
|
@@ -37,7 +36,7 @@ function renderNotice(el, notice) {
|
|
|
37
36
|
el.setAttribute('alt', notice.site);
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
function render(div, weather) {
|
|
39
|
+
export default function render(div, weather) {
|
|
41
40
|
if (Date.now() - weather.timestamp > day) {
|
|
42
41
|
return false;
|
|
43
42
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import swipe from '@pirxpilot/swipe';
|
|
2
|
+
import pager from 'tiny-pager';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
module.exports = render;
|
|
7
|
-
module.exports.section = 1;
|
|
8
|
-
module.exports.type = 'webcams';
|
|
4
|
+
render.section = 1;
|
|
5
|
+
render.type = 'webcams';
|
|
9
6
|
|
|
10
7
|
const DELAY = 15 * 60 * 1000; // update every 15 minutes
|
|
11
8
|
|
|
@@ -44,7 +41,7 @@ function swiper(el) {
|
|
|
44
41
|
};
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
function render(div, webcams) {
|
|
44
|
+
export default function render(div, webcams) {
|
|
48
45
|
let cams;
|
|
49
46
|
let timer;
|
|
50
47
|
let ui;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import K from '@pirxpilot/k';
|
|
2
|
+
import cookie from 'js-cookie';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
const k = K(window);
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
module.exports = state;
|
|
8
|
-
|
|
9
|
-
function state(nodes, st, keys) {
|
|
6
|
+
export default function state(nodes, st, keys) {
|
|
10
7
|
const cookieName = `resorts-${st}`;
|
|
11
8
|
|
|
12
9
|
const self = {
|
package/lib/client/tag/index.js
CHANGED