Skip to content

Commit

Permalink
docs(ngdocs): replace grunt-ngdocs with grunt-uidocs-generator
Browse files Browse the repository at this point in the history
This will allow us to keep better track of security issues and provides us an easier paths for
upgrades in the future.

fix #6797
  • Loading branch information
Portugal, Marcelo authored and mportuga committed Jul 18, 2018
1 parent 9e65084 commit b2aa207
Show file tree
Hide file tree
Showing 9 changed files with 1,652 additions and 5,148 deletions.
36 changes: 17 additions & 19 deletions FIRST_TIMER.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pull request.

In order to contribute an update your basic process is:

- Fork the ui-grid repository in github, giving you your own copy in which you
- Fork the ui-grid repository in github, giving you your own copy in which you
can work, and over which you have access permissions
- Clone that repository
- Setup the toolset on your local machine
Expand All @@ -39,7 +39,7 @@ can work, and over which you have access permissions
We'll go through each step in turn.

### Fork the ui-grid repository ###
This is the easiest step. Get yourself a github logon, and navigate to the
This is the easiest step. Get yourself a github logon, and navigate to the
[ui-grid github page](https://github.com/angular-ui/ui-grid). Click the
fork button in the top left. This should navigate you to your list of
projects in github, with a new fork of ui-grid.
Expand All @@ -63,7 +63,7 @@ Links to try might include:
In your github repository, on the right hand side underneath settings you'll see
a box with "clone url" written in it. Copy this clone url.

Using the command line (terminal in OSX or linux, cmd in windows)
Using the command line (terminal in OSX or linux, cmd in windows)
go to the directory in which you store your projects. Type:
`git clone <url you copied>`

Expand All @@ -86,7 +86,7 @@ This allows you to get the latest code from upstream by:
We'll discuss these steps later, for now we just want the setup done.

## Setup the toolset ###
Before we do anything else we'll check that we can compile the code and run all
Before we do anything else we'll check that we can compile the code and run all
the tests - if there are problems here then we want to know it's something wrong
in the install rather than a change that you've made.

Expand All @@ -98,7 +98,7 @@ tells the node package manager (npm) what to install, bower.json tells bower wha

The installation process is to first install the global packages:
` npm install -g grunt-cli`
If you're on a unix derived machine (OSX, Linux) you may need elevated privileges to do
If you're on a unix derived machine (OSX, Linux) you may need elevated privileges to do
this install:
` sudo npm install -g grunt-cli`

Expand All @@ -112,7 +112,7 @@ Next, run the build process to verify that it builds successfully and all the un
pass. The build process is driven by a tool called grunt - think of this as being similar
to make (for c++), rake (for ruby on rails), ant, cake, or any other build tool.

The core grunt configuration lives in `Gruntfile.js`, in general you shouldn't need to
The core grunt configuration lives in `Gruntfile.js`, in general you shouldn't need to
change this, but if you get difficulties this is where you'd trouble shoot.

To run a basic build, including unit tests, we can run the grunt default task:
Expand All @@ -125,7 +125,7 @@ something has gone wrong. Tell us about it, and help to improve this guide by a
common errors and resolutions here:

- So far, no common errors.

Next, we want to run the end to end tests. This may require installing protractor
and selenium. Start by running the grunt install task:
` grunt install`
Expand Down Expand Up @@ -155,7 +155,7 @@ and add `ddescribe` in there. `iit` has a similar effect. Remember to take thi
again before submitting a pull request.

### Make documentation changes ###
Before making any changes, create a feature branch. This means that you branch the code
Before making any changes, create a feature branch. This means that you branch the code
base before you commit anything, and this branch is what you'll do a pull request against.
` git fetch upstream`
` git checkout upstream/master`
Expand All @@ -166,25 +166,25 @@ The documentation for ui-grid comes in three components:

1. The .md files within the root directory of the project. These are visible only
on github, through clicking on them. They generally deal with information for a contributor,
such as this guide. These can be edited directly, then submitted. They are authored in
such as this guide. These can be edited directly, then submitted. They are authored in
markdown format, and can only be viewed in their rendered format on github - so you edit them
then push to your fork, and look at them on github.
2. The tutorial files. These are in misc/tutorial/*.ngdoc, and are built by the grunt-ngdocs
2. The tutorial files. These are in misc/tutorial/*.ngdoc, and are built by the grunt-uidocs-generator
processor into the dist/docs/partials directory. You can preview your changes through running
`grunt dev` and looking at http://localhost:9003. These are again in markdown, but in a special
ngdoc version of markdown. They can include end-to-end tests, and examples that are exportable
to plunkr. The biggest gotcha is being careful with where you put the ":" in the name
3. The api documentation. This is extracted from the comment blocks in the javascript (`src/` folder).
It uses ngdoc format and is processed by the grunt-ngdocs tool. Edits to this are done within
It uses ngdoc format and is processed by the grunt-uidocs-generator tool. Edits to this are done within
the comment blocks in the code.

All of this content can be edited with a text editor.

The ngdoc generator has some tricks and tips. It is somewhat fussy about integrity - if you declare
The uidocs generator has some tricks and tips. It is somewhat fussy about integrity - if you declare
a method to be `@methodOf` something, then that something must exist. If it doesn't then you'll get
an obscure error from grunt-ngdocs. The best advice is to save often and keep checking that it's
an obscure error from grunt-uidocs-generator. The best advice is to save often and keep checking that it's
extracting and rendering properly - then if something gives an error you'll have a good idea of what
you changed. If you make bulk changes then run grunt-ngdocs, and you get an error, you'll have very
you changed. If you make bulk changes then run grunt-uidocs-generator, and you get an error, you'll have very
poor information about where the error is within the documentation set.

### Run the unit and e2e tests ###
Expand All @@ -204,8 +204,8 @@ To commit to git, you can:
In your commit message, follow the guidelines from [CONTRIBUTING.md](https://github.com/angular-ui/ui-grid/blob/master/CONTRIBUTING.md):

- Please adhere to these [git commit message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
or your code is unlikely be merged into the main project.
or your code is unlikely be merged into the main project.

If you've made multiple commits to the code, you need to squash them into a single commit so that
we don't end up with lots of small/junk commits in the overall project history. To do this you
use the interactive rebase function of git:
Expand Down Expand Up @@ -242,9 +242,7 @@ license your work under the the terms of the [MIT License](LICENSE.md).

Remember that this is a volunteer only open source project. Most of the developers are working on their
own areas of the functionality, and usually doing that in stolen moments of time. They generally prefer to
spend time coding their own stuff rather than reviewing the pull requests of others. Typically it'll take a
spend time coding their own stuff rather than reviewing the pull requests of others. Typically it'll take a
couple of days for someone to find the time to review and comment on your pull request. Most people will
have a few updates they're requested to make on the first couple, whilst they learn the ropes, so be prepared
for that.


10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![npm](https://img.shields.io/npm/dm/angular-ui-grid.svg)](https://www.npmjs.com/package/angular-ui-grid)
[![devDependencies Status](https://david-dm.org/angular-ui/ui-grid/dev-status.svg)](https://david-dm.org/angular-ui/ui-grid?type=dev)
[![OpenCollective](https://opencollective.com/ui-grid/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/ui-grid/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/ui-grid/sponsors/badge.svg)](#sponsors)

[![Selenium Test Status](https://saucelabs.com/browser-matrix/nggrid.svg)](https://saucelabs.com/u/nggrid)
Expand Down Expand Up @@ -88,14 +88,14 @@ like your plugin added to that list, please [edit the tutorial page](misc/tutori
# Building
The first step is to install dependencies. `git` is required and must be available from the command line. If you don't have it, install git and ensure that the executable is in your path. If you are new to git, the easiest way to install is by installing the github client.
The first step is to install dependencies. `git` is required and must be available from the command line. If you don't have it, install git and ensure that the executable is in your path. If you are new to git, the easiest way to install is by installing the github client.
The `grunt` command line utility is also required.
# If you don't already have the grunt-cli installed:
> npm install -g grunt-cli
With `git` and `grunt-cli` installed you simply run the following commands to install all dependencies.
With `git` and `grunt-cli` installed you simply run the following commands to install all dependencies.
> npm install
> grunt install
Expand All @@ -109,7 +109,7 @@ The default grunt task will test and build files into `dist/`
Development "watch" task. This will automatically rebuild from source on changes, reload Gruntfile.js if you change it, and rebuild the docs.
1. A server on localhost:9002 serving whichever directory you checked out, with livereload. Navigate to http://localhost:9002/misc/demo to see the [demo files](http://localhost:9002/misc/demo/grid-directive.html).
2. A server on localhost:9003 serving the ./docs directory. These are the docs built from source with a custom grunt-ngdocs that should work with Angular 1.6.x.
2. A server on localhost:9003 serving the ./docs directory. These are the docs built from source with grunt-uidocs-generator.
Expand Down Expand Up @@ -252,5 +252,3 @@ Become a sponsor and get your logo on our website and on our README on Github wi
<a href="https://opencollective.com/ui-grid/sponsor/27/website" target="_blank"><img src="https://opencollective.com/ui-grid/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/ui-grid/sponsor/28/website" target="_blank"><img src="https://opencollective.com/ui-grid/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/ui-grid/sponsor/29/website" target="_blank"><img src="https://opencollective.com/ui-grid/sponsor/29/avatar.svg"></a>
4 changes: 2 additions & 2 deletions grunt/aliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = function (grunt, options) {
'default': ['before-test', 'test:single', 'after-test'],

// Build with no testing
'build': ['ngtemplates', 'concat', 'uglify', 'less', 'ngdocs', 'copy:font_dist', 'copy:site', 'copy:less_customizer',],
'build': ['ngtemplates', 'concat', 'uglify', 'less', 'uidocs-generator', 'copy:font_dist', 'copy:site', 'copy:less_customizer',],

// Auto-test tasks for development
'autotest:unit': ['karmangular:start'],
Expand Down Expand Up @@ -51,7 +51,7 @@ module.exports = function (grunt, options) {
baseTasks['release'] = ['clean', 'ngtemplates', 'build', 'copy:less_dist', 'cut-release', 'gh-pages:ui-grid-site', 'update-bower-json', 'gh-pages:bower', 'npm-publish'];
}
else {
baseTasks['release'] = ['clean', 'ngtemplates', 'build', 'copy:less_dist', 'cut-release', 'gh-pages:ui-grid-site'];
baseTasks['release'] = ['clean', 'ngtemplates', 'build', 'copy:less_dist', 'cut-release'];
}

return baseTasks;
Expand Down
8 changes: 6 additions & 2 deletions grunt/ngdocs.js → grunt/uidocs-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
'//ajax.googleapis.com/ajax/libs/angularjs/<%= latestAngular %>/angular.js',
'//ajax.googleapis.com/ajax/libs/angularjs/<%= latestAngular %>/angular-touch.js',
'//ajax.googleapis.com/ajax/libs/angularjs/<%= latestAngular %>/angular-animate.js',
'//ajax.googleapis.com/ajax/libs/angularjs/<%= latestAngular %>/angular-aria.js',
'bower_components/csv-js/csv.js',
'bower_components/pdfmake/build/pdfmake.js',
'bower_components/pdfmake/build/vfs_fonts.js',
Expand All @@ -29,8 +30,6 @@ module.exports = {
'bower_components/excel-builder-js/dist/excel-builder.dist.js'
],
hiddenScripts: [
'//ajax.googleapis.com/ajax/libs/angularjs/<%= latestAngular %>/angular-animate.js',
'//ajax.googleapis.com/ajax/libs/angularjs/<%= latestAngular %>/angular-aria.js',
'bower_components/google-code-prettify/src/prettify.js',
'node_modules/marked/lib/marked.js'
],
Expand All @@ -45,13 +44,18 @@ module.exports = {
// process.env.TRAVIS ? '<%= dist %>/release/<%= pkg.name %>.unstable.css' : '<%= dist %>/release/<%= pkg.name %>.css'
// '<%= dist %>/release/<%= pkg.name %>.css'
],
baseCSSPath: 'misc/doc/css/bootstrap-flatly.min.css',
title: 'UI Grid',
titleLink: '/',
html5Mode: false,
analytics: {
account: 'UA-46391685-1',
domainName: 'ui-grid.info'
},
adsConfig: {
client: 'ca-pub-6177019177103290',
slot: '3609320072'
},
navTemplate: 'misc/doc/templates/nav.html'
},
api: {
Expand Down
8 changes: 4 additions & 4 deletions grunt/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = function( grunt, options ){

gruntfile: {
files: ['<%= jshint.gruntfile.src %>', 'grunt/*.js'],
tasks: ['jshint:gruntfile', 'ngdocs']
tasks: ['jshint:gruntfile', 'uidocs-generator']
},

ngtemplates: {
Expand All @@ -17,7 +17,7 @@ module.exports = function( grunt, options ){

rebuild: {
files: util.testFiles.unit,
tasks: ['jshint:src_test', 'jscs', 'karmangular:run', 'concat', 'uglify', 'ngdocs'],
tasks: ['jshint:src_test', 'jscs', 'karmangular:run', 'concat', 'uglify', 'uidocs-generator'],
},

protractor: {
Expand All @@ -27,12 +27,12 @@ module.exports = function( grunt, options ){

less: {
files: 'src/**/*.less',
tasks: ['less', 'ngdocs', 'concat:customizer_less']
tasks: ['less', 'uidocs', 'concat:customizer_less']
},

docs: {
files: ['misc/tutorial/**/*.ngdoc', 'misc/api/**/*.ngdoc', 'misc/doc/**'],
tasks: 'ngdocs'
tasks: 'uidocs-generator'
},

copy: {
Expand Down
10 changes: 3 additions & 7 deletions lib/grunt/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ var util = require('./utils.js');
var semver = require('semver');
var shell = require('shelljs');

var ngdoc = require('../../node_modules/grunt-ngdocs/src/ngdoc.js');
var reader = require('../../node_modules/grunt-ngdocs/src/reader.js');
var uidoc = require('../../node_modules/grunt-uidocs-generator/tasks/lib/uidoc.js');
var reader = require('../../node_modules/grunt-uidocs-generator/tasks/lib/reader.js');

var projectPath = path.resolve(__dirname, '../..');
var pkg = require(path.resolve(projectPath, 'package.json'));
Expand Down Expand Up @@ -172,7 +172,7 @@ module.exports = function(grunt) {
});

grunt.registerMultiTask('cut-release', 'Release the built code', function() {
// Require the build and ngdocs tassk to be run first
// Require the build and uidocs task to be run first
grunt.task.requires(['build']);

var options = this.options({
Expand Down Expand Up @@ -370,10 +370,6 @@ module.exports = function(grunt) {

var contents = fs.readFileSync(abspath, 'utf8');

// var d = new ngdoc.Doc(contents);
// d.parse();
// console.log(d);

reader.process(contents, abspath);
});

Expand Down
8 changes: 6 additions & 2 deletions misc/doc/templates/nav.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<ul class="nav navbar-nav navbar-right">
<li><a href="https://github.com/angular-ui/ng-grid/">Github</a></li>
</ul>
<li>
<a href="https://github.com/angular-ui/ui-grid/" title="View on Github">
<span class="icon-github" aria-hidden="true"></span> View on Github
</a>
</li>
</ul>
Loading

0 comments on commit b2aa207

Please sign in to comment.