-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcheck-version.js
More file actions
76 lines (71 loc) · 3.76 KB
/
check-version.js
File metadata and controls
76 lines (71 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { execSync } from "node:child_process";
import { rmSync, writeFileSync } from "node:fs";
const TSCONFIG = "./tsconfig.check-version.json";
const checks = [
{ entrypoint: "src/maptilersdk.ts" },
{
entrypoint: "src/maptilersdk.ts",
paths: {
"@maptiler/sdk": ["../node_modules/@maptiler/sdk--v3.0/dist/maptiler-sdk.d.ts"],
"maplibre-gl": ["../node_modules/@maptiler/sdk--v3.0/node_modules/maplibre-gl/dist/maplibre-gl.d.ts", "../node_modules/maplibre-gl/dist/maplibre-gl.d.ts"],
},
},
{
entrypoint: "src/maptilersdk.ts",
paths: {
"@maptiler/sdk": ["../node_modules/@maptiler/sdk--v3.5/dist/maptiler-sdk.d.ts"],
"maplibre-gl": ["../node_modules/@maptiler/sdk--v3.5/node_modules/maplibre-gl/dist/maplibre-gl.d.ts", "../node_modules/maplibre-gl/dist/maplibre-gl.d.ts"],
},
},
{
entrypoint: "src/maptilersdk.ts",
paths: {
"@maptiler/sdk": ["../node_modules/@maptiler/sdk--v3.11/dist/maptiler-sdk.d.ts"],
"maplibre-gl": ["../node_modules/@maptiler/sdk--v3.11/node_modules/maplibre-gl/dist/maplibre-gl.d.ts", "../node_modules/maplibre-gl/dist/maplibre-gl.d.ts"],
},
},
{
entrypoint: "src/maptilersdk.ts",
paths: {
"@maptiler/sdk": ["../node_modules/@maptiler/sdk--v4.0/dist/maptiler-sdk.d.ts"],
"maplibre-gl": ["../node_modules/@maptiler/sdk--v4.0/node_modules/maplibre-gl/dist/maplibre-gl.d.ts", "../node_modules/maplibre-gl/dist/maplibre-gl.d.ts"],
},
},
{ entrypoint: "src/maplibregl.ts" },
{ entrypoint: "src/maplibregl.ts", paths: { "maplibre-gl": ["../node_modules/maplibre-gl--v5.0/dist/maplibre-gl.d.ts"] } },
{ entrypoint: "src/maplibregl.ts", paths: { "maplibre-gl": ["../node_modules/maplibre-gl--v5.5/dist/maplibre-gl.d.ts"] } },
{ entrypoint: "src/maplibregl.ts", paths: { "maplibre-gl": ["../node_modules/maplibre-gl--v5.10/dist/maplibre-gl.d.ts"] } },
{ entrypoint: "src/maplibregl.ts", paths: { "maplibre-gl": ["../node_modules/maplibre-gl--v5.15/dist/maplibre-gl.d.ts"] } },
{ entrypoint: "src/maplibregl.ts", paths: { "maplibre-gl": ["../node_modules/maplibre-gl--v5.20/dist/maplibre-gl.d.ts"] } },
{ entrypoint: "src/leaflet.public.ts" },
{ entrypoint: "src/leaflet.public.ts", paths: { leaflet: ["../node_modules/@types/leaflet--v1.5/index.d.ts"] } },
{ entrypoint: "src/leaflet.public.ts", paths: { leaflet: ["../node_modules/@types/leaflet--v1.7/index.d.ts"] } },
{ entrypoint: "src/leaflet.public.ts", paths: { leaflet: ["../node_modules/@types/leaflet--v1.9/index.d.ts"] } },
{ entrypoint: "src/leaflet.public.ts", paths: { leaflet: ["../tmp/@types/leaflet-v2/index.d.ts"] } },
{ entrypoint: "src/openlayers.public.ts" },
{ entrypoint: "src/openlayers.public.ts", paths: { ol: ["../node_modules/ol--v9.0/index.d.ts"], "ol/*": ["../node_modules/ol--v9.0/*.d.ts"] } },
{ entrypoint: "src/openlayers.public.ts", paths: { ol: ["../node_modules/ol--v9.2/index.d.ts"], "ol/*": ["../node_modules/ol--v9.2/*.d.ts"] } },
{ entrypoint: "src/openlayers.public.ts", paths: { ol: ["../node_modules/ol--v10.0/index.d.ts"], "ol/*": ["../node_modules/ol--v10.0/*.d.ts"] } },
{ entrypoint: "src/openlayers.public.ts", paths: { ol: ["../node_modules/ol--v10.3/index.d.ts"], "ol/*": ["../node_modules/ol--v10.3/*.d.ts"] } },
{ entrypoint: "src/openlayers.public.ts", paths: { ol: ["../node_modules/ol--v10.6/index.d.ts"], "ol/*": ["../node_modules/ol--v10.6/*.d.ts"] } },
];
for (const { entrypoint, paths = {} } of checks) {
writeFileSync(
TSCONFIG,
JSON.stringify(
{
extends: "./tsconfig.json",
compilerOptions: {
types: [],
paths,
},
include: [entrypoint, "src/*.d.ts"],
},
null,
2,
),
{ encoding: "utf-8" },
);
execSync(`npx tsc -p ${TSCONFIG}`, { encoding: "utf-8" });
}
rmSync(TSCONFIG);