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

Fix apps which don't define build() #2202

Merged
merged 1 commit into from
Jan 8, 2020
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
5 changes: 5 additions & 0 deletions .changeset/dull-taxis-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystonejs/keystone': patch
---

Apps which don't define `build()` no longer cause keystone to fail.
25 changes: 25 additions & 0 deletions docs/guides/apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,28 @@ Other interesting KeystoneJS compatible Apps are:

- [Static App](/packages/app-static/README.md) for serving static files.
- [Next.js App](/packages/app-next/README.md) for serving a Next.js App on the same server as the API

## Custom Apps

If you need to provide your own custom middleware for your system you can create a custom **App** and include it in your exported `apps`.

```
class CustomApp {
prepareMiddleware({ keystone, dev, distDir }) {
const middleware = express();
// ...
return middleware;
}
}

// ...

module.exports = {
keystone,
apps: [
new GraphQLApp(),
new AdminUIApp(),
new CustomApp(),
]
}
```
3 changes: 2 additions & 1 deletion docs/guides/new-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,17 @@ In order to be able to start an app we need to add at least one List. A List is
## Adding first List

To type the fields of the list, a package has to be installed:

```
yarn add @keystonejs/fields
```

In this example the type `Text` is used, require this in index.js:

```javascript
const { Text } = require('@keystonejs/fields');
```


In `index.js` add the following above `module.exports` and below `const keystone = new Keystone({...`:

```
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/production.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Add [query limits](/docs/api/create-list.md#querylimits) and [validation](/docs/

## Using Reverse Proxies

It's recommended to run production Javascript servers behind a reverse proxy such as [Nginx](https://nginx.org/), [HAProxy](https://www.haproxy.org/), a CDN or a cloud-based application (layer 7) load balancer. Doing that can improve performance and protect against [Slowloris Dos attacks](<https://en.wikipedia.org/wiki/Slowloris_(computer_security)>).
It's recommended to run production Javascript servers behind a reverse proxy such as [Nginx](https://nginx.org/), [HAProxy](https://www.haproxy.org/), a CDN or a cloud-based application (layer 7) load balancer. Doing that can improve performance and protect against [Slowloris Dos attacks](https://en.wikipedia.org/wiki/Slowloris_(computer_security)).

## Environment Variables

Expand Down
7 changes: 1 addition & 6 deletions packages/keystone/bin/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ module.exports = {

if (apps) {
await Promise.all(
apps.map(app => {
return app.build({
distDir: resolvedDistDir,
keystone,
});
})
apps.filter(app => app.build).map(app => app.build({ distDir: resolvedDistDir, keystone }))
);

spinner.succeed(
Expand Down
8 changes: 7 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5477,7 +5477,7 @@ chalk@^3.0.0:
ansi-styles "^4.1.0"
supports-color "^7.1.0"

change-case@^3.0.2:
change-case@^3.0.2, change-case@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/change-case/-/change-case-3.1.0.tgz#0e611b7edc9952df2e8513b27b42de72647dd17e"
integrity sha512-2AZp7uJZbYEzRPsFoa+ijKdvp9zsrnnt6+yFokfwEpeJm0xuJDVoxiRCAaTzyJND8GJkofo2IcKWaUZ/OECVzw==
Expand Down Expand Up @@ -10186,6 +10186,12 @@ global-prefix@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-1.0.2.tgz#dbf743c6c14992593c655568cb66ed32c0122ebe"
integrity sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=
dependencies:
expand-tilde "^2.0.2"
homedir-polyfill "^1.0.1"
ini "^1.3.4"
is-windows "^1.0.1"
which "^1.2.14"

global@^4.3.0, global@~4.3.0:
version "4.3.2"
Expand Down