Skip to content

Commit

Permalink
Remove the unused field types from the fields package (#5234)
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie authored Mar 25, 2021
1 parent 45937c0 commit f448a8b
Show file tree
Hide file tree
Showing 33 changed files with 16 additions and 2,983 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-cats-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/fields-legacy': major
---

Removed the legacy field types `CalendarDay`, `DateTime`, `Slug`, `Url`, and `Uuid`.
4 changes: 0 additions & 4 deletions packages/fields-mongoid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,3 @@ However, JavaScript and (depending on your configuration) some DB platforms are
in these contexts, the string `'AF3D'` _does not equal_ the string `'af3d'`.

For the `MongoId` type, we mitigate this problem by forcing values to lowercase when using the Knex adapter.

Similar issues are faced by the
[core `Uuid` field type](https://github.com/keystonejs/keystone/tree/master/packages/fields/src/types/Uuid#casing).
It is also often represented using hexadecimal within a string.
7 changes: 1 addition & 6 deletions packages/fields/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ Keystone contains a set of primitive fields types that can be imported from the

| Field type | Description |
| :------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------- |
| [`CalendarDay`](/packages/fields/src/types/CalendarDay/README.md) | An abstract "day" value; useful for Birthdays and other all-day events always celebrated in the local time zone |
| [`Checkbox`](/packages/fields/src/types/Checkbox/README.md) | A single Boolean value |
| [`DateTime`](/packages/fields/src/types/DateTime/README.md) | A point in time and a time zone offset |
| [`DateTimeUtc`](/packages/fields/src/types/DateTimeUtc/README.md) | Represents points in time, stored in UTC |
| [`Decimal`](/packages/fields/src/types/Decimal/README.md) | Exact, numeric values in base-10; useful for currency, etc. |
| [`File`](/packages/fields/src/types/File/README.md) | Files backed various storage mediums: local filesystem, cloud based hosting, etc. |
Expand All @@ -21,10 +19,7 @@ Keystone contains a set of primitive fields types that can be imported from the
| [`Password`](/packages/fields/src/types/Password/README.md) | A [`bcrypt`](https://en.wikipedia.org/wiki/Bcrypt) hash of the value supplied; |
| [`Relationship`](/packages/fields/src/types/Relationship/README.md) | A link between the current list and others, often paired with a field on the other list |
| [`Select`](/packages/fields/src/types/Select/README.md) | One of several predefined string values, presented as a dropdown |
| [`Slug`](/packages/fields/src/types/Slug/README.md) | Generate unique slugs (aka. keys, url segments) based on the item's data |
| [`Text`](/packages/fields/src/types/Text/README.md) | A basic but versatile text field of arbitrary length |
| [`Url`](/packages/fields/src/types/Url/README.md) | Extends the [`Text`](/packages/fields/src/types/Text/README.md) type to store HTTP URLs |
| [`Uuid`](/packages/fields/src/types/Uuid/README.md) | [Universally Unique Identifiers](https://en.wikipedia.org/wiki/Universally_unique_identifier) (UUIDs); useful for `id` fields |
| [`Virtual`](/packages/fields/src/types/Virtual/README.md) | Read-only field with a developer-defined resolver, executed on read |

In addition to these, some complex types are packaged separately:
Expand Down Expand Up @@ -104,7 +99,7 @@ keystone.createList('Post', {
fields: {
title: { type: Text },
slug: {
type: Slug,
type: Text,
adminConfig: {
isReadOnly: true, //slug can be created automatically and you may want to show this as read only
},
Expand Down
9 changes: 3 additions & 6 deletions packages/fields/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keystone-next/fields-legacy",
"description": "KeystoneJS Field Types including Text, Password, DateTime, Integer, and more.",
"description": "KeystoneJS Field Types including Text, Password, Integer, and more.",
"homepage": "https://github.com/keystonejs/keystone",
"repository": "https://github.com/keystonejs/keystone/tree/master/packages/fields",
"version": "23.2.0",
Expand All @@ -12,32 +12,29 @@
"node": ">=10.0.0"
},
"dependencies": {
"@apollo/client": "^3.3.12",
"@babel/runtime": "^7.13.10",
"@keystone-next/access-control-legacy": "^9.0.0",
"@keystone-next/adapter-knex-legacy": "^13.2.2",
"@keystone-next/adapter-mongoose-legacy": "^11.1.2",
"@keystone-next/adapter-prisma-legacy": "^4.0.0",
"@keystone-next/server-side-graphql-client-legacy": "^2.0.1",
"@keystone-next/utils-legacy": "^7.0.0",
"@sindresorhus/slugify": "^1.1.0",
"apollo-errors": "^1.9.0",
"bcryptjs": "^2.4.3",
"cuid": "^2.1.8",
"date-fns": "^2.19.0",
"decimal.js": "^10.2.1",
"dumb-passwords": "^0.2.1",
"graphql": "^15.5.0",
"inflection": "^1.12.0",
"lodash.groupby": "^4.6.0",
"luxon": "^1.26.0",
"mongoose": "^5.12.2",
"p-settle": "^4.1.1"
},
"devDependencies": {
"@apollo/client": "^3.3.12",
"@keystone-next/file-adapters-legacy": "*",
"@keystone-next/server-side-graphql-client-legacy": "*",
"@keystone-next/test-utils-legacy": "*",
"globby": "^11.0.3",
"graphql-upload": "^11.0.0",
"mime": "^2.5.2"
}
Expand Down
5 changes: 0 additions & 5 deletions packages/fields/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
export { Implementation } from './Implementation';
export { default as CalendarDay } from './types/CalendarDay';
export { default as Checkbox } from './types/Checkbox';
export { default as DateTime } from './types/DateTime';
export { default as DateTimeUtc } from './types/DateTimeUtc';
export { default as Decimal } from './types/Decimal';
export { default as File } from './types/File';
Expand All @@ -10,8 +8,5 @@ export { default as Integer } from './types/Integer';
export { default as Password } from './types/Password';
export { default as Relationship } from './types/Relationship';
export { default as Select } from './types/Select';
export { default as Slug } from './types/Slug';
export { default as Text } from './types/Text';
export { default as Url } from './types/Url';
export { default as Uuid } from './types/Uuid';
export { default as Virtual } from './types/Virtual';
191 changes: 0 additions & 191 deletions packages/fields/src/types/CalendarDay/Implementation.js

This file was deleted.

53 changes: 0 additions & 53 deletions packages/fields/src/types/CalendarDay/Implementation.test.js

This file was deleted.

Loading

1 comment on commit f448a8b

@vercel
Copy link

@vercel vercel bot commented on f448a8b Mar 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.