Skip to content
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

chore: ci updates and style change #91

Merged
merged 6 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
49 changes: 35 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
name: CI workflow
on: [push, pull_request]
name: CI

on:
push:
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm install --ignore-scripts
- name: Test
run: npm test
- uses: actions/checkout@v2

- name: Use Node.js
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: |
npm install --ignore-scripts

- name: Lint
run: |
npm run lint

- name: Run Tests
run: |
npm run test

automerge:
needs: test
runs-on: ubuntu-latest
steps:
- uses: fastify/[email protected]
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
with:
github-token: ${{secrets.github_token}}
github-token: ${{ secrets.GITHUB_TOKEN }}
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# fastify-env
![CI workflow](https://github.com/fastify/fastify-env/workflows/CI%20workflow/badge.svg)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

![CI](https://github.com/fastify/fastify-env/workflows/CI/badge.svg)
[![NPM version](https://img.shields.io/npm/v/fastify-env.svg?style=flat)](https://www.npmjs.com/package/fastify-env)
[![Known Vulnerabilities](https://snyk.io/test/github/fastify/fastify-env/badge.svg)](https://snyk.io/test/github/fastify/fastify-env)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)

Fastify plugin to check environment variables

Expand Down Expand Up @@ -43,7 +46,8 @@ fastify
})
```

This module is a wrapper around [env-schema](https://www.npmjs.com/package/env-schema) so, to read `.env` file you must set the `dotenv` in options:
This module is a wrapper around [env-schema](https://www.npmjs.com/package/env-schema).
To read an `.env` file you must set `dotenv` in the options:

```js
const options = {
Expand All @@ -60,10 +64,10 @@ const options = {

```

**NB:** internally this plugin force to not have additional properties, so the `additionalProperties` flag is forced to be `false`
**NB:** support for additional properties in the schema is disabled for this plugin, with the `additionalProperties` flag set to `false` internally.

### Typescript
In order to have typing for the fastify instance, you should follow the example below.
In order to have typing for the fastify instance, you should follow the example below:

```typescript
declare module 'fastify' {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"description": "Fastify plugin to check environment variables",
"main": "index.js",
"scripts": {
"coverage": "cross-env VALUE_FROM_ENV=pippo tap --cov --coverage-report=html test/*.js",
"lint": "standard | snazzy",
"lint:fix": "standard --fix",
"unit": "cross-env VALUE_FROM_ENV=pippo tap test/*.js",
"test": "npm run lint && npm run unit && npm run typescript",
"coverage": "cross-env VALUE_FROM_ENV=pippo tap --cov --coverage-report=html test/*.js",
"typescript": "tsd"
"typescript": "tsd",
"unit": "cross-env VALUE_FROM_ENV=pippo tap test/*.js"
},
"repository": {
"type": "git",
Expand Down