Skip to content

Commit

Permalink
Field type build tool (#993)
Browse files Browse the repository at this point in the history
Add build-field-types package
  • Loading branch information
emmatown authored and timleslie committed Apr 18, 2019
1 parent c391e8c commit 1a7b706
Show file tree
Hide file tree
Showing 398 changed files with 6,718 additions and 1,162 deletions.
1 change: 1 addition & 0 deletions .changeset/59372406/changes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "releases": [{ "name": "@keystone-alpha/demo-project-blog", "type": "patch" }], "dependents": [] }
1 change: 1 addition & 0 deletions .changeset/59372406/changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Use named export from @keystone-alpha/fields-wysiwyg-tinymce
25 changes: 25 additions & 0 deletions .changeset/6b3052d4/changes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"releases": [{ "name": "@keystone-alpha/build-field-types", "type": "minor" }],
"dependents": [
{
"name": "@keystone-alpha/admin-ui",
"type": "patch",
"dependencies": ["@keystone-alpha/fields", "@keystone-alpha/build-field-types"]
},
{
"name": "@keystone-alpha/fields",
"type": "patch",
"dependencies": ["@keystone-alpha/build-field-types"]
},
{
"name": "@keystone-alpha/fields-wysiwyg-tinymce",
"type": "patch",
"dependencies": ["@keystone-alpha/fields", "@keystone-alpha/build-field-types"]
},
{
"name": "@keystone-alpha/keystone",
"type": "patch",
"dependencies": ["@keystone-alpha/fields", "@keystone-alpha/build-field-types"]
}
]
}
1 change: 1 addition & 0 deletions .changeset/6b3052d4/changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Create build-field-types package
87 changes: 87 additions & 0 deletions .changeset/79737f04/changes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"releases": [
{ "name": "@keystone-alpha/fields", "type": "major" },
{ "name": "@keystone-alpha/fields-wysiwyg-tinymce", "type": "major" }
],
"dependents": [
{
"name": "@keystone-alpha/admin-ui",
"type": "patch",
"dependencies": ["@keystone-alpha/fields"]
},
{
"name": "@keystone-alpha/keystone",
"type": "patch",
"dependencies": ["@keystone-alpha/fields"]
},
{
"name": "@keystone-alpha/demo-project-blog",
"type": "patch",
"dependencies": [
"@keystone-alpha/admin-ui",
"@keystone-alpha/keystone",
"@keystone-alpha/fields",
"@keystone-alpha/fields-wysiwyg-tinymce"
]
},
{
"name": "@keystone-alpha/demo-project-todo",
"type": "patch",
"dependencies": [
"@keystone-alpha/admin-ui",
"@keystone-alpha/keystone",
"@keystone-alpha/fields"
]
},
{
"name": "@keystone-alpha/cypress-project-access-control",
"type": "patch",
"dependencies": [
"@keystone-alpha/admin-ui",
"@keystone-alpha/keystone",
"@keystone-alpha/fields"
]
},
{
"name": "@keystone-alpha/cypress-project-basic",
"type": "patch",
"dependencies": [
"@keystone-alpha/admin-ui",
"@keystone-alpha/keystone",
"@keystone-alpha/fields"
]
},
{
"name": "@keystone-alpha/cypress-project-facebook-login",
"type": "patch",
"dependencies": [
"@keystone-alpha/admin-ui",
"@keystone-alpha/keystone",
"@keystone-alpha/fields"
]
},
{
"name": "@keystone-alpha/cypress-project-login",
"type": "patch",
"dependencies": [
"@keystone-alpha/admin-ui",
"@keystone-alpha/keystone",
"@keystone-alpha/fields"
]
},
{
"name": "@keystone-alpha/cypress-project-twitter-login",
"type": "patch",
"dependencies": [
"@keystone-alpha/admin-ui",
"@keystone-alpha/keystone",
"@keystone-alpha/fields"
]
},
{
"name": "@keystone-alpha/api-tests",
"type": "patch",
"dependencies": ["@keystone-alpha/keystone", "@keystone-alpha/fields"]
}
]
}
1 change: 1 addition & 0 deletions .changeset/79737f04/changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Use build-field-types
4 changes: 4 additions & 0 deletions .changeset/e9b12a40/changes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"releases": [{ "name": "@keystone-alpha/cypress-project-basic", "type": "patch" }],
"dependents": []
}
1 change: 1 addition & 0 deletions .changeset/e9b12a40/changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Update deps in test project
2 changes: 0 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ x-integration-steps: &integration-steps
name: Bolt - Install packages
command: CYPRESS_CACHE_FOLDER=$CIRCLE_WORKING_DIRECTORY/node_modules/cypress/.cache/ bolt
- save_cache: *save-cache
- run: bolt build
- run:
name: E2E Cypress tests
command: CYPRESS_CACHE_FOLDER=$CIRCLE_WORKING_DIRECTORY/node_modules/cypress/.cache/ bolt ws run cypress:run:ci --only-fs $PROJECT_DIRECTORY
Expand Down Expand Up @@ -78,7 +77,6 @@ jobs:
# causing the other job to fail with a "Missing Cypress" error.
- run: CYPRESS_CACHE_FOLDER=$CIRCLE_WORKING_DIRECTORY/node_modules/cypress/.cache/ bolt
- save_cache: *save-cache
- run: bolt build
# run tests!
- run: yarn lint:eslint --format junit -o reports/junit/js-lint-results.xml
- run: yarn lint:prettier
Expand Down
16 changes: 15 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ module.exports = {
'error',
{
devDependencies: [
'**/__tests__/**/*.js',
'**/*test.js',
'**/tests/**/*.js',
'**/examples/**/*.js',
'**/build/**/*.js',
`packages/fields/types/**/filterTests.js`,
`packages/fields/src/**/filterTests.js`,
],
},
],
'import/no-unresolved': 'error',
'object-curly-spacing': ['error', 'always'],
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'react/jsx-boolean-value': 'warn',
Expand Down Expand Up @@ -71,5 +73,17 @@ module.exports = {
'no-undef': 'off',
},
},
{
files: ['packages/fields/src/**/*.js'],
rules: {
'import/no-commonjs': 'error',
},
},
{
files: ['packages/build-field-types/__fixtures__/**/*.js'],
rules: {
'import/no-unresolved': 'off',
},
},
],
};
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ git pull
bolt
bolt publish-changed
git push --tags
bolt
```

**Note**: if you have two-factor authentication enabled for npm, you'll need to provide your 2FA code to the `publish-changed` task, like this:
Expand Down
18 changes: 17 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
module.exports = {
presets: [
['@babel/env', { exclude: ['transform-regenerator', 'transform-async-to-generator'] }],
[
'@babel/env',
{
targets: {
node: 10,
browsers: [
'last 2 chrome versions',
'last 2 firefox versions',
'last 2 safari versions',
'last 2 edge versions',
],
},
},
],
'@babel/react',
'@babel/preset-flow',
],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/proposal-object-rest-spread',
'@babel/plugin-syntax-dynamic-import',
...(process.env.NODE_ENV === 'test'
? [require('./packages/build-field-types').devBabelPlugin]
: []),
],
};
2 changes: 1 addition & 1 deletion demo-projects/blog/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const {
CalendarDay,
DateTime,
} = require('@keystone-alpha/fields');
const Wysiwyg = require('@keystone-alpha/fields-wysiwyg-tinymce');
const { Wysiwyg } = require('@keystone-alpha/fields-wysiwyg-tinymce');
const { LocalFileAdapter } = require('@keystone-alpha/file-adapters');
const getYear = require('date-fns/get_year');

Expand Down
4 changes: 2 additions & 2 deletions demo-projects/blog/server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const keystone = require('@keystone-alpha/core');
const WysiwygField = require('@keystone-alpha/fields-wysiwyg-tinymce');
const { Wysiwyg } = require('@keystone-alpha/fields-wysiwyg-tinymce');
const next = require('next');

const { port, staticRoute, staticPath } = require('./config');
Expand All @@ -21,7 +21,7 @@ Promise.all([keystone.prepare({ port }), nextApp.prepare()])
await keystoneApp.createItems(initialData);
}

WysiwygField.bindStaticMiddleware(server);
Wysiwyg.bindStaticMiddleware(server);
server.app.use(staticRoute, server.express.static(staticPath));
server.app.use(nextApp.getRequestHandler());
await server.start();
Expand Down

0 comments on commit 1a7b706

Please sign in to comment.