Skip to content

Commit

Permalink
feat: Rename asd14 -> mutantlove
Browse files Browse the repository at this point in the history
  • Loading branch information
andreidmt committed Oct 7, 2019
1 parent 3abb173 commit 3cd96e2
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ job_filter: &job_filter
#
workflows:
version: 2
build_test_coverage_publish:
deploy_npm:
jobs:
- setup:
<<: *job_filter
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"parser": "babel-eslint",
"root": true,
"extends": [
"@asd14/eslint-config/targets/node"
"@mutantlove/eslint-config/targets/node"
],
"settings": {
"import/resolver": "node",
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Releases and changelog are automaticly handled by [semantic-release](https://git

All releases are based on Angular's [Git commit message](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines) patterns.

See the [releases section](https://github.com/asd14/blocks/releases) for details.
See the [releases section](https://github.com/mutantlove/blocks/releases) for details.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2018, asd14
Copyright (c) 2018, Mutant
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- markdownlint-disable first-line-h1 line-length -->

[![CircleCI](https://circleci.com/gh/asd14/blocks.svg?style=svg)](https://circleci.com/gh/asd14/blocks)
[![npm package version](https://badge.fury.io/js/%40asd14%2Fblocks.svg)](https://badge.fury.io/js/%40asd14%2Fblocks)
[![Coverage Status](https://coveralls.io/repos/github/asd14/blocks/badge.svg)](https://coveralls.io/github/asd14/blocks)
[![CircleCI](https://circleci.com/gh/mutantlove/blocks.svg?style=svg)](https://circleci.com/gh/mutantlove/blocks)
[![npm package version](https://badge.fury.io/js/%40mutantlove%2Fblocks.svg)](https://badge.fury.io/js/%40mutantlove%2Fblocks)
[![Coverage Status](https://coveralls.io/repos/github/mutantlove/blocks/badge.svg)](https://coveralls.io/github/mutantlove/blocks)

# blocks

Expand Down Expand Up @@ -67,7 +67,7 @@ If it returns false, an automatic `403 Forbidden` response will be sent.
## Install

```bash
npm i @asd14/blocks
npm install @mutantlove/blocks
```

## Example
Expand All @@ -79,7 +79,7 @@ import http from "http"
import glob from "glob"
import dotenv from "dotenv"

import { block } from "@asd14/blocks"
import { block } from "@mutantlove/blocks"

// load config into process.env
dotenv.config()
Expand Down Expand Up @@ -246,7 +246,7 @@ module.exports = {

## Plugins

Separate code interfacing with 3rd party libraries or services. [pluginus](https://github.com/asd14/pluginus) dependency injection library is used.
Separate code interfacing with 3rd party libraries or services. [pluginus](https://github.com/mutantlove/pluginus) dependency injection library is used.

Plugins are accesible in other plugins, middleware and routes.

Expand Down Expand Up @@ -302,7 +302,7 @@ module.exports = {
## Develop

```bash
git clone [email protected]:asd14/blocks.git && \
git clone [email protected]:mutantlove/blocks.git && \
cd blocks && \
npm run setup
```
Expand Down Expand Up @@ -343,4 +343,4 @@ BREAKING CHANGE: Half of features not working anymore

## Changelog

See the [releases section](https://github.com/asd14/blocks/releases) for details.
See the [releases section](https://github.com/mutantlove/blocks/releases) for details.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const debug = require("debug")("Blocks:Main")

import connect from "connect"
import path from "path"
import { pluginus } from "@asd14/pluginus"
import { is, forEach, reduce } from "@asd14/m"
import { pluginus } from "@mutantlove/pluginus"
import { is, forEach, reduce } from "@mutantlove/m"

import { BaseError } from "./errors/base"
import { NotFoundError } from "./errors/not-found"
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/req-body.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const debug = require("debug")("Blocks:BodyMiddleware")

import { isEmpty } from "@asd14/m"
import { isEmpty } from "@mutantlove/m"
import { InputValidationError } from "../errors/input"

const parseBody = req => {
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/req-bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const debug = require("debug")("Blocks:BootstrapMiddleware")

import cuid from "cuid"
import { pick } from "@asd14/m"
import { pick } from "@mutantlove/m"

module.exports = () => (req, res, next) => {
req.ctx = {
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/req-cors.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const debug = require("debug")("Blocks:CORSMiddleware")

import cors from "cors"
import { isEmpty } from "@asd14/m"
import { isEmpty } from "@mutantlove/m"

module.exports = ({ Config: { CORS_ORIGIN, CORS_METHODS } }) =>
isEmpty(CORS_ORIGIN)
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/req-jwt.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const debug = require("debug")("blocks:JWTDecodeMiddleware")

import jwt from "jsonwebtoken"
import { replace, is, isEmpty } from "@asd14/m"
import { replace, is, isEmpty } from "@mutantlove/m"

import { InputValidationError } from "../errors/input"

Expand Down
2 changes: 1 addition & 1 deletion src/middleware/res-goodbye.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const debug = require("debug")("Blocks:GoodbyeMiddleware")

import { forEach } from "@asd14/m"
import { forEach } from "@mutantlove/m"

module.exports = () => (req, res) => {
debug(`${req.method}:${req.url} responding with ${res.ctx.status}`)
Expand Down
57 changes: 34 additions & 23 deletions src/plugins/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const debug = require("debug")("Blocks:ConfigPlugin")

import { is, isEmpty } from "@asd14/m"
import { when, i, same, is, isEmpty } from "@mutantlove/m"

export default {
create: () => () => {
Expand Down Expand Up @@ -36,7 +36,7 @@ export default {

return {
STARTUP_TIME: new Date(),
NAME: NAME ?? "blocks",
NAME: when(is, i, same("blocks"))(NAME),
PORT: is(PORT) ? Number(PORT) : 8000,

// JWT support
Expand All @@ -52,33 +52,44 @@ export default {

// Query string parsing
// github.com/ljharb/qs
QS_DELIMITER: QS_DELIMITER ?? "&",
QS_ALLOW_DOTS: toBool(QS_ALLOW_DOTS) ?? true,
QS_STRICT_NULL_HANDLING: toBool(QS_STRICT_NULL_HANDLING) ?? true,
QS_ARRAY_FORMAT: QS_ARRAY_FORMAT ?? "brackets",
QS_DELIMITER: when(isEmpty, same("&"))(QS_DELIMITER),
QS_ALLOW_DOTS: when(isEmpty, same(true))(toBool(QS_ALLOW_DOTS)),
QS_STRICT_NULL_HANDLING: when(isEmpty, same(true))(
toBool(QS_STRICT_NULL_HANDLING)
),
QS_ARRAY_FORMAT: when(isEmpty, same("brackets"))(QS_ARRAY_FORMAT),

// Help secure Express apps with various HTTP headers
// github.com/helmetjs/helmet
HELMET_CONTENT_SECURITY_POLICY:
toBool(HELMET_CONTENT_SECURITY_POLICY) ?? false,
HELMET_DNS_PREFETCH_CONTROL: toBool(HELMET_DNS_PREFETCH_CONTROL) ?? true,
HELMET_EXPECT_CT: toBool(HELMET_EXPECT_CT) ?? false,
HELMET_FEATURE_POLICY: toBool(HELMET_FEATURE_POLICY) ?? false,
HELMET_FRAMEGUARD: toBool(HELMET_FRAMEGUARD) ?? true,
HELMET_HIDE_POWER_BY: toBool(HELMET_HIDE_POWER_BY) ?? false,
HELMET_HSTS: toBool(HELMET_HSTS) ?? true,
HELMET_IE_NO_OPEN: toBool(HELMET_IE_NO_OPEN) ?? true,
HELMET_NO_CACHE: toBool(HELMET_NO_CACHE) ?? true,
HELMET_NO_SNIFF: toBool(HELMET_NO_SNIFF) ?? true,
HELMET_CROSSDOMAIN: toBool(HELMET_CROSSDOMAIN) ?? true,
HELMET_REFERER_POLICY: toBool(HELMET_REFERER_POLICY) ?? false,
HELMET_XSS_FILTER: toBool(HELMET_XSS_FILTER) ?? true,
HELMET_CONTENT_SECURITY_POLICY: when(isEmpty, same(false))(
toBool(HELMET_CONTENT_SECURITY_POLICY)
),
HELMET_DNS_PREFETCH_CONTROL: when(isEmpty, same(true))(
toBool(HELMET_DNS_PREFETCH_CONTROL)
),
HELMET_EXPECT_CT: when(isEmpty, same(false))(toBool(HELMET_EXPECT_CT)),
HELMET_FEATURE_POLICY: when(isEmpty, same(false))(
toBool(HELMET_FEATURE_POLICY)
),
HELMET_FRAMEGUARD: when(isEmpty, same(true))(toBool(HELMET_FRAMEGUARD)),
HELMET_HIDE_POWER_BY: when(isEmpty, same(false))(
toBool(HELMET_HIDE_POWER_BY)
),
HELMET_HSTS: when(isEmpty, same(true))(toBool(HELMET_HSTS)),
HELMET_IE_NO_OPEN: when(isEmpty, same(true))(toBool(HELMET_IE_NO_OPEN)),
HELMET_NO_CACHE: when(isEmpty, same(true))(toBool(HELMET_NO_CACHE)),
HELMET_NO_SNIFF: when(isEmpty, same(true))(toBool(HELMET_NO_SNIFF)),
HELMET_CROSSDOMAIN: when(isEmpty, same(true))(toBool(HELMET_CROSSDOMAIN)),
HELMET_REFERER_POLICY: when(isEmpty, same(false))(
toBool(HELMET_REFERER_POLICY)
),
HELMET_XSS_FILTER: when(isEmpty, same(true))(toBool(HELMET_XSS_FILTER)),

// Request data validation with ajv
// github.com/epoberezkin/ajv
AJV_ALL_ERRORS: toBool(AJV_ALL_ERRORS) ?? true,
AJV_COERCE_TYPES: toBool(AJV_COERCE_TYPES) ?? true,
AJV_USE_DEFAULTS: toBool(AJV_USE_DEFAULTS) ?? true,
AJV_ALL_ERRORS: when(isEmpty, same(true))(toBool(AJV_ALL_ERRORS)),
AJV_COERCE_TYPES: when(isEmpty, same(true))(toBool(AJV_COERCE_TYPES)),
AJV_USE_DEFAULTS: when(isEmpty, same(true))(toBool(AJV_USE_DEFAULTS)),
}
},
}
2 changes: 1 addition & 1 deletion src/plugins/router.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const debug = require("debug")("Blocks:RouterPlugin")

import pathToRegexp from "path-to-regexp"
import { count, push, reduce, find, merge, pick } from "@asd14/m"
import { count, push, reduce, find, merge, pick } from "@mutantlove/m"

import { InputValidationError } from "../errors/input"
import { AuthorizationError } from "../errors/authorization"
Expand Down
2 changes: 1 addition & 1 deletion src/routes/ping.route.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const debug = require("debug")("Blocks:PingRoute")

import { elapsedTime, is } from "@asd14/m"
import { elapsedTime, is } from "@mutantlove/m"

module.exports = {
method: "GET",
Expand Down

0 comments on commit 3cd96e2

Please sign in to comment.