ross-mvecom-fe-common
v0.2.0
Published
Common library
Downloads
1
Readme
ROSS-MVECOM-FE-COMMON
Working locally
To test the library in your application without first publishing it you need to create a symlink from the library to your application. This is done by doing the following steps:
Step 1
Compile the library by running the following command
npm run compile
Or, if you want the changes to hot-compile, you can run the compile script with a watcher
npm run compile:watch
Step 2
Navigate to the dist
that can be found inside the root directory
cd dist
From where here you need to prepare the symlink by running
npm link
Step 3
Navigate to your application from where you have your node_modules folder and run this command
npm link @mvecom/common
You should now be good to go! If you run the compile command with the :watch
suffix you'll automatically get the changes done inside the library inside your application.
Manually publishing
In order to manually publish you'll need to do the following steps.
Step 1
Make sure the library is compiled with the latest changes.
npm run compile
Step 2
Create a .npmrc
file inside the dist
directory and add the following information.
registry=https://interikea.jfrog.io/artifactory/api/npm/mvecom-fe-common/
_auth=<needs to be fetched>
always-auth=true
email=<your email address to JFrog>
Step 3
Fetch credentials for .npmrc
by first making sure that you have an account to the JFrog instance, and then navigating into your profile from which you can create an API-key.
Once you've created an API-key you should be able to get the missing credentials by running the following command.
curl -u <JFrog email address>:<API-key> https://interikea.jfrog.io/artifactory/api/npm/auth/
Step 4
Once you've added the missing credentials you need to update the package.json
file inside the dist
directory to have a higher version than before. You also need to update the CHANGELOG.md
to contain the latest version and what has been done.
Once this is done you should be able to publish by running the following command.
npm publish
Installing the common library
Get the credentials from knowit.1passwword (@mvecom/common - Authentication) and add it to your .npmrc
.
Then add the common library to your application.
npm i @mvecom/common
Developing components
Skapa dependencies
The common library should not include the components from Skapa. Instead they should be added as peer dependencies when needed. This is because the applications have different ways of instantiating the components and then it's better to let the consumer of the library to have full control of the Skapa dependencies.
Storybook
To browse the componenta and make it easier to develop a component, we have a storybook setup under the /storybook
directory.
npm run storybook
If you need more information on how to write stories, here's a good introduction to that, https://storybook.js.org/docs/react/writing-stories/introduction