0.1.0 • Published 3 years ago

@myroslav_binary/survey-builderer v0.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

survey-builder

Form builder for survey

NPM JavaScript Style Guide

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.

npm.io

Deployment to NPM

To deploy the application, the following should occur:

  1. Test to make sure the module will build by running yarn build, note that this creates a dist folder in the project root
  2. Copy the contents of the dist folder and insert them into the ingesting app under its node_modules/@myroslav_binary/survey-builder folder
  3. Test that you're able to include and use the component as expected in the ingesting app
  4. After development work and testing, submit a valid PR and point to master
  5. 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 and es versions of your module to dist/ and then publishes your module to npm.

Make sure that any npm modules you want as peer dependencies are properly marked as peerDependencies in package.json. The rollup config will automatically recognize them as peers and not try to bundle them in your module.

Dynamic usage

  1. 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.