From fb29a99390dc1fbc1a3d8af35e7facfa58bac855 Mon Sep 17 00:00:00 2001 From: Adam Fanello Date: Sun, 3 May 2020 13:41:08 -0700 Subject: [PATCH] Include Typescript declarations Refactored source and build process to include Typescript declarations as well as ES6 Javascript. --- .gitignore | 4 +++- README.md | 4 ++++ package-lock.json | 14 ++++++++++++++ package.json | 11 +++++++++-- temporal-constants.js => temporal-constants.ts | 0 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 package-lock.json rename temporal-constants.js => temporal-constants.ts (100%) diff --git a/.gitignore b/.gitignore index c6ef218..ba64c17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .idea - +*.d.ts +*.js +node_modules diff --git a/README.md b/README.md index f37bbed..99905c0 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ Or in place of: `setTimer(() => runMyFunction(), 24*60*60*1000)` you get the clearer (and faster): `setTimer(() => runMyFunction(), MillisecondsInDay)`. +## Compatibility + +Compatible with Javascript ES2015/ES6 and newer, as well as Typescript. + ## FAQ *Q:* Why should I introduce another dependency for a few constants that I can define myself? diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..a168c18 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,14 @@ +{ + "name": "temporal-constants", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "typescript": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "dev": true + } + } +} diff --git a/package.json b/package.json index 9759564..b3b8b69 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,19 @@ "name": "temporal-constants", "version": "1.0.0", "description": "Constants to compute with time units without magic numbers.", - "main": "temporal-constants.js", + "main": "temporal-constants", + "types": "temporal-constants", "keywords": [ "time", "constant", "temporal" ], "author": "Adam Fanello", - "license": "MIT" + "license": "MIT", + "scripts": { + "build": "tsc -t ES6 -d --strict temporal-constants.ts" + }, + "devDependencies": { + "typescript": "^3.8.3" + } } diff --git a/temporal-constants.js b/temporal-constants.ts similarity index 100% rename from temporal-constants.js rename to temporal-constants.ts