diff --git a/packages/app-static/.npmignore b/packages/app-static/.npmignore deleted file mode 100644 index 851b108d115..00000000000 --- a/packages/app-static/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -**/*.md -**/*.test.js diff --git a/packages/app-static/CHANGELOG.md b/packages/app-static/CHANGELOG.md deleted file mode 100644 index 22e9680fd34..00000000000 --- a/packages/app-static/CHANGELOG.md +++ /dev/null @@ -1,124 +0,0 @@ -# @keystonejs/app-static - -## 5.1.5 - -### Patch Changes - -- [#5150](https://github.com/keystonejs/keystone/pull/5150) [`3a9d20ce1`](https://github.com/keystonejs/keystone/commit/3a9d20ce11463e7f73f6b6325375cdcee17d63ed) Thanks [@timleslie](https://github.com/timleslie)! - Applied eslint `import/order` rule. - -## 5.1.4 - -### Patch Changes - -- [`f4e4498c6`](https://github.com/keystonejs/keystone/commit/f4e4498c6e4c7301288f23048f4aad3c492985c7) [#5018](https://github.com/keystonejs/keystone/pull/5018) Thanks [@bladey](https://github.com/bladey)! - Updated legacy packages to the @keystone-next namespace. - -## 5.1.3 - -### Patch Changes - -- [`6cb4476ff`](https://github.com/keystonejs/keystone/commit/6cb4476ff15923933862c1cd7d4b1ade794106c6) [#3481](https://github.com/keystonejs/keystone/pull/3481) Thanks [@Noviny](https://github.com/Noviny)! - Updated dependencies through a major version - this shouldn't require change by consumers. - -## 5.1.2 - -### Patch Changes - -- [`c08c28d2`](https://github.com/keystonejs/keystone/commit/c08c28d22f2c6a2bfa73ab0ea347c9e0da8a9063) [#2593](https://github.com/keystonejs/keystone/pull/2593) Thanks [@jossmac](https://github.com/jossmac)! - Applied a more consistent voice throughout documentation. - -## 5.1.1 - -### Patch Changes - -- [`5ba330b8`](https://github.com/keystonejs/keystone/commit/5ba330b8b2609ea0033a636daf9a215a5a192c20) [#2487](https://github.com/keystonejs/keystone/pull/2487) Thanks [@Noviny](https://github.com/Noviny)! - Small changes to package.json (mostly adding a repository field) - -## 5.1.0 - -### Minor Changes - -- [`517b23e4`](https://github.com/keystonejs/keystone/commit/517b23e4b17414ed1807e8d7af1e67377ba3b7bf) [#2391](https://github.com/keystonejs/keystone/pull/2391) Thanks [@timleslie](https://github.com/timleslie)! - Removed support for Node 8.x, as it is [no longer in maintenance mode](https://nodejs.org/en/about/releases/). - -## 5.0.0 - -### Major Changes - -- [`7b4ed362`](https://github.com/keystonejs/keystone/commit/7b4ed3623f5774d7783c39962bfa1ce97938e310) [#1821](https://github.com/keystonejs/keystone/pull/1821) Thanks [@jesstelford](https://github.com/jesstelford)! - Release @keystonejs/\* packages (つ^ ◡ ^)つ - - - This is the first release of `@keystonejs/*` packages (previously `@keystone-alpha/*`). - - All packages in the `@keystone-alpha` namespace are now available in the `@keystonejs` namespace, starting at version `5.0.0`. - - To upgrade your project you must update any `@keystone-alpha/*` dependencies in `package.json` to point to `"@keystonejs/*": "^5.0.0"` and update any `require`/`import` statements in your code. - -# @keystone-alpha/app-static - -## 1.1.2 - -### Patch Changes - -- [9b532072](https://github.com/keystonejs/keystone/commit/9b532072): Rename Keystone to KeystoneJS in docs where possible in docs - -## 1.1.1 - -### Patch Changes - -- [5598701f](https://github.com/keystonejs/keystone/commit/5598701f): throwing errors when the StaticApp doesn't have a string valued passed to the "path" or "src" properties - -## 1.1.0 - -### Minor Changes - -- [fe23c719](https://github.com/keystonejs/keystone/commit/fe23c719): Added a new fallback option to support client-side routing - -## 1.0.3 - -### Patch Changes - -- [42c3fbc9](https://github.com/keystonejs/keystone/commit/42c3fbc9): Upgrade express to 4.17.1 - -## 1.0.2 - -### Patch Changes - -- [19fe6c1b](https://github.com/keystonejs/keystone/commit/19fe6c1b): - - Move frontmatter in docs into comments - -## 1.0.1 - -### Patch Changes - -- [af3f31dd](https://github.com/keystonejs/keystone/commit/af3f31dd): - - Output builds to correct directory - -## 1.0.0 - -### Major Changes - -- [dfcabe6a](https://github.com/keystonejs/keystone/commit/dfcabe6a): - - Specify custom servers from within the index.js file - - - Major Changes: - - The `index.js` export for `admin` must now be exported in the `servers` - array: - ```diff - module.exports = { - keystone, - - admin, - + apps: [admin], - } - ``` - - The `keystone.prepare()` method (often used within a _Custom Server_ - `server.js`) no longer returns a `server`, it now returns a `middlewares` - array: - ```diff - +const express = require('express'); - const port = 3000; - keystone.prepare({ port }) - - .then(async ({ server, keystone: keystoneApp }) => { - + .then(async ({ middlewares, keystone: keystoneApp }) => { - await keystoneApp.connect(); - - await server.start(); - + const app = express(); - + app.use(middlewares); - + app.listen(port) - }); - ``` diff --git a/packages/app-static/README.md b/packages/app-static/README.md deleted file mode 100644 index 0d8bb13e72e..00000000000 --- a/packages/app-static/README.md +++ /dev/null @@ -1,39 +0,0 @@ - - -# Static file app - -[![View changelog](https://img.shields.io/badge/changelogs.xyz-Explore%20Changelog-brightgreen)](https://changelogs.xyz/@keystonejs/app-static) - -A KeystoneJS app to serve static files such as images, CSS and JavaScript with support for client side routing. - -## Usage - -```js title=index.js -const { Keystone } = require('@keystone-next/keystone-legacy'); -const { GraphQLApp } = require('@keystone-next/app-graphql-legacy'); -const { StaticApp } = require('@keystone-next/app-static-legacy'); - -module.exports = { - keystone: new Keystone(), - apps: [ - new GraphQLApp(), - new StaticApp({ - path: '/', - src: 'public', - fallback: 'index.html', - }), - ], -}; -``` - -## Config - -| Option | Type | Required | Description | -| ---------- | -------- | -------- | ------------------------------------------------------------------------------------------------- | -| `path` | `string` | `true` | The path to serve files from. | -| `src` | `string` | `true` | The path to the folder containing static files. | -| `fallback` | `string` | `false` | The path to the file to serve if none is found. This path is resolved relative to the `src` path. | diff --git a/packages/app-static/index.js b/packages/app-static/index.js deleted file mode 100644 index e136b56ea67..00000000000 --- a/packages/app-static/index.js +++ /dev/null @@ -1,43 +0,0 @@ -const pathModule = require('path'); -const fs = require('fs-extra'); -const express = require('express'); -const fallback = require('express-history-api-fallback'); - -const getDistDir = (src, distDir) => { - const srcRelative = pathModule.relative(process.cwd(), src); - return pathModule.resolve(pathModule.join(distDir, srcRelative)); -}; - -class StaticApp { - constructor({ path, src, fallback }) { - if (typeof path !== 'string') { - throw new Error('StaticApp requires a "path" option, which must be a string.'); - } - if (typeof src !== 'string') { - throw new Error('StaticApp requires a "src" option, which must be a string.'); - } - this._path = path; - this._src = src; - this._fallback = fallback; - } - - prepareMiddleware({ dev, distDir }) { - const app = express(); - const folderToServe = dev ? this._src : getDistDir(this._src, distDir); - app.use(this._path, express.static(folderToServe)); - if (this._fallback) { - app.use(fallback(this._fallback, { root: folderToServe })); - } - return app; - } - - build({ distDir }) { - const source = pathModule.resolve(this._src); - const destination = getDistDir(this._src, distDir); - return fs.copy(source, destination); - } -} - -module.exports = { - StaticApp, -}; diff --git a/packages/app-static/package.json b/packages/app-static/package.json deleted file mode 100644 index 999dc5332a8..00000000000 --- a/packages/app-static/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@keystone-next/app-static-legacy", - "description": "KeystoneJS Static File App.", - "version": "5.1.5", - "author": "The KeystoneJS Development Team", - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "express": "^4.17.1" - }, - "dependencies": { - "express-history-api-fallback": "^2.2.1", - "fs-extra": "^9.1.0" - }, - "devDependencies": { - "express": "^4.17.1" - }, - "repository": "https://github.com/keystonejs/keystone/tree/master/packages/app-static" -} diff --git a/packages/fields/package.json b/packages/fields/package.json index 04285eb8714..88f5bca07c6 100644 --- a/packages/fields/package.json +++ b/packages/fields/package.json @@ -35,7 +35,6 @@ "p-settle": "^4.1.1" }, "devDependencies": { - "@keystone-next/app-static-legacy": "*", "@keystone-next/file-adapters-legacy": "*", "@keystone-next/test-utils-legacy": "*", "globby": "^11.0.3", diff --git a/yarn.lock b/yarn.lock index 98b86e97a96..b43eb4cd926 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6335,11 +6335,6 @@ expect@^26.6.2: jest-message-util "^26.6.2" jest-regex-util "^26.0.0" -express-history-api-fallback@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/express-history-api-fallback/-/express-history-api-fallback-2.2.1.tgz#3a2ad27f7bebc90fc533d110d7c6d83097bcd057" - integrity sha1-OirSf3vryQ/FM9EQ18bYMJe80Fc= - express-pino-logger@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/express-pino-logger/-/express-pino-logger-6.0.0.tgz#ed8f71dbbc3c2affbd4104a287f9c2a6a39b435b"