# Shared Components between client and admin portal

The Library is published to NPM on the github build.

# Deploying

- When the code is checked into Github it will publish it automatically if the package.json version is bumped.

# Manual Deploy

Manually deploying is faster then committing the code as it doesn't need to create a ful build.

```shell
# Must build the Storybook dist folder before manually publishing
> npm run build

# Edit the package.json file and up the version.
> npm version patch --force

# Login if not already logged in
> npm login

# Publish your new library
> npm publish

# Update the library in other projects by running the following
> npm install pcm-shared-components@latest

# Or run the following to do it all in one go!
sh ./publish.sh

# Or you can also run the following npm to do it all in one go!
> npm run bump
```

```

# Update the remote Library

```npm run bump``` - This will bump the version of the library and push it to the remote repository.


------------------------------------------------------------------------------------------------------------
## Environment (.env)

Copy `.env-template` and rename it to `.env`.

Create a granular access token at [https://www.npmjs.com/settings/tokens](https://www.npmjs.com/settings/tokens) with publish permission.

Place your token inside the `.env` file:

NPM_TOKEN=your_npm_token_here

The token will be used automatically during release and publishing.

If `npm publish` fails with a 404 (even though the package exists), your token has likely expired or lost publish access. Regenerate it from the [pcm-shared-components package page](https://www.npmjs.com/package/pcm-shared-components) (Settings tab) or from [https://www.npmjs.com/settings/tokens](https://www.npmjs.com/settings/tokens), then update `NPM_TOKEN` in `.env`.


------------------------------------------------------------------------------------------------------------

# ##########################################################################
# Upgraded Node Modules from 14 to 20 (Nov 15, 2025)
# ##########################################################################

Steps needed to upgrade node modules to version 20 on your local machine:
- delete the node_modules folder
- delete package-lock.json
- previous version was: v14.18.0
- nvm install 20.19.5
- nvm alias default 20.19.5
- nvm use 20.19.5
- echo "20.19.5" > .nvmrc
- nvm use
- npm install
- npm start

------------------------------------------------------------------------------------------------------------


# Future Migration TODO:

- Storybook Upgrade:
    - I tried to upgrade to the latest version of Storybook v10 but it needs react 18 which I'm not ready to do yet.
    - So for now i'm sticking with version 6.
- As for Vite:
    - because i'm on storyboard 6 I would need VITE v4 which is only supported on node 14-16 which I'm on v20. 
    - So for now I'm sticking with webpack 5.
- react@17.0.2 target 18.x when possible
- refresh ESLint to version 8.x when possible
- Drop babel-eslint in favor of @babel/eslint-parser when possible

test
2