how to use complexity-report tool on a js project - javascript

I have installed complexity-report on a javascript project
Instalation is done using $ npm install complexity-report on the root directory of the project. I can run $ cr and it shows some configuration options like on the image above here.
What i don't know is which command i have to use or what steps i have to follow to calculate for example the complexity of a specific js folder?
I need some help with a description of how to use this tool. Some explanations of that tool are given here but i don't understand which is the next step to follow in my case.
Thanks in advance

Related

Moving a Project to Angular Package Format

I have a project:
https://www.npmjs.com/package/#fireflysemantics/slice
I need to move it to the Angular package format. The reason is this:
node_modules/#fireflysemantics/slice/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format.
I think the right way to do this is to create a new empty branch with:
git checkout --orphan angular-package-format
//clear the working directory
git rm --cached -r .
Then just generate a new Angular library project into this new branch:
ng new angular-package-format --create-application=false
cd angular-package-format
ng generate library slice
Then commit and publish that library as noted here:
https://medium.com/#ole.ersoy/creating-an-angular-9-npm-library-1a658ecfa3dc
I think this is probably the right way to go about it, but wanted to check with everyone else as this is the first time I'm attempting this. Is there anything you would change WRT the steps I mentioned?

External JS library for angular 5

I have read all the topic about this subject but i don't understand.
I think that i need an example to understand.
I'm a new learner in angular, i wouldlike to do an mathematical application for mobule with ionic.
So after two weeks when i read a lot and a lot of tutorial, documenations, forum, about angular, i have try to install the two library Mathjax (that it permit to write mathematical character in HTML), and jsxgraph (that it permit to create geometry figure).
But really i don't understrand how.
For the moment i just try with mathjax and all i have succed to do is "npm install mathjax" that it install in node_modules directory Mathjax.js
But now ? What should i do ?
Thnaks in advance for your help, and sorry for my very bad english, i'm french :D
Best regards
If those two libraryies can be found in npm you just have to install and import them.
npm install js-library-name --save
import { moduleName } from 'js-library-name';
And if you dont find those libraries in npm you can add Javascript files to the global scope via the scripts option inside your project's build target options in angular.json. These will be loaded exactly as if you had added them in a <script> tag inside index.html.

Webpack installation - es6

I am an es6 newbie!
When all webpack installation were done, I started trying to create some files as in the pic
and then i tried to write some code in index.js and checked whether it run or not using command
npm run build
and it ended up with a bunch of errors like the pic below
I've been searching a while to resolve this prob but I still cant find out how to solve it.
Plz give me some suggestions to save my day.
I really appreciate your comments!
agree with Andrew Li.
You also need to write some run script in your package.json if you want to use npm command

JSDoc setting up?

I am not that good at computers but am trying to use JSDoc for one of my projects,
The tutorial to get it up and running is here
http://usejsdoc.org/about-jsdoc3.html
I have downloaded the program from github, but now do not understand what I have to do. I have a bunch of files in a folder and dont know how to get it actually running for my project.
Could someone please give me a step by step instruction on how to actually get JSDoc working, how do I set it up, how do I use it etc.
I know this may be mundane to some of you, but hey we all gotta start somewhere right?
Well, are you using windows or GNU/Linux?
First, you have to follow the default tags to markup your source code, identifying your classes, methods, parameters, etc...
After that, you download the file here: https://github.com/jsdoc3/jsdoc
Extract it and then go to folder jsdoc-master.
Inside it, you have a script called jsdoc (with no extension). Only you have to do is execute it pointing the whole path to your .js file you want to create a documentation like this: ./jsdoc your_class.js
Then, in a couple minutes you'll have the output inside the 'out' folder. Open the .html file and bang! You have your documentation working pretty good.
Right here you can find some common tags to use in your code (as comments): http://usejsdoc.org/
This solution is for Unix based system. But, there is another one using nodejs (that you can run with windows, Linux, mac, etc...). First, download the nodejs here: http://nodejs.org/
Then go to this website to take a look at the package jsdoc: https://npmjs.org/
Then, go back to your terminal (in any operating system after installed node) and type: npm install -g jsdoc
The option -g means globally, so you have inside the main folder of your node packages and they are available for whatever project you have and you don't need to install it again and again...
Finally, you can just use this command: jsdoc path/to/your/file.js
And that's it! I hope it helps you.
Once you've extracted the file you downloaded off of github, navigate within the folder and run in a terminal:
./jsdoc
with the options you want.
If you want to display the help menu
./jsdoc --help
If you want to install the program on your system, assuming a mac or linux machine, use root user or sudo:
npm install --save -g [~/Downloads/jsdoc-3.2.2 or your path to the downloaded extracted files]

Angularjs How to generate HTML code Documentation

Does anyone have any experience in documenting/structuring angularjs projects so the JSDoc can generate nice comments (for your directives, controllers, filters etc.) in an HTML format? At the moment it generates one file with the _global class that points to the namespace of my app with couple functions and that's it...
Or maybe there is a better way to generate html version of doc blocks in angularjs?
PS: I am using standard jsdoc syntax to document my code (#param, #return etc.)
Update: My specific question is: Is there any way to generate html documentation for angularjs doc blocks to cover all controllers/directives/filters etc.? When ran JSDoc command line utility it covered only about 5% of my code in the HTML report...
Thanks!
I have been working on a grunt plugin that utilizes AngularJS's documentation generation code. It follows their syntax and output. grunt-docular. The link shows documentation generation for the docular source as well as the original AngularJS source. It's configurable and extendible.
Go to grunt-docular and find the install link for an example of creating your own documentation
EDIT: See John David Five's answer below
My answer was much, much older and should no longer be accepted.
Build steps:
npm install -g grunt-cli
git clone https://github.com/angular/angular.js
cd angular.js
npm install
grunt package
Docs will be availiable at build/docs folder. If you have PHP 5.5 you can view it with:
cd build
php -S localhost:8000
view in browser: http://localhost:8000/docs/index.html

Categories

Resources