Skip to content
This repository was archived by the owner on Sep 25, 2023. It is now read-only.

Commit 35a683f

Browse files
committed
fix: fixed krabs version in example
1 parent 60acced commit 35a683f

File tree

7 files changed

+17
-40
lines changed

7 files changed

+17
-40
lines changed

examples/advanced/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const express = require('express');
22
const next = require('next');
3-
const krabs = require('../../dist/index').default;
3+
const krabs = require('krabs').default;
44
const dev = process.env.NODE_ENV !== 'production';
55
const app = next({ dev });
66

examples/advanced/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@emotion/styled": "^11.0.0",
1414
"classnames": "^2.2.6",
1515
"framer-motion": "^3.1.1",
16-
"krabs": "^0.0.12",
16+
"krabs": "^0.0.14",
1717
"next": "9.5.5",
1818
"react": "17.0.1",
1919
"react-dom": "17.0.1"

examples/advanced/pages/veggies/index.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
const getImage = (tenant) => {
22
switch (tenant) {
33
case 'local.cabbage.eat.com':
4-
case 'cabbage.krabs.eat.micheleriva.com':
54
return 'https://images.unsplash.com/photo-1592587828054-10f56e3350db?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1267&q=80';
65
case 'local.pumpkin.eat.com':
7-
case 'pumpkin.krabs.eat.micheleriva.com':
86
return 'https://images.unsplash.com/photo-1506917728037-b6af01a7d403?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1267&q=80';
97
default:
108
return 'https://images.unsplash.com/photo-1567306295427-94503f8300d7?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1326&q=80';
119
}
1210
};
1311

14-
function Index(props) {
15-
const image = getImage(props.tenant);
12+
export function getServerSideProps(ctx) {
13+
return {
14+
props: {
15+
hostname: ctx.req.hostname,
16+
},
17+
};
18+
}
1619

20+
function Index(props) {
21+
const image = getImage(props.hostname);
1722
return (
1823
<div>
1924
<div>

examples/advanced/yarn.lock

+4-10
Original file line numberDiff line numberDiff line change
@@ -3655,11 +3655,6 @@ fast-json-stable-stringify@^2.0.0:
36553655
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
36563656
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
36573657

3658-
fast-memoize@^2.5.2:
3659-
version "2.5.2"
3660-
resolved "https://registry.yarnpkg.com/fast-memoize/-/fast-memoize-2.5.2.tgz#79e3bb6a4ec867ea40ba0e7146816f6cdce9b57e"
3661-
integrity sha512-Ue0LwpDYErFbmNnZSF0UH6eImUwDmogUO1jyE+JbN2gsQz/jICm1Ve7t9QT0rNSsfJt+Hs4/S3GnsDVjL4HVrw==
3662-
36633658
figgy-pudding@^3.5.1:
36643659
version "3.5.2"
36653660
resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e"
@@ -4429,14 +4424,13 @@ klona@^2.0.3:
44294424
resolved "https://registry.yarnpkg.com/klona/-/klona-2.0.4.tgz#7bb1e3affb0cb8624547ef7e8f6708ea2e39dfc0"
44304425
integrity sha512-ZRbnvdg/NxqzC7L9Uyqzf4psi1OM4Cuc+sJAkQPjO6XkQIJTNbfK2Rsmbw8fx1p2mkZdp2FZYo2+LwXYY/uwIA==
44314426

4432-
krabs@^0.0.12:
4433-
version "0.0.12"
4434-
resolved "https://registry.yarnpkg.com/krabs/-/krabs-0.0.12.tgz#0212d36d776dfe1ba32aed4c6ebba000941bd46c"
4435-
integrity sha512-pNPGmOI59bkKRwtVrh/b8FPMl3OR8mWmGyU+/yuWDumt4x4fDbS4TJnnb+DCrW/cfSzw++1VrRq4xpp6DLuLrQ==
4427+
krabs@^0.0.14:
4428+
version "0.0.14"
4429+
resolved "https://registry.yarnpkg.com/krabs/-/krabs-0.0.14.tgz#af110601f017dbdaf1613ed57eb1fcd313942782"
4430+
integrity sha512-Syg2jlRa1lcDh+y5hcL3nGwgdekkUpUvbUgmAfBQ2OFjHhGr5310n7WYTXaAn2RUUdjPpovBwkMHOiqI/f/DAQ==
44364431
dependencies:
44374432
chalk "^4.1.1"
44384433
express "^4.17.1"
4439-
fast-memoize "^2.5.2"
44404434
krabs "^0.0.8"
44414435
next "^10.0.4"
44424436

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"chalk": "^4.1.1",
2424
"express": "^4.17.1",
2525
"krabs": "^0.0.8",
26-
"moize": "^6.0.3",
2726
"next": "^10.0.4"
2827
},
2928
"devDependencies": {

src/index.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Request, Response } from 'express';
22
import * as chalk from 'chalk';
33
import { parse } from 'url';
44
import * as path from 'path';
5-
import moize from 'moize';
65
import { getTenantConfig } from './config';
76
import { Config } from './config/config.d';
87
import findTenant from './tenants/findTenant';
@@ -30,13 +29,11 @@ async function krabs(
3029
app: any,
3130
config?: Config,
3231
): Promise<void> {
33-
const { tenants } = await (
34-
await moize.promise(async () => config ?? (await getTenantConfig()))
35-
)();
32+
const { tenants } = config ?? (await getTenantConfig());
3633
const { hostname } = req;
3734
const parsedUrl = parse(req.url, true);
3835
const { pathname = '/', query } = parsedUrl;
39-
const tenant = (await moize(() => findTenant(tenants, hostname)))();
36+
const tenant = findTenant(tenants, hostname);
4037

4138
if (!tenant) {
4239
res.status(500);

yarn.lock

-18
Original file line numberDiff line numberDiff line change
@@ -3850,11 +3850,6 @@ fast-diff@^1.1.2:
38503850
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
38513851
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
38523852

3853-
fast-equals@^2.0.1:
3854-
version "2.0.3"
3855-
resolved "https://registry.yarnpkg.com/fast-equals/-/fast-equals-2.0.3.tgz#7039b0a039909f345a2ce53f6202a14e5f392efc"
3856-
integrity sha512-0EMw4TTUxsMDpDkCg0rXor2gsg+npVrMIHbEhvD0HZyIhUX6AktC/yasm+qKwfyswd06Qy95ZKk8p2crTo0iPA==
3857-
38583853
fast-glob@^3.1.1:
38593854
version "3.2.4"
38603855
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.4.tgz#d20aefbf99579383e7f3cc66529158c9b98554d3"
@@ -5662,11 +5657,6 @@ methods@^1.1.2, methods@~1.1.2:
56625657
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
56635658
integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=
56645659

5665-
micro-memoize@^4.0.9:
5666-
version "4.0.9"
5667-
resolved "https://registry.yarnpkg.com/micro-memoize/-/micro-memoize-4.0.9.tgz#b44a38c9dffbee1cefc2fd139bc8947952268b62"
5668-
integrity sha512-Z2uZi/IUMGQDCXASdujXRqrXXEwSY0XffUrAOllhqzQI3wpUyZbiZTiE2JuYC0HSG2G7DbCS5jZmsEKEGZuemg==
5669-
56705660
micromatch@^3.1.10, micromatch@^3.1.4:
56715661
version "3.1.10"
56725662
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23"
@@ -5802,14 +5792,6 @@ mock-fs@^4.13.0:
58025792
resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.13.0.tgz#31c02263673ec3789f90eb7b6963676aa407a598"
58035793
integrity sha512-DD0vOdofJdoaRNtnWcrXe6RQbpHkPPmtqGq14uRX0F8ZKJ5nv89CVTYl/BZdppDxBDaV0hl75htg3abpEWlPZA==
58045794

5805-
moize@^6.0.3:
5806-
version "6.0.3"
5807-
resolved "https://registry.yarnpkg.com/moize/-/moize-6.0.3.tgz#20881786b68678bc75215ac15ac48a010592b221"
5808-
integrity sha512-7Jz9TSiqW9G2u8HwUWnaBQMFMPLblrWKEiWN4BA/GPOfQlsnfQqq0yRnTGHckGPlKApA9Eu1HPb/eTqvK9EtKg==
5809-
dependencies:
5810-
fast-equals "^2.0.1"
5811-
micro-memoize "^4.0.9"
5812-
58135795
move-concurrently@^1.0.1:
58145796
version "1.0.1"
58155797
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"

0 commit comments

Comments
 (0)