Skip to content

Commit ffabeae

Browse files
committed
search specs folder by default, update docs
1 parent 878b596 commit ffabeae

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Spec Dependencies is [SourceJS](http://sourcejs.com) plugin for adding crosslink
66

77
![image](http://monosnap.com/image/gG9KatayyGGg5BxYt3704OIIQHUg0V.png)
88

9-
Compatible with SourceJS v0.4+.
9+
Compatible with SourceJS v0.4.x-0.5.x (not compatible with SourceJS installed as NPM dep).
1010

1111
## Install
1212

@@ -22,10 +22,34 @@ Then run Grunt update in SourceJS root:
2222
grunt update
2323
```
2424

25-
After install, entering spec pages you will se prediction box.
25+
or from 0.5.2+
26+
27+
```
28+
npm run build
29+
```
30+
2631

2732
## How to use
2833

34+
### Configuration
35+
36+
By default plugin will parse documentation pages located in `user/specs` folder, to extend the search folder list, update plugin options in `user/options.js`:
37+
38+
```
39+
{
40+
plugins: {
41+
specDependenciesTree: {
42+
includedDirs: ['specs', 'more-specs']
43+
}
44+
}
45+
}
46+
```
47+
48+
This conf will ensure that plugin checks both `user/specs` and `user/more-specs` folders to build the dependency tree.
49+
50+
51+
### Manually set spec dependencies
52+
2953
Spec Dependencies automatically predicts all specs, that used in current spec by comparing CSS classes names with existing Spec names. If you also want to see next section to check which specs use current ("this spec used by"), you have to update `info.json` of the specs with "usedSpecs" property. Value of "usedSpecs" should be an array even for only element.
3054

3155
```

core/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ var fs = require('fs');
22
var deepExtend = require('deep-extend');
33
var path = require('path');
44

5+
var globalConfig = global.opts.plugins && global.opts.plugins.specDependenciesTree ? global.opts.plugins.specDependenciesTree : {};
6+
57
var config = {
6-
includedDirs: [],
8+
includedDirs: ['specs'],
79
outputFile: "data/spec_dependencies_tree.json",
810

911
// cron
@@ -16,8 +18,7 @@ var config = {
1618
sourceRoot: global.opts.core.common.pathToUser
1719
};
1820
// Overwriting base options
19-
deepExtend(config, global.opts.core.specDependenciesTree);
20-
21+
deepExtend(config, global.opts.core.specDependenciesTree, globalConfig);
2122

2223
var specDependenciesTree = function(dir) {
2324
var outputJSON = {},

0 commit comments

Comments
 (0)