generated from shgysk8zer0/npm-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from shgysk8zer0/setup
Initial setup and defintions
- Loading branch information
Showing
14 changed files
with
1,151 additions
and
585 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
*.cjs | ||
*.min.* | ||
*.map | ||
.env | ||
# Logs | ||
logs | ||
*.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ importmap.yaml | |
*.log | ||
*.min.* | ||
*.map | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,64 @@ | ||
# npm-template | ||
A template repo for npm packages | ||
# @shgysk8zer0/consts | ||
|
||
A collection of constants for files, HTTP, dates, etc. | ||
|
||
This is nothing special. It's just a bunch of commonly used and useful constants. | ||
Why? Because I kept defining constants in different projects for the same things, | ||
so decided to just do it once and avoid repeating myself. | ||
|
||
[![CodeQL](https://github.com/shgysk8zer0/node-http/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/shgysk8zer0/http/actions/workflows/codeql-analysis.yml) | ||
![Node CI](https://github.com/shgysk8zer0/node-http/workflows/Node%20CI/badge.svg) | ||
![Lint Code Base](https://github.com/shgysk8zer0/node-http/workflows/Lint%20Code%20Base/badge.svg) | ||
|
||
[![GitHub license](https://img.shields.io/github/license/shgysk8zer0/node-http.svg)](https://github.com/shgysk8zer0/node-http/blob/master/LICENSE) | ||
[![GitHub last commit](https://img.shields.io/github/last-commit/shgysk8zer0/node-http.svg)](https://github.com/shgysk8zer0/node-http/commits/master) | ||
[![GitHub release](https://img.shields.io/github/release/shgysk8zer0/node-http?logo=github)](https://github.com/shgysk8zer0/node-http/releases) | ||
[![GitHub Sponsors](https://img.shields.io/github/sponsors/shgysk8zer0?logo=github)](https://github.com/sponsors/shgysk8zer0) | ||
|
||
[![npm](https://img.shields.io/npm/v/@shgysk8zer0/http)](https://www.npmjs.com/package/@shgysk8zer0/http) | ||
![node-current](https://img.shields.io/node/v/@shgysk8zer0/http) | ||
![npm bundle size gzipped](https://img.shields.io/bundlephobia/minzip/@shgysk8zer0/http) | ||
[![npm](https://img.shields.io/npm/dw/@shgysk8zer0/http?logo=npm)](https://www.npmjs.com/package/@shgysk8zer0/http) | ||
|
||
[![GitHub followers](https://img.shields.io/github/followers/shgysk8zer0.svg?style=social)](https://github.com/shgysk8zer0) | ||
![GitHub forks](https://img.shields.io/github/forks/shgysk8zer0/node-http.svg?style=social) | ||
![GitHub stars](https://img.shields.io/github/stars/shgysk8zer0/node-http.svg?style=social) | ||
[![Twitter Follow](https://img.shields.io/twitter/follow/shgysk8zer0.svg?style=social)](https://twitter.com/shgysk8zer0) | ||
|
||
[![Donate using Liberapay](https://img.shields.io/liberapay/receives/shgysk8zer0.svg?logo=liberapay)](https://liberapay.com/shgysk8zer0/donate "Donate using Liberapay") | ||
- - - | ||
|
||
- [Code of Conduct](./.github/CODE_OF_CONDUCT.md) | ||
- [Contributing](./.github/CONTRIBUTING.md) | ||
<!-- - [Security Policy](./.github/SECURITY.md) --> | ||
|
||
## Installation | ||
|
||
```bash | ||
npm i @shgysk8zer0/consts | ||
``` | ||
|
||
## Usage | ||
```js | ||
import * as HTTP_STATUS from '@shgysk8zer0/consts/status.js'; | ||
import * as TYPES from '@shgysk8zer0/consts/types.js'; | ||
import * as EXTS from '@shgysk8zer0/consts/exts.js'; | ||
import { DAY } from '@shgysk8zer0/consts/date.js'; | ||
``` | ||
|
||
### Tip | ||
|
||
You can use `<importmap>` to make use in client-side code easier: | ||
|
||
```html | ||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.0/" | ||
} | ||
} | ||
</script> | ||
``` | ||
|
||
... If you don't want to take that route, you can always update the example code | ||
with full URLs: `https://unpkg.com/@shgysk8zer0/consts/*`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* @copyright 2023 Chris Zuber <admin@kernvalley.us> | ||
*/ | ||
export const SECONDS = 1000; | ||
export const MINUTES = 60 * SECONDS; | ||
export const HOURS = 60 * MINUTES; | ||
export const DAYS = 24 * HOURS; | ||
export const WEEKS = 7 * DAYS; | ||
export const YEARS = 365 * DAYS; | ||
|
||
export const days = [{ | ||
name: 'Sunday', | ||
short: 'Sun', | ||
}, { | ||
name: 'Monday', | ||
short: 'Mon', | ||
}, { | ||
name: 'Tuesday', | ||
short: 'Tue', | ||
}, { | ||
name: 'Wednesday', | ||
short: 'Wed', | ||
}, { | ||
name: 'Thursday', | ||
short: 'Thu', | ||
}, { | ||
name: 'Friday', | ||
short: 'Fri', | ||
}, { | ||
name: 'Saturday', | ||
short: 'Sat', | ||
}]; | ||
|
||
export const months = [{ | ||
name: 'January', | ||
short: 'Jan', | ||
}, { | ||
name: 'February', | ||
short: 'Feb', | ||
}, { | ||
name: 'March', | ||
short: 'Mar', | ||
}, { | ||
name: 'April', | ||
short: 'April', | ||
}, { | ||
name: 'May', | ||
short: 'May', | ||
}, { | ||
name: 'June', | ||
short: 'June', | ||
}, { | ||
name: 'July', | ||
short: 'July', | ||
}, { | ||
name: 'August', | ||
short: 'Aug', | ||
}, { | ||
name: 'September', | ||
short: 'Sep', | ||
}, { | ||
name: 'October', | ||
short: 'Oct', | ||
}, { | ||
name: 'November', | ||
short: 'Nov', | ||
}, { | ||
name: 'December', | ||
short: 'Dec', | ||
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* @copyright 2023 Chris Zuber <admin@kernvalley.us> | ||
*/ | ||
|
||
// Text and Code | ||
export const TEXT = ['.txt']; | ||
export const PLAIN_TEXT = TEXT; | ||
export const HTML = ['.html', '.htm']; | ||
export const CSS = ['.css']; | ||
export const JS = ['.js']; | ||
export const JSON = ['.json']; | ||
export const JSON_LD = ['.jsonld']; | ||
export const WEB_APP_MANIFEST = ['.webmanifest']; | ||
export const XML = ['.xml']; | ||
export const RSS_XML = ['.rss']; | ||
export const RSS = RSS_XML; | ||
export const ATOM_XML = ['.atom']; | ||
export const ATOM = ATOM_XML; | ||
export const XSLT = ['.xslt']; | ||
export const XHTML = ['.xhtml']; | ||
export const MARKDOWN = ['.md']; | ||
|
||
// Images | ||
export const JPEG = ['.jpeg', '.jpg']; | ||
export const PNG = ['.png']; | ||
export const GIF = ['.gif']; | ||
export const WEBP = ['.webp']; | ||
export const SVG = ['.svg']; | ||
export const GIMP = ['.xcf']; | ||
|
||
// Audio | ||
export const OGG_AUDIO = ['.ogg', '.oga']; | ||
export const OGA = OGG_AUDIO; | ||
export const MP3 = ['.mp3']; | ||
export const AAC = ['.aac']; | ||
export const FLAC = ['.flac']; | ||
export const WAV = ['.wav']; | ||
export const MIDI = ['.midi']; | ||
|
||
// Video | ||
export const WEBM = ['.webm']; | ||
export const OGG_VIDEO = ['.ogg', '.ogv']; | ||
export const OGV = OGG_VIDEO; | ||
export const MP4 = ['.mp4']; | ||
export const WEBVTT = ['.vtt']; | ||
|
||
// Fonts | ||
export const WOFF = ['.woff']; | ||
export const WOFF2 = ['.woff2']; | ||
export const TTF = ['.ttf']; | ||
export const OTF = ['.otf']; | ||
export const SVG_FONT = ['.svg']; | ||
|
||
// Office Documents | ||
export const CSV = ['.csv']; | ||
export const RTF = ['.rtf']; | ||
export const PDF = ['.pdf']; | ||
export const ICAL = ['.ics']; | ||
export const VCARD = ['.vcf']; | ||
|
||
// Libre Office and Open Office | ||
export const LIBRE_OFFICE_TEXT = ['.odt']; | ||
export const LIBRE_OFFICE_SPREADSHEET = ['.ods']; | ||
export const LIBRE_OFFICE_PRESENTATION = ['.odp']; | ||
|
||
// Microsoft Office | ||
export const MS_WORD = ['.doc']; | ||
export const MS_EXCEL = ['.xls']; | ||
export const MS_POWERPOINT = ['.ppt']; | ||
|
||
// Compressed Archives | ||
export const GZIP = ['.gz']; | ||
export const ZIP = ['.zip']; | ||
|
||
// Adobe Types | ||
export const ADOBE_PDF = PDF; | ||
export const ADOBE_POSTSCRIPT = ['.ps']; | ||
export const ADOBE_ILLUSTRATOR = ['.ai']; | ||
export const ADOBE_PHOTOSHOP = ['.psd']; | ||
export const ADOBE_FLASH = ['.swf']; | ||
export const ADOBE_PREMIERE = ['.pr']; | ||
export const ADOBE_AFTER_EFFECTS = ['.aep']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* @copyright 2023 Chris Zuber <admin@kernvalley.us> | ||
*/ | ||
export const HTML = 'http://www.w3.org/1999/xhtml'; | ||
export const SVG = 'http://www.w3.org/2000/svg'; | ||
export const XLINK = 'http://www.w3.org/1999/xlink'; | ||
export const MATHML = 'http://www.w3.org/1998/Math/MathML'; |
Oops, something went wrong.