Commit 31f78190 authored by Grant's avatar Grant
Browse files

Add example and update readme

parent 157519a1
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
npmAlwaysAuth: true
npmAuthToken: ${NPM_TOKEN}
nodeLinker: node-modules
 No newline at end of file
+5 −1
Original line number Diff line number Diff line
@@ -11,10 +11,14 @@ npm install icscream
```typescript
import { parseICS } from "icscream";

const icsData = await fetch("https://example.com/calendar.ics");
const icsData = await fetch("https://example.com/calendar.ics").then(res => res.text());
const vcalendar = parseICS("VCALENDAR", icsData);
```

## Examples

Check the [/examples/README.md](https://sc07.dev/grant/icscream/-/blob/main/examples/README.md?ref_type=heads)

## Contributing

Source is available and contributable on [sc07.dev/grant/icscream](https://sc07.dev/grant/icscream) and a **read-only** mirror is available on [github.com/grahhnt/icscream](https://github.com/grahhnt/icscream)

examples/.gitignore

0 → 100644
+8 −0
Original line number Diff line number Diff line
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnp.*
node_modules
 No newline at end of file

examples/.yarnrc.yml

0 → 100644
+1 −0
Original line number Diff line number Diff line
nodeLinker: node-modules
 No newline at end of file

examples/README.md

0 → 100644
+20 −0
Original line number Diff line number Diff line
# icscream Examples

## merge-ics.ts

*The main example, ripped from another tiny project*

This script takes a source ICS and a target CalDav ICS resource and merges/updates the CalDav resource

**Environment Variables Used**
| Environment | Required | Example | |
| --- | --- | --- | --- |
| `CALDAV_HOST` | Yes | `https://caldav.icloud.com` | The CalDav host to update |
| `CALDAV_USER` | Yes | `example@icloud.com` | The CalDav username to login under |
| `CALDAV_PASS` | Yes | [`abc-000-xyz-111`](https://support.apple.com/en-us/102654) | The CalDav password to login under |
| `CALENDAR_NAME` | Yes | `Work Schedule` | Target calendar to update |
| `ICS_SOURCE` | Yes | `https://example.org/schedule.ics` | Source ICS file to fetch from |
| `ICS_TARGET` | Yes | `scheduling-app.ics` | Target ICS filename in CalDav to store under. This resource will be created if it does not exist server-side |

**Running**
Run this example by building the parent project & running `yarn merge-ics` with the proper environment variables
 No newline at end of file
Loading