Skip to content

Commit

Permalink
Merge pull request #1 from shgysk8zer0/setup
Browse files Browse the repository at this point in the history
Initial setup and defintions
  • Loading branch information
shgysk8zer0 authored Sep 25, 2023
2 parents d36e548 + afcb7c0 commit 43210d1
Show file tree
Hide file tree
Showing 14 changed files with 1,151 additions and 585 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.cjs
*.min.*
*.map
.env
# Logs
logs
*.log
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ importmap.yaml
*.log
*.min.*
*.map
.env
45 changes: 1 addition & 44 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### [v1.1.0] - 2023-07-03

### Changed
- Update to node 20
- Update npm publishing GH Action

## [v1.0.5] - 2023-07-02

### Added
- Add `funding`

### Changed
- Updated GitHub Actions workflows
- Update versioning & lock-file scripts
- Update `.npmignore` & `.gitignore`

## [v1.0.4] - 2023-06-08

### Added
- Install `@shgysk8zer0/npm-utils`
- Add `exports` to package config

### Removed
- Uninstall `rollup`, `eslint`

### Changed
- Use `getConfig()` from `@shgysk8zer0/js-utils/rollup` for rollup config

## [v1.0.3] - 2023-06-01

### Fixed
- Revert to old Release Action, now with permissions & link to changelog

## [v1.0.2] - 2023-06-01

### Fixed
- Fix `changelog-entry` to match `[$version]` instead of `$version`

## [v1.0.1] - 2023-05-31

### Fixed
- Update GitHub Release workflow to use [Auto Release](https://github.com/marketplace/actions/auto-release)

## [v1.0.0] - 2023-05-31
## [v1.0.0] - 2023-09-24

Initial Release
66 changes: 64 additions & 2 deletions README.md
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/*`.
70 changes: 70 additions & 0 deletions date.js
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',
}];
82 changes: 82 additions & 0 deletions exts.js
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'];
1 change: 0 additions & 1 deletion index.js

This file was deleted.

7 changes: 7 additions & 0 deletions namespaces.js
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';
Loading

0 comments on commit 43210d1

Please sign in to comment.