Skip to content

Commit 6a738aa

Browse files
committed
feat: import path plugin
0 parents commit 6a738aa

19 files changed

+319
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
out
3+
npm-debug.log
4+
/coverage
5+
/test/fixture/esdoc

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: node_js
2+
sudo: false
3+
node_js:
4+
- "0.12"
5+
script:
6+
- TRAVIS=1 npm run test-es5
7+
install:
8+
- npm install

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## Next
4+
- **Feat**
5+
- First Release

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Ryo Maruyama
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# ESDoc Import Path Plugin
2+
TODO
3+
4+
# Install and Usage
5+
```sh
6+
npm install -g esdoc-importpath-plugin
7+
```
8+
9+
setup ``plugin`` property in ``esdoc.json``
10+
11+
```json
12+
{
13+
"source": "./src",
14+
"destination: "./doc",
15+
"plugins": [
16+
{
17+
"name": "esdoc-importpath-plugin",
18+
"option": {
19+
"replaces": [
20+
{"from": "^src/", "to": "lib"}
21+
]
22+
}
23+
}
24+
]
25+
}
26+
```
27+
28+
execute ESDoc
29+
30+
```json
31+
esdoc -c esdoc.json
32+
```
33+
34+
# LICENSE
35+
MIT
36+
37+
[Ryo Maruyama@h13i32maru](https://twitter.com/h13i32maru)

esdoc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"source": "./src",
3+
"destination": "./out/esdoc",
4+
"test": {
5+
"type": "mocha",
6+
"source": "./test/src"
7+
}
8+
}

package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "esdoc-importpath-plugin",
3+
"version": "0.0.1",
4+
"description": "Import Path Plugin For ESDoc",
5+
"author": "h13i32maru",
6+
"homepage": "https://github.com/esdoc/esdoc-importpath-plugin",
7+
"license": "MIT",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/esdoc/esdoc-importpath-plugin"
11+
},
12+
"scripts": {
13+
"build": "node ./script/build.js",
14+
"test": "node ./script/test.js",
15+
"test-es5": "node ./script/test-es5.js"
16+
},
17+
"dependencies": {
18+
"core-js": "^1.0.1"
19+
},
20+
"devDependencies": {
21+
"babel": "^5.8.20",
22+
"coveralls": "~2.11.2",
23+
"esdoc": "^0.1.4",
24+
"fs-extra": "^0.22.1",
25+
"istanbul": "~0.3.16",
26+
"mocha": "~2.2.5",
27+
"power-assert": "^0.11.0"
28+
},
29+
"keywords": [
30+
"esdoc"
31+
],
32+
"files": [
33+
"out/src",
34+
"README.md"
35+
],
36+
"main": "out/src/Plugin.js"
37+
}

script/build.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env node
2+
var sh = require('./sh');
3+
4+
sh.rm('./out/src');
5+
sh.mkdir('./out/src');
6+
sh.exec('./node_modules/.bin/babel --out-dir out/src src');
7+
8+
// build test
9+
sh.rm('./out/test/src');
10+
sh.mkdir('./out/test/src');
11+
sh.exec('./node_modules/.bin/babel --out-dir out/test/src test/src');

script/sh.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var fs = require('fs-extra');
2+
var path = require('path');
3+
var child_process = require('child_process');
4+
5+
function rm(path) {
6+
fs.removeSync(path);
7+
}
8+
9+
function mkdir(path) {
10+
fs.mkdirs(path);
11+
}
12+
13+
function exec(cmd) {
14+
cmd = cmd.replace(/\//g, path.sep);
15+
child_process.execSync(cmd, {stdio: 'inherit'});
16+
}
17+
18+
function chmod(path, mode) {
19+
fs.chmodSync(path, mode);
20+
}
21+
22+
function cp(src, dst) {
23+
fs.copySync(src, dst);
24+
}
25+
26+
function cd(dst) {
27+
process.chdir(dst);
28+
}
29+
30+
module.exports.rm = rm;
31+
module.exports.mkdir = mkdir;
32+
module.exports.exec = exec;
33+
module.exports.chmod = chmod;
34+
module.exports.cp = cp;
35+
module.exports.cd = cd;

script/test-es5.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env node
2+
var sh = require('./sh');
3+
4+
var mochaOption=" -t 10000 --recursive ./out/test/src -R spec";
5+
6+
sh.exec('node ./script/build.js');
7+
8+
if (process.env.TRAVIS) {
9+
sh.exec('./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- ' + mochaOption + ' && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js');
10+
} else if(process.argv.indexOf('--coverage') !== -1) {
11+
sh.exec('./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- ' + mochaOption);
12+
} else {
13+
sh.exec('./node_modules/.bin/mocha' + mochaOption);
14+
}

0 commit comments

Comments
 (0)