Skip to content

Commit

Permalink
RSVP methods refactoring & module system change (#12)
Browse files Browse the repository at this point in the history
* Export RSVP methods object.

* Use module system ES6 instead of UMD.

UMD only useful to insert script directly to browser. But it causes issues for webpack.

* Bump version.

* Replace build scripts with CLI commands.
  • Loading branch information
barinbritva authored Nov 4, 2023
1 parent d82c5b2 commit 84c29e5
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 129 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.3.1] - 2023-11-04

### Changed

- Module system changed from `UMD` to 'ES6' for better compatibility with bundlers
- Inner refactoring of `RSVP` methods

## [1.2.1] - 2022-04-24

### Added
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@barinbritva/add-to-calendar",
"version": "1.2.1",
"version": "1.3.1",
"keywords": [
"event",
"add",
Expand All @@ -23,12 +23,11 @@
"engineStrict": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "ts-node ./tasks/run-build.ts",
"build:dev": "ts-node --project ./tsconfig-dev.json ./tasks/run-build.ts -d",
"build": "tsc",
"build:dev": "tsc --project ./tsconfig-dev.json -w",
"test": "vitest run",
"test:dev": "vitest watch",
"test:coverage": "vitest run --coverage",
"release": "ts-node ./tasks/run-release.ts",
"typedoc": "typedoc --out docs src/index.ts",
"prettier:lint": "prettier --check \"./src/**/*.{ts,tsx,json}\"",
"prettier:fix": "prettier --write \"./src/**/*.{ts,tsx,json}\""
Expand Down
16 changes: 5 additions & 11 deletions src/Generator/ICalendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,12 @@ export interface DataPiece {

export type Method = 'PUBLISH' | 'REQUEST' | 'REPLY' | 'ADD' | 'CANCEL';

const publish: Method = 'PUBLISH';
const request: Method = 'REQUEST';
const reply: Method = 'REPLY';
const add: Method = 'ADD';
const cancel: Method = 'CANCEL';

export const Methods = {
Publish: publish,
Request: request,
Reply: reply,
Add: add,
Cancel: cancel
Publish: 'PUBLISH' as const,
Request: 'REQUEST' as const,
Reply: 'REPLY' as const,
Add: 'ADD' as const,
Cancel: 'CANCEL' as const
};

export interface InvitationMeta {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export {Outlook} from './Generator/Outlook';
export {Office365} from './Generator/Office365';
export {Google} from './Generator/Google';
export {Yahoo} from './Generator/Yahoo';
export {ICalendar} from './Generator/ICalendar';
export {ICalendar, Methods} from './Generator/ICalendar';
export {MultiGenerator} from './Generator/MultiGenerator';
36 changes: 0 additions & 36 deletions tasks/build.ts

This file was deleted.

53 changes: 0 additions & 53 deletions tasks/process.ts

This file was deleted.

11 changes: 0 additions & 11 deletions tasks/run-build.ts

This file was deleted.

8 changes: 0 additions & 8 deletions tasks/run-release.ts

This file was deleted.

3 changes: 1 addition & 2 deletions tests/i-calendar.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {describe, expect, it, beforeAll, afterAll} from 'vitest';
import sinon from 'sinon';
import {Event, ICalendar} from '../src';
import {Methods} from '../src/Generator/ICalendar';
import {Event, ICalendar, Methods} from '../src';

const random = sinon.stub(Math, 'random');

Expand Down
1 change: 0 additions & 1 deletion tsconfig-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// Development specific
"removeComments": false,
"sourceMap": true,
"watch": true,
// Checks
"noUnusedLocals": false,
"allowUnreachableCode": true
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"module": "UMD",
"module": "ES6",
"moduleResolution": "Node",
"target": "ES2015",
"outDir": "./dist",
Expand All @@ -16,7 +16,6 @@
// Production specific
"removeComments": true,
"sourceMap": false,
"watch": false,
// Checks
"allowUnreachableCode": false,
"noFallthroughCasesInSwitch": true,
Expand Down

0 comments on commit 84c29e5

Please sign in to comment.