@myroslav_binary/survey-builderer v0.1.0
survey-builder
Form builder for survey
Install
npm install --save @myroslav_binary/survey-builder
Usage
import React, { Component } from 'react'
import MyComponent from '@myroslav_binary/survey-builder'
import '@myroslav_binary/survey-builder/dist/index.css'
class Example extends Component {
render() {
return <MyComponent />
}
}
Development
Local development is broken into two parts (ideally using two tabs).
First, run rollup to watch your src/
module and automatically recompile it into dist/
whenever you make changes.
npm start # runs rollup with watch flag
The second part will be running the example/
create-react-app that's linked to the local version of your module.
# (in another tab)
cd example
npm start # runs create-react-app dev server
Now, anytime you make a change to your library in src/
or to the example app's example/src
, create-react-app
will live-reload your local dev server so you can iterate on your component in real-time.
Deployment to NPM
To deploy the application, the following should occur:
- Test to make sure the module will build by running
yarn build
, note that this creates adist
folder in the project root - Copy the contents of the
dist
folder and insert them into the ingesting app under itsnode_modules/@myroslav_binary/survey-builder
folder - Test that you're able to include and use the component as expected in the ingesting app
- After development work and testing, submit a valid PR and point to
master
- Once merged to
master
increase the version number and create a version tag. This can be done with the following:
yarn prepare-<patch|minor|major>
git push --follow-tags
Publishing to npm
npm publish
This builds
commonjs
andes
versions of your module todist/
and then publishes your module tonpm
.Make sure that any npm modules you want as peer dependencies are properly marked as
peerDependencies
inpackage.json
. The rollup config will automatically recognize them as peers and not try to bundle them in your module.
Dynamic usage
yarn link
Architecture of the project
The survey builder is based on top of React and the react-jsonschema-form (rjsf) library.
For lib building create-react-library is used.
3 years ago