NPM : How to install a new plugin

First of all, NPM is working with a package.json file which reference every plugin installed on MaarchCourrier.

If you want to install/add a new package to the application, you should pass by this file, every decent package should normally be present on NPM.

Check the NPM webpage associated with your package and you should see a npm command like “npm install jquery” for the jquery plugin, add it “--save” to save/write the package in the package.json file automatically, e.g “npm install jquery --save”.

Launch the command in a terminal at the application root and you should see NPM working.

Your package is going to be installed in the node_modules folder (located at the application root).

Once your package is downloaded, you got to load it in the application, to do so, open the merged_jsAbstract file and add the path line corresponding to your minify js file package e.g readfile('node_modules/jquery/dist/jquery.min.js');

Your package is now loaded in the application ;)

Angular in MaarchCourrier

There is 2 modes for Angular in our application, a Production Mode and a Developer Mode. The Production Mode consists on a only bundled file regrouping all angular files (which is faster).

Production Mode is set by default in our application, to change it, you have to set the PROD_MODE variable in apps/maarch_entreprise/define.php to false.

When Production Mode is false, the application will load each angular file one by one (which is slower).

Angular (2) is working with TypeScript files (.ts). TypeScript describe itself as “a typed superset of JavaScript that compiles to JavaScript”, so when you are developing with Angular and with TypeScript files, you should launch this command into a terminal “npm run build:watch”.

This command will watch your TypeScript files and transpile them into JavaScript files every time you save them. Finally, when you have finished your developments, don’t forget to rebuild the bundled file used in Production Mode, to do so, launch this command into a terminal “npm run build-prod”.