Skip to content

Commit

Permalink
Merge pull request #185 from podium-lib/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
digitalsadhu authored Nov 29, 2023
2 parents df2b93f + 76b12cc commit 72a242d
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 35 deletions.
34 changes: 18 additions & 16 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{
"env": {
"node": true,
"jest": true
},
"extends": ["airbnb-base", "prettier"],
"parserOptions": {
"ecmaVersion": 2018
},
"plugins": ["prettier"],
"root": true,
"rules": {
"class-methods-use-this": [0],
"indent": [1, 4],
"prettier/prettier": ["error"],
"strict": [0, "global"]
}
"extends": ["airbnb-base", "prettier"],
"plugins": ["prettier"],
"parser": "@babel/eslint-parser",
"parserOptions": {
"requireConfigFile": false,
"ecmaVersion": 2020,
"sourceType": "module"
},
"rules": {
"default-param-last": [0],
"import/prefer-default-export": "off",
"class-methods-use-this": [0],
"lines-between-class-members": [0],
"import/extensions": ["error", {
"js": "ignorePackages"
}
]
}
}
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# [3.0.0-next.4](https://github.com/podium-lib/fastify-layout/compare/v3.0.0-next.3...v3.0.0-next.4) (2023-11-27)


### Bug Fixes

* bumping version to get version range removal into a version ([#231](https://github.com/podium-lib/fastify-layout/issues/231)) ([9c909f9](https://github.com/podium-lib/fastify-layout/commit/9c909f9e220a3b62fcfcb1f3e9ed1909451da37f))
* **deps:** update dependency @podium/utils to v4.4.37 ([3e91676](https://github.com/podium-lib/fastify-layout/commit/3e91676bf0a21fd966c91448f96e8c50e7ef15bc))
* **deps:** update dependency @podium/utils to v4.4.38 ([96c1279](https://github.com/podium-lib/fastify-layout/commit/96c1279811b53df0bb97ebdfb1d1c1e16e1cc8bd))
* **deps:** update dependency @podium/utils to v4.4.39 ([792f015](https://github.com/podium-lib/fastify-layout/commit/792f015948f4bb193d0c4a1bc6c2fbb644a2aedf))
* **deps:** update dependency @podium/utils to v4.4.40 ([603fbe9](https://github.com/podium-lib/fastify-layout/commit/603fbe95ce139bd66120adc59f316331f64130ba))
* **deps:** update dependency @podium/utils to v4.4.41 ([1cc35fd](https://github.com/podium-lib/fastify-layout/commit/1cc35fdfd4e2b1be76300680b5be282e4982f727))
* **deps:** update dependency @podium/utils to v4.5.1 ([62fb59e](https://github.com/podium-lib/fastify-layout/commit/62fb59efc24e2a5f622b0769aec3583ba4c77926))
* **deps:** update dependency fastify-plugin to v4 ([e5f1ed5](https://github.com/podium-lib/fastify-layout/commit/e5f1ed5944dc2473681d41cabc0a9a53a4b6e50f))
* use LTS aliases to not chase node version anymore ([e0387ff](https://github.com/podium-lib/fastify-layout/commit/e0387ff187de8b6142e13c0bc00a289416ce14bb))

## [2.2.48](https://github.com/podium-lib/fastify-layout/compare/v2.2.47...v2.2.48) (2023-11-27)


Expand Down Expand Up @@ -55,6 +70,37 @@

* **deps:** update dependency @podium/utils to v4.4.37 ([3e91676](https://github.com/podium-lib/fastify-layout/commit/3e91676bf0a21fd966c91448f96e8c50e7ef15bc))

# [3.0.0-next.3](https://github.com/podium-lib/fastify-layout/compare/v3.0.0-next.2...v3.0.0-next.3) (2022-10-03)


### Features

* Support Fastify 4 and Podium 5 ([0897496](https://github.com/podium-lib/fastify-layout/commit/08974967288b82537bb3378724264c34b630380b))

# [3.0.0-next.2](https://github.com/podium-lib/fastify-layout/compare/v3.0.0-next.1...v3.0.0-next.2) (2022-05-19)


### Features

* Convert to ESM. ([7f78857](https://github.com/podium-lib/fastify-layout/commit/7f78857e359700a050abe9048c5092864b1e3cfd))


### BREAKING CHANGES

* Module is ESM only.

# [3.0.0-next.1](https://github.com/podium-lib/fastify-layout/compare/v2.2.40...v3.0.0-next.1) (2022-05-11)


### chore

* Test on Node.js 16 and 18 only ([d5a7ba9](https://github.com/podium-lib/fastify-layout/commit/d5a7ba93d9a51e4e0cbfc3c851a54f7c84004fd2))


### BREAKING CHANGES

* Test on Node.js 16 and 18 only.

## [2.2.40](https://github.com/podium-lib/fastify-layout/compare/v2.2.39...v2.2.40) (2022-03-28)


Expand Down
12 changes: 5 additions & 7 deletions lib/layout-plugin.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/* eslint-disable no-param-reassign */
/* eslint-disable consistent-return */

'use strict';

const utils = require('@podium/utils');
const fp = require('fastify-plugin');
import { HttpIncoming, pathnameBuilder } from '@podium/utils';
import fp from 'fastify-plugin';

const podiumLayoutFastifyPlugin = (fastify, layout, done) => {
// Decorate reply with .app.podium we can write to throught the request
Expand All @@ -17,7 +15,7 @@ const podiumLayoutFastifyPlugin = (fastify, layout, done) => {

// Run parsers on request and store state object on reply.app.podium
fastify.addHook('preHandler', async (request, reply) => {
const incoming = new utils.HttpIncoming(
const incoming = new HttpIncoming(
request.raw,
reply.raw,
reply.app.params,
Expand All @@ -35,7 +33,7 @@ const podiumLayoutFastifyPlugin = (fastify, layout, done) => {
// the registered path. Iow: the proxy check is not run on
// any other routes
fastify.register((instance, opts, next) => {
const pathname = utils.pathnameBuilder(
const pathname = pathnameBuilder(
layout.httpProxy.pathname,
layout.httpProxy.prefix,
'/*',
Expand Down Expand Up @@ -63,6 +61,6 @@ const podiumLayoutFastifyPlugin = (fastify, layout, done) => {
done();
};

module.exports = fp(podiumLayoutFastifyPlugin, {
export default fp(podiumLayoutFastifyPlugin, {
name: 'podium-layout',
});
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@podium/fastify-layout",
"version": "2.2.48",
"version": "3.0.0-next.4",
"type": "module",
"description": "Fastify plugin for Podium Layout.",
"main": "lib/layout-plugin.js",
"license": "MIT",
Expand Down Expand Up @@ -34,14 +35,16 @@
},
"author": "Trygve Lie",
"dependencies": {
"@podium/utils": "4.5.1",
"fastify-plugin": "^4.0.0"
"@podium/utils": "5.0.0",
"fastify-plugin": "4.2.0"
},
"devDependencies": {
"@podium/layout": "4.6.125",
"@podium/test-utils": "2.5.2",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"fastify-formbody": "5.3.0",
"@babel/eslint-parser": "7.19.1",
"eslint": "8.54.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-prettier": "9.0.0",
Expand Down
File renamed without changes.
15 changes: 6 additions & 9 deletions test/layout-plugin.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
'use strict';

const { PodletServer, request } = require('@podium/test-utils');
const fastify = require('fastify');
const Layout = require('@podium/layout');
const tap = require('tap');

const FastifyLayout = require('..');
import { PodletServer, request } from '@podium/test-utils';
import fastify from 'fastify';
import Layout from '@podium/layout';
import tap from 'tap';
import FastifyLayout from '../lib/layout-plugin.js';

class Server {
constructor(podletAddr, options = {}) {
Expand All @@ -32,7 +29,7 @@ class Server {
listen() {
return new Promise((resolve, reject) => {
this.app
.listen({ port: 0, host: '127.0.0.1' })
.listen({port: 0, host: '127.0.0.1'})
.then(() => {
const address = this.app.server.address();
const url = `http://${address.address}:${address.port}`;
Expand Down

0 comments on commit 72a242d

Please sign in to comment.