Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PrimeNG: how to 'pack' or 'build' the project after making changes?

I use primeng in my angular application. I wanted to add some functionality to one of the components so I followed the instructions (https://github.com/primefaces/primeng/wiki/Building-From-Source) and got all of my changes to work. Now I want to package it up so I can install this modified branch in my application. How do I go about doing that?

I've done this before with ng2-bootstrap by running 'npm pack' and then installing the generated tar package in my application. I tried doing the same with primeng but my project errored because the primeng.js file wasn't there. I'm assuming I need to do it a different way but I don't know how and I don't have much webpack/gulp experience.

like image 684
Kevin Quiring Avatar asked Sep 03 '25 04:09

Kevin Quiring


2 Answers

In the forked PrimeNG v5, package.json need to be updated with following lines to build and redistribute.

additions to package.json

  "scripts": {
    "build-components": "ngc -p tsconfig-release.json",
    "build-assets": "gulp build-assets",
    "build-styles": "node-sass src/assets/components -o src/assets/components",
    "build-redistribute": "npm run build-components && npm run build-assets && npm run build-styles"
  }
  "devDependencies": {
    "node-sass": "^4.5.3",
  }

install node-sass and run the following command to build

npm run build-redistribute

Ref : https://forum.primefaces.org/viewtopic.php?p=159783#p159783

like image 104
Anulal S Avatar answered Sep 05 '25 01:09

Anulal S


  1. Fork to your GitHub account
  2. Clone package
  3. Make a new branch
  4. Make changes to new branch

Then run the following commands in order;

npm install - Downloads the dependencies

gulp build - Creates resource bundle for css

npm run build-prod - Which runs the build scripts.

You can then push this package to your own GitHub account and with a different branch name and run the following in your project you require the custom build:

npm install git://github.com/<user>/<project>.git#<branch>

Then whenever priming makes changes on the master you can merge them with your custom branch.

like image 35
J J B Avatar answered Sep 04 '25 23:09

J J B