React utilities for MyZanichelli apps
yarn
yarn start
Please refers to the example app README.md file to configure the example app, then run
yarn start:app
In order to make a new component available in the example app, you need to export it from /index.tsx
and then run yarn build
from the root directory.
To build the library before release it run
yarn build
In this repository we follow the Conventional Commits Specification and we use standard-version to update the CHANGELOG.md when publishing a new version of the package to NPM.
Standard-version automatically detects the type of the update (patch, minor or major) following the Semantic Versioning specification.
Publish a new version on NPM registry
- Make sure you are logged in NPM
- Run standard-version:
yarn release
Specify a version
If you want to select a version or the update type, you can use the --release-as
flag:
yarn release --release-as path
yarn release --release-as 1.1.0
In general, you can pass any flag supported by standard-version, please refer to their CLI usage documentation.
Specify a tag
If you want to add a tag to your published version, you can use the --tag
flag:
yarn release --tag myz
Push tags and publish
git push --follow-tags origin branch-name
yarn publish
First install the library in your host project
yarn add @zanichelli/myz-react-utils
Then set the following environment variables:
REACT_APP_API_ENV=local
REACT_APP_MYZ_URL="https://localmy.zanichelli.it"
REACT_APP_API_WEB_URL="https://local-webmy.zanichelli.it"
REACT_APP_ZANIT_URL="https://local.zanichelli.it"
REACT_APP_API_V3_URL="https://local-api-catalogo.zanichelli.it/v3"
REACT_APP_API_URL="https://local-api-catalogo.zanichelli.it"
REACT_APP_S3_URL="https://staticdevmy.zanichelli.it"
REACT_APP_MYZ_TOKEN_KEY="myz-token-local"
REACT_APP_MYZ_TOKEN_COOKIE="myz_token_local"
You can use the library components like this:
import React, { Component } from 'react'
import * as Components from 'myz-react-utils'
import { Utils } from 'myz-react-utils'
class Example extends Component {
render() {
console.log(Utils.getMyzTokenCookie())
return <Components.Footer />
}
}
- Footer
- Topbar
- Request
- getCookie
- getMyzTokenCookie
- Validators,
- manageMarkupContent,
- trans
- HttpStatus
- Config
Zanichelli © Secondini