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

Playground and development environment fixes for Lerna #1642

Merged
merged 33 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6b64ea3
feat: update build and dev process
chanceaclark Feb 26, 2020
47a4169
Merge branch 'update-playground' of https://github.com/chanceaclark/r…
epicfaace Mar 10, 2020
ed7efec
rename react-jsonschema-form to @rjsf/core and rjsf-material-ui to @r…
epicfaace Mar 10, 2020
ff2e678
update contributing docs with new setup
epicfaace Mar 10, 2020
a11970c
fix core package setup
epicfaace Mar 10, 2020
5f4e945
update netlify config to properly publish playground
epicfaace Mar 10, 2020
68194d5
run bootstrap on CI
epicfaace Mar 10, 2020
0b25167
add types to @rjsf/core and make @rjsf/material-ui work
epicfaace Mar 10, 2020
bce81b4
playground: fix arrays / objects not rendering properly on material ui
epicfaace Mar 10, 2020
f2d03e2
update mui readme
epicfaace Mar 10, 2020
cd57fa3
update docs
epicfaace Mar 10, 2020
029900d
fix netlify config
epicfaace Mar 10, 2020
a9475b0
ci: install npm deps such as lerna
epicfaace Mar 10, 2020
e49cdd8
switch azure pipelines order
epicfaace Mar 10, 2020
b3652cd
fix netlify
epicfaace Mar 10, 2020
74746cb
add --no-bail and --stream
epicfaace Mar 10, 2020
d1d283f
debug netlify build
epicfaace Mar 11, 2020
bcd06b6
update playground build
epicfaace Mar 11, 2020
3d741ce
fix playground prod build
epicfaace Mar 11, 2020
c20de18
update webpack configs for playground
epicfaace Mar 11, 2020
9798a84
build lib file so it can be properly imported
epicfaace Mar 12, 2020
263ac41
fix resolve for webpack prod config
epicfaace Mar 12, 2020
3d87b4d
remove sleep
epicfaace Mar 14, 2020
2aa9509
Add umd build, don't run build:es:lib in dev mode
epicfaace Mar 14, 2020
83e8fc0
Merge branch 'playground-fix-2' of github.com:rjsf-team/react-jsonsch…
epicfaace Mar 14, 2020
28739d7
Add cross-env for windows compatibility
epicfaace Mar 14, 2020
90b1149
fix babel umd config
epicfaace Mar 14, 2020
b19c560
add WidgetProps
epicfaace Mar 16, 2020
0f96efb
fix export typings
epicfaace Mar 16, 2020
592f093
fix package name
epicfaace Mar 16, 2020
4124bb1
update doc
epicfaace Mar 16, 2020
9052547
Merge branch 'master' of github.com:rjsf-team/react-jsonschema-form i…
epicfaace Mar 16, 2020
a4a2426
add boolean to widgetProps
epicfaace Mar 16, 2020
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
7 changes: 4 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ jobs:
displayName: 'Install Node.js'
- script: |
npm install
npm test
npm run bootstrap
npm run build
npm run test
npm run lint
npm run cs-check
npm run dist
displayName: 'npm install and build'
- job: Docs
steps:
Expand All @@ -37,4 +38,4 @@ jobs:
- script: |
pip install mkdocs==1.0.4
mkdocs build --clean
displayName: 'build docs'
displayName: 'build docs'
2 changes: 1 addition & 1 deletion docs/advanced-customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ You can provide your own implementation of the `SchemaField` base React componen
To proceed so, pass a `fields` object having a `SchemaField` property to your `Form` component; here's a rather silly example wrapping the standard `SchemaField` lib component:

```jsx
import SchemaField from "react-jsonschema-form/lib/components/fields/SchemaField";
import SchemaField from "@rjsf/core/lib/components/fields/SchemaField";

const CustomSchemaField = function(props) {
return (
Expand Down
35 changes: 16 additions & 19 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@

### Development server

When developing a package, to run the playground with your latest changes, cd to the package directory and then run `npm start`. For example, to run the playground, run:
When developing a package, first run from the root-level directory:

```bash
lerna bootstrap
```

Then, go to the package directory and then run `npm start` to live-recompile the files for that package. For example, to edit the core package:

```bash
cd packages/core
npm install
npm start
```

Finally, to run the playground, go to the playground directory and run `npm start` in another terminal.

```bash
cd packages/playground
npm start
```

Expand Down Expand Up @@ -38,28 +50,13 @@ npm test
Code coverage reports are currently available only for the `@rjsf/core` package. They are generated using [nyc](https://github.com/istanbuljs/nyc) each time the `npm test-coverage` script is run.
The full report can be seen by opening `./coverage/lcov-report/index.html`.

### Notes on the local playground

The playground located in `packages/playground` contains code that is published as the `@rjsf/playground` package. This package is used by the local playgrounds in packages such as `packages/core`, so that when you run `npm start` from `packages/core`, it will run the playground component from `@rjsf/playground` but with the local changes to react-jsonschema-form.

Note that when doing local development in a package such as `packages/core`, making changes to `packages/playground` will not affect the local playground that is run from `packages/core`. This should be fine in most cases for development, unless you need to update and test the default playground examples. In this case, you could use `npm link` to use the latest changes both from the playground and your package. As an example, to do this when developing locally on `packages/core`, you can run:

```bash
cd packages/playground
npm run build:lib
npm link
cd ../core
npm link @rjsf/playground
npm start
```

After the above is run, you will have a playground that has both your local changes to `packages/core` and `packages/playground`. Note that while the `packages/core` changes will live reload, the `packages/playground` changes will not -- you will need to run `npm run build:lib` from `packages/playground` each time you update a playground example.

### Releasing

To release, run:

```bash
lerna build
lerna version
lerna publish
git push --tags origin master
Expand All @@ -73,7 +70,7 @@ Docs are automatically released using [Read The Docs](https://readthedocs.org/)

#### Releasing the playground

Note that publishing the `@rjsf/playground` package will update the version of the playground used in the local development playgrounds for packages such as `@rjsf/core`, etc. However, in order to publish the latest playground to [https://rjsf-team.github.io/react-jsonschema-form/](https://rjsf-team.github.io/react-jsonschema-form/) after a new rjsf release, run:
In order to publish the latest playground to [https://rjsf-team.github.io/react-jsonschema-form/](https://rjsf-team.github.io/react-jsonschema-form/) after a new rjsf release, run:

```bash
cd packages/playground
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const {default: Form} = JSONSchemaForm;
import React, { Component } from "react";
import { render } from "react-dom";

import Form from "react-jsonschema-form";
import Form from "@rjsf/core";

const schema = {
title: "Todo",
Expand Down
6 changes: 3 additions & 3 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[build]
base = "packages/playground"
publish = "build"
command = "npm run build:playground"
base = ""
publish = "packages/playground/build"
command = "npm run bootstrap && npm run build"

[build.environment]
SHOW_NETLIFY_BADGE = "true"
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "react-jsonschema-form",
"name": "@rjsf/core",
Copy link
Contributor

Choose a reason for hiding this comment

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

You probably don't want to change this. It should be the name of the repo if it's a monorepo.

Suggested change
"name": "@rjsf/core",
"name": "react-jsonschema-form",

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you think should be done with the version attribute? I don't think Lerna automatically bumped it upon release, and I'm not sure if version is even relevant in the top of the monorepo.

"version": "2.0.0-alpha.1",
"private": true,
"description": "monorepo for react-jsonschema-form and its themes",
Expand All @@ -12,7 +12,8 @@
"lint": "lerna run lint",
"cs-check": "lerna run cs-check",
"cs-format": "lerna run cs-format",
"dist": "lerna run dist"
"build": "lerna run --stream build",
"start": "lerna run start --stream --parallel"
},
"dependencies": {
"prettier": "^1.18.2",
Expand Down
23 changes: 0 additions & 23 deletions packages/core/.babelrc

This file was deleted.

44 changes: 44 additions & 0 deletions packages/core/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const BABEL_ENV = process.env.BABEL_ENV;

const defaultPlugins = [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-optional-chaining',
// IE 11 support
'@babel/plugin-transform-object-assign'
];

module.exports = {
presets: [
[
"@babel/preset-env",
{
modules: ["cjs", "test"].includes(BABEL_ENV) ? "commonjs" : false,
targets:
BABEL_ENV === "test" ? { node: "current" } : { browsers: "defaults" },
},
],
"@babel/preset-react",
],
env: {
cjs: {
plugins: defaultPlugins,
ignore: ['test/**/*.js']
},
umd: {
plugins: defaultPlugins,
ignore: ['test/**/*.js']
},
es: {
plugins: [
...defaultPlugins,
['@babel/plugin-transform-runtime', { useESModules: true, corejs: 2 }]
],
ignore: ['test/**/*.js']
},
test: {
plugins: defaultPlugins,
ignore: []
}
},
};
37 changes: 0 additions & 37 deletions packages/core/devServer.js

This file was deleted.

Loading