Skip to content

feat!: implement with unjs template #9

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

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 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
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.js]
indent_style = space
indent_size = 2

[{package.json,*.yml,*.cjson}]
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["eslint-config-unjs"],
"rules": {}
}
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: ci

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- run: pnpm install
- run: pnpm lint
- run: pnpm build
- run: pnpm vitest --coverage
- uses: codecov/codecov-action@v3
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.vscode
node_modules
*.log*
coverage
dist
types
.vscode
.DS_Store
.eslintcache
*.log*
*.conf*
*.env*
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
49 changes: 0 additions & 49 deletions CHANGELOG.md

This file was deleted.

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) 2017 Pooya Parsa
Copyright (c)

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
55 changes: 42 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
# is-https
> Check if the given request is HTTPS

[![npm](https://img.shields.io/npm/dt/is-https.svg?style=flat-square)](https://npmjs.com/package/is-https)
[![npm (scoped with tag)](https://img.shields.io/npm/v/is-https/latest.svg?style=flat-square)](https://npmjs.com/package/is-https)
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions][github-actions-src]][github-actions-href]
[![Codecov][codecov-src]][codecov-href]

> Check if the given request is HTTPS

## Usage

Install package:

```bash
yarn add is-https
# or
```sh
# npm
npm install is-https

# yarn
yarn add is-https

# pnpm
pnpm install is-https
```

Import:

```js
const isHTTPS = require('is-https')
// or
import isHTTPS from 'is-https'
```
// ESM
import { isHTTPS } from "unjs/is-https"

```ts
function isHTTPS(req: IncomingMessage, trustProxy: Boolean = true): Boolean | undefined
// CommonJS
const { isHTTPS } = require("unjs/is-https")
```

## Behaviour
Expand All @@ -40,6 +48,27 @@ Returns either `true` or `false` based on checks or `undefined` if no check was

- [redirect-ssl](https://www.npmjs.com/package/redirect-ssl) - Connect middleware to enforce HTTPS

## Development

- Clone this repository
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm dev`

## License

MIT
Made with 💛

Published under [MIT License](./LICENSE).

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/is-https?style=flat-square
[npm-version-href]: https://npmjs.com/package/is-https
[npm-downloads-src]: https://img.shields.io/npm/dm/is-https?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/is-https
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/is-https/ci/main?style=flat-square
[github-actions-href]: https://github.com/unjs/is-https/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/is-https/main?style=flat-square
[codecov-href]: https://codecov.io/gh/unjs/is-https
36 changes: 27 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,46 @@
"name": "is-https",
"version": "4.0.0",
"description": "Check if the given request is HTTPS",
"author": "Pooya Parsa <[email protected]>",
"contributors": [
"Nozomu Ikuta <[email protected]>"
],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, only if you are fine.

"repository": "unjs/is-https",
"license": "MIT",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs"
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.js",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "siroc build",
"release": "yarn build && standard-version && npm publish && git push --follow-tags"
"build": "unbuild",
"dev": "vitest dev",
"lint": "eslint --cache --ext .ts,.js,.mjs,.cjs . && prettier -c src test",
"lint:fix": "eslint --cache --ext .ts,.js,.mjs,.cjs . --fix && prettier -c src test -w",
"prepack": "pnpm run build",
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
"test": "pnpm lint && vitest run --coverage"
},
"devDependencies": {
"@types/node": "latest",
"siroc": "latest",
"standard-version": "latest"
}
"@types/node": "^18.11.18",
"@vitest/coverage-c8": "^0.27.2",
"changelogen": "^0.4.1",
"eslint": "^8.23.0",
"eslint-config-unjs": "^0.1.0",
"prettier": "^2.8.3",
"typescript": "^4.8.2",
"unbuild": "^1.1.1",
"vitest": "^0.27.2"
},
"packageManager": "[email protected]"
}
Loading