Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript Rewrite #4

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
29 changes: 0 additions & 29 deletions .eslintrc.js

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Check

on:
push:
paths-ignore:
- .vscode/**
- README.md

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn install
- run: yarn lint

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn install
- run: yarn tsc

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn install
- run: yarn test
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
branches:
- main
paths:
- '**/package.json'
- .changeset/**
- .github/workflows/release.yml

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn install
- run: yarn build
- uses: changesets/action@v1
with:
publish: yarn changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
107 changes: 4 additions & 103 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,104 +1,5 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
node_modules
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
yarn-error.log
.yarn
*.tsbuildinfo
3 changes: 0 additions & 3 deletions .npmignore

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["biomejs.biome"]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
}
}
2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodeLinker: node-modules
compressionLevel: mixed
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Ewan Breakey
Copyright (c) 2022 Stevent Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
67 changes: 36 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,54 @@
# 🏴‍☠️ AyeCal

Javascript iCal creation utility.
[![npm version](https://img.shields.io/npm/v/ayecal)](https://www.npmjs.com/package/ayecal)
[![minzip size](https://img.shields.io/bundlephobia/minzip/ayecal)](https://bundlephobia.com/package/ayecal)

### Usage
Typescript iCal creation, parsing and manipulation toolset 🪄📆
Conforms to the [RFC 5545](https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.8.2) specification.

> [!WARNING]
> This library is currently in alpha and the API may change significantly between versions.

## Usage

Install from npm

```bash
npm install ayecal # or yarn add ayecal
yarn add ayecal
```

**Creating Calendars**
### Creating Calendars

```js
import ayecal from 'ayecal'
```ts
import { Calendar, Event } from 'ayecal'

// Create a calendar
// Provide a name and a "scope" which distinguishes events from other calendars
const myCalendar = ayecal({
const myCalendar = new Calendar({
name: 'My Calendar',
scope: 'custom-calendar.net',
timeZone: 'Australia/Melbourne',
})
.setTimezone('Australia/Melbourne')
.addEvent({
.addEvent(new Event({
summary: 'Jacob\'s 22nd Birthday Party',
location: 'My apartment',
description: 'Hey everyone! Come to my party :)',
uid: 5678, // from your API
startTime: new Date(),
endTime: new Date(),
})
}))

// Convert to an ICS string
const myICS = myCalendar.toICS()
// Convert to an iCalendar string (ics)
const myICS = myCalendar.toString()
```

**Creating Events**
### Creating Events

```js
import ayecal from 'ayecal'
```ts
import { Calendar, Event } from 'ayecal'

// Create an event
const myEvent = ayecal.event({
const myEvent = new Event({
summary: 'Company Mixer',
location: '32 Downtown St, Melbourne Australia',
description: 'Hey everyone! Come to my party :)',
Expand All @@ -50,30 +57,28 @@ const myEvent = ayecal.event({
endTime: new Date(),
})

// Convert to an ICS string
const eventICS = myEvent.toICS()
// Convert to an iCalendar string (ics)
const eventICS = myEvent.toString()

// Add to an existing calendar
const myCalendar = ayecal()
const myCalendar = new Calendar()
myCalendar.addEvent(myEvent)
```

### Contributing
## Contributing

PRs are welcomed :)
Issues and pull requests are welcomed.

Run `yarn` to install dependencies then `yarn watch` to build on file changes.
### Development Setup

Run `yarn test` before committing to run the test cases.
1. Make sure you have `Node` installed, and run `corepack enable`
2. Run `yarn` to install dependencies
3. Run `yarn test` to run the test cases

### To Do
### Changesets

- [ ] Recurring Event Support
- [ ] To Do Support
- [ ] ICS Parsing
- [ ] Non-mutable objects?
- [ ] Support all fields from the iCal spec
This library uses [changesets](https://github.com/changesets/changesets), if the changes you've made would constitute a version bump, run `yarn changeset` and follow the prompts to document the changes you've made. Changesets are consumed on releases, and used to generate a changelog and bump version number.

### License
## License

MIT License, Ewan Breakey 2022
Created by Stevent and licensed under MIT
Loading