liftie 4.0.0 → 4.0.2
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 +6 -0
- package/app.js +1 -1
- package/lib/cli/fetch.js +10 -11
- package/lib/cli/for-each-resort.js +2 -8
- package/lib/cli/generate.js +1 -1
- package/lib/cli/noaa.js +23 -32
- package/lib/resorts/alyeska/resort.json +1 -1
- package/lib/resorts/attitash/resort.json +1 -1
- package/lib/resorts/brettonwoods/resort.json +1 -1
- package/lib/resorts/cannon/resort.json +1 -1
- package/lib/resorts/cranmore-mountain/resort.json +1 -1
- package/lib/resorts/gunstock/resort.json +1 -1
- package/lib/resorts/king-pine/resort.json +1 -1
- package/lib/resorts/loon/resort.json +1 -1
- package/lib/resorts/mount-sunapee/resort.json +1 -1
- package/lib/resorts/pats-peak/resort.json +1 -1
- package/lib/resorts/pleasant-mountain/resort.json +1 -1
- package/lib/resorts/ragged-mountain/resort.json +1 -1
- package/lib/resorts/saddleback/resort.json +1 -1
- package/lib/resorts/sugarloaf/resort.json +1 -1
- package/lib/resorts/sunday-river/resort.json +1 -1
- package/lib/resorts/waterville/resort.json +1 -1
- package/lib/resorts/wildcat/resort.json +1 -1
- package/package.json +3 -3
- package/public/scripts/liftie.js +1412 -1414
- package/public/scripts/liftie.js.map +1 -1
- package/public/stylesheets/style.css +2 -2
- package/views/layout.jade +2 -2
- package/public/stylesheets/style.mix.css +0 -1
package/Makefile
CHANGED
|
@@ -10,11 +10,14 @@ LINT_SRC = app.js bin/generate lib test
|
|
|
10
10
|
|
|
11
11
|
PLUGINS = lifts weather webcams snow
|
|
12
12
|
|
|
13
|
+
ESBUILD_FORMAT = esm
|
|
14
|
+
|
|
13
15
|
ESBUILD_OPTS += \
|
|
14
16
|
--bundle \
|
|
15
17
|
--log-level=warning \
|
|
16
18
|
--color=false \
|
|
17
19
|
--tree-shaking=true \
|
|
20
|
+
--format=${ESBUILD_FORMAT} \
|
|
18
21
|
--target=es2018
|
|
19
22
|
|
|
20
23
|
ESBUILD_MIN_OPTS += \
|
|
@@ -57,6 +60,7 @@ all: lint test build
|
|
|
57
60
|
--use postcss-cachify \
|
|
58
61
|
--postcss-cachify.baseUrl /stylesheets \
|
|
59
62
|
--postcss-cachify.basePath public \
|
|
63
|
+
--postcss-cachify.format name \
|
|
60
64
|
--output $@ $@
|
|
61
65
|
|
|
62
66
|
%.min.css: %.css
|
|
@@ -94,9 +98,11 @@ $(BUILD_DIR)/$(PROJECT).js: lib/client/boot/index.js $(SRC) node_modules | $(BUI
|
|
|
94
98
|
$(BUILD_DIR)/$(PROJECT).min.js: lib/client/boot/index.js $(SRC) node_modules | $(BUILD_DIR)
|
|
95
99
|
$(RUN_ESBUILD_MIN)
|
|
96
100
|
|
|
101
|
+
$(BUILD_DIR)/$(PROJECT)-embed.js: ESBUILD_FORMAT=iife
|
|
97
102
|
$(BUILD_DIR)/$(PROJECT)-embed.js: lib/embed/index.js | $(BUILD_DIR)
|
|
98
103
|
$(RUN_ESBUILD)
|
|
99
104
|
|
|
105
|
+
$(BUILD_DIR)/$(PROJECT)-embed.min.js: ESBUILD_FORMAT=iife
|
|
100
106
|
$(BUILD_DIR)/$(PROJECT)-embed.min.js: lib/embed/index.js | $(BUILD_DIR)
|
|
101
107
|
$(RUN_ESBUILD_MIN)
|
|
102
108
|
|
package/app.js
CHANGED
|
@@ -28,7 +28,7 @@ process.env.NODE_ENV ??= 'development';
|
|
|
28
28
|
const root = path.join(path.dirname(new URL(import.meta.url).pathname), 'public');
|
|
29
29
|
const { SITE_URL: siteUrl, LIFTIE_STATIC_HOST: staticHost = '' } = process.env;
|
|
30
30
|
|
|
31
|
-
const cachify = cachifyStatic(root);
|
|
31
|
+
const cachify = cachifyStatic(root, { format: 'name' });
|
|
32
32
|
|
|
33
33
|
app.locals = {
|
|
34
34
|
min: '.min',
|
package/lib/cli/fetch.js
CHANGED
|
@@ -3,22 +3,21 @@ import { program } from 'commander';
|
|
|
3
3
|
import curl from './curl.js';
|
|
4
4
|
import { descriptorPath } from './dirs.js';
|
|
5
5
|
|
|
6
|
-
let done;
|
|
7
|
-
|
|
8
6
|
async function fetchExample(resortId) {
|
|
9
7
|
try {
|
|
10
8
|
const resort = JSON.parse(readFileSync(descriptorPath(resortId), 'utf8'));
|
|
11
|
-
done = true;
|
|
12
9
|
await curl(resort.dataUrl || resort.api || resort.url, resortId);
|
|
13
|
-
} catch
|
|
14
|
-
console.error(resortId
|
|
10
|
+
} catch {
|
|
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,14 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readdirSync } from 'node:fs';
|
|
2
2
|
import { lib } from './dirs.js';
|
|
3
3
|
export default forEachResort;
|
|
4
4
|
|
|
5
5
|
function forEachResort(fn) {
|
|
6
6
|
console.log('Reading:', lib);
|
|
7
|
-
|
|
8
|
-
if (err) {
|
|
9
|
-
console.error(err);
|
|
10
|
-
process.exit(1);
|
|
11
|
-
}
|
|
12
|
-
dirents.filter(dirent => dirent.isDirectory()).forEach(({ name }) => fn(name));
|
|
13
|
-
});
|
|
7
|
+
readdirSync(lib, { withFileTypes: true }).forEach(dirent => dirent.isDirectory() && fn(dirent.name));
|
|
14
8
|
}
|
package/lib/cli/generate.js
CHANGED
|
@@ -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);
|
package/lib/cli/noaa.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { program } from 'commander';
|
|
3
3
|
import { descriptorPath } from './dirs.js';
|
|
4
4
|
import forEachResort from './for-each-resort.js';
|
|
5
5
|
|
|
6
|
-
let done = false;
|
|
7
|
-
|
|
8
6
|
const userAgent = 'Mozilla/5.0 (compatible; Liftie/1.0; +https://liftie.info)';
|
|
9
7
|
|
|
10
8
|
function points([lon, lat]) {
|
|
@@ -16,49 +14,47 @@ function points([lon, lat]) {
|
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
function fetchNoaa(resortId, options) {
|
|
19
|
-
done = true;
|
|
20
|
-
|
|
21
17
|
if (resortId) {
|
|
22
18
|
noaaForResort(resortId, options);
|
|
23
19
|
} else {
|
|
24
|
-
forEachResort(resortId => noaaForResort(resortId, options));
|
|
20
|
+
forEachResort(resortId => noaaForResort(resortId, options).catch(e => console.error(resortId, e)));
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
23
|
|
|
28
|
-
function noaaForResort(resortId, { overwrite }) {
|
|
29
|
-
const descriptor = readDescriptor(resortId);
|
|
24
|
+
async function noaaForResort(resortId, { overwrite }) {
|
|
25
|
+
const descriptor = await readDescriptor(resortId);
|
|
30
26
|
|
|
31
27
|
const { ll } = descriptor;
|
|
32
|
-
fetch(`https://api.weather.gov/points/${points(ll)}`, {
|
|
28
|
+
const res = await fetch(`https://api.weather.gov/points/${points(ll)}`, {
|
|
33
29
|
headers: {
|
|
34
30
|
'User-Agent': userAgent,
|
|
35
31
|
Accept: 'application/geo+json'
|
|
36
32
|
}
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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);
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
function writeDescriptor(resortId, descriptor) {
|
|
54
50
|
const filename = descriptorPath(resortId);
|
|
55
|
-
|
|
51
|
+
return writeFile(filename, `${JSON.stringify(descriptor, null, 2)}\n`);
|
|
56
52
|
}
|
|
57
53
|
|
|
58
|
-
function readDescriptor(resortId) {
|
|
54
|
+
async function readDescriptor(resortId) {
|
|
59
55
|
try {
|
|
60
56
|
const filename = descriptorPath(resortId);
|
|
61
|
-
return JSON.parse(
|
|
57
|
+
return JSON.parse(await readFile(filename, 'utf8'));
|
|
62
58
|
} catch {
|
|
63
59
|
console.error(resortId, 'is not a valid resort ID');
|
|
64
60
|
process.exit(1);
|
|
@@ -69,9 +65,4 @@ program
|
|
|
69
65
|
.option('--overwrite', 'overwrite resort descriptor with new value')
|
|
70
66
|
.arguments('[resort-id]')
|
|
71
67
|
.action(fetchNoaa)
|
|
72
|
-
.parse(
|
|
73
|
-
|
|
74
|
-
if (!done) {
|
|
75
|
-
program.outputHelp();
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
68
|
+
.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "liftie",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Clean, simple, easy to read, fast ski resort lift status",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@biomejs/biome": "2.2.6",
|
|
62
62
|
"@pirxpilot/stylus": "^1.2.0",
|
|
63
|
-
"commander": "~
|
|
63
|
+
"commander": "~14",
|
|
64
64
|
"postcss": "~8",
|
|
65
|
-
"postcss-cachify": "^
|
|
65
|
+
"postcss-cachify": "^5.0.0",
|
|
66
66
|
"postcss-cli-simple": "~4.0.0",
|
|
67
67
|
"prompt": "~1",
|
|
68
68
|
"undici": "^7.10.0"
|