You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-4Lines changed: 17 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,19 @@ node-ical is available on npm:
15
15
npm install node-ical
16
16
```
17
17
18
+
## Module formats
19
+
node-ical provides an ESM-first entry point while keeping CommonJS compatibility.
20
+
21
+
```javascript
22
+
// ESM
23
+
importicalfrom'node-ical';
24
+
```
25
+
26
+
```javascript
27
+
// CommonJS
28
+
constical=require('node-ical');
29
+
```
30
+
18
31
## API
19
32
The API has now been broken into three sections:
20
33
-[sync](#sync)
@@ -29,8 +42,8 @@ All functions will either return a promise for `async/await` or use a callback i
29
42
30
43
`autodetect` provides a mix of both for backwards compatibility with older node-ical applications.
31
44
32
-
All API functions are documented using JSDoc in the [node-ical.js](node-ical.js) file.
33
-
This allows for IDE hinting!
45
+
All API functions are documented in the runtime entry files and exposed through the bundled typings in [node-ical.d.ts](node-ical.d.ts).
46
+
This allows for IDE hinting in both CommonJS and ESM projects.
34
47
35
48
### sync
36
49
```javascript
@@ -197,9 +210,9 @@ Fetch the specified URL using the native fetch API (```options``` are passed to
197
210
198
211
#### Example: Print list of upcoming node conferences
199
212
200
-
See [`examples/example.mjs`](./examples/example.mjs) for a full example script.
213
+
See [`examples/example.js`](./examples/example.js) for a full example script.
201
214
202
-
> **Note:** This snippet uses `import` and top-level `await` (ESM). Save it as a `.mjs` file, or add `"type": "module"` to your `package.json`.
215
+
> **Note:** This snippet uses `import` and top-level `await` (ESM). Save it as a `.mjs` file, or add `"type": "module"` to your `package.json`. If you prefer CommonJS in your own project, keep using `require('node-ical')` from a `.cjs` file.
Copy file name to clipboardExpand all lines: build/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This folder contains data and scripts used to generate `windowsZones.json`, the
4
4
5
5
## Files
6
6
7
-
-`update-windows-zones.mjs`: Node-only updater that fetches the upstream CLDR `windowsZones.xml` and regenerates `windowsZones.json` using fast-xml-parser.
7
+
-`update-windows-zones.js`: Node-only updater that fetches the upstream CLDR `windowsZones.xml` and regenerates `windowsZones.json` using fast-xml-parser.
8
8
-`windowsZonesOld.json`: A curated map of legacy Windows display-name labels (the human-readable aliases used by various Outlook/Exchange/ICS exporters) to the canonical Windows time zone IDs (e.g., `"(UTC+03:00) Tbilisi" -> "Georgian Standard Time"`).
9
9
10
10
## Why `windowsZonesOld.json` exists
@@ -19,7 +19,7 @@ To keep `node-ical` resilient, we preserve a set of these legacy labels and map
19
19
20
20
## How generation works
21
21
22
-
1.`update-windows-zones.mjs` downloads CLDR `windowsZones.xml` and parses it directly.
22
+
1.`update-windows-zones.js` downloads CLDR `windowsZones.xml` and parses it directly.
23
23
2. It builds a `zoneTable` from CLDR, mapping Windows IDs to `{ iana: [primaryIana] }`.
24
24
3. It then loads `build/windowsZonesOld.json` and, for each legacy label (top-level key), looks up the canonical Windows ID (value) and injects a mapping entry into the final `zoneTable` so that legacy labels resolve to the same IANA zone as the canonical ID.
25
25
4. The script writes `windowsZones.json` in a one-entry-per-line format with sorted keys for stable diffs.
@@ -38,7 +38,7 @@ npm run build:strict
38
38
# or
39
39
CI=true npm run build
40
40
# or (low-level)
41
-
node build/update-windows-zones.mjs --strict
41
+
node build/update-windows-zones.js --strict
42
42
```
43
43
44
44
Note: CI runs the generator in strict mode to catch unresolved aliases early in pull requests.
0 commit comments