ben-abbott-nextjs-brw-lib
v1.0.9
Published
Provides components and data access that can be shared across react and nextjs projects
Downloads
3
Readme
Overview
This project is a library which enables Discovery to build marketing websites using shared components.
How to use this library in another project
Follow the documentation at the following link so that you can access the INTO npm packages: how to set up NPM credentials
Once set up you will be able to install the project:
npm i "@into-discovery/browsewebshared"
You will also need the following libraries in your package.json file to run the project:
"@contentful/rich-text-react-renderer": "^15.16.3",
"@contentful/rich-text-types": "^16.0.3",
"contentful": "^9.1.32",
"next": "^13.3.0",
"react": "^18.2.0",
"styled-jsx": "^5.0.0",
"xhr2": "^0.2.1"
In order for styling to be used from the shared components and for network requests add the following lines to the root of the application (For next applications this is app.tsx)
import '@into-discovery/browsewebshared/dist/main.css'
global.XMLHttpRequest = require('xhr2');
Making changes to this project
To publish this project first update the version number, and run the following commands:
npm run build
npm publish
Also, for development purposes, copy-package-to-project PowerShell script was added to project. It copies build folder to BrowseWeb and BrowseWebIS project on your local machine. How to use it:
- Set relative paths to BrowseWeb and BrowseWebIS projects in script
- run npm run build-copy in PowerShell
The script will also clear the NextJS cache, so if either BrowseWeb or BrowseWebIS is running on your - please relaunch it
Make use of Preview Head HTML
As of now our NextJS projects are using react-bootstrap so in order to ease the development process we have added Storybook Preview Head HTML.
This is ONLY for development process and will not render when components gets used in other applications.