Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjrv committed Mar 19, 2016
0 parents commit a8d884c
Show file tree
Hide file tree
Showing 12 changed files with 151 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
typings/
*.js
*.d.ts
*.log.*
*.log
*.tgz
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
typings/
test/
src/
.travis.yml
*.log.*
*.log
*.tgz
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js

node_js:
- "5.6"
- "4.3"
- "0.12"
- "0.10"

install: npm link
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2016 BusFaster Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
docts
=====

[![build status](https://travis-ci.org/charto/docts.svg?branch=master)](http://travis-ci.org/charto/docts)
[![npm version](https://img.shields.io/npm/v/docts.svg)](https://www.npmjs.com/package/docts)

License
=======

[The MIT License](https://raw.githubusercontent.com/charto/docts/master/LICENSE)

Copyright (c) 2016 BusFaster Ltd
3 changes: 3 additions & 0 deletions docts-cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

require('./dist/cli.js');
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "docts",
"version": "0.0.1",
"description": "README.md API section autogenerator for TypeScript projects",
"main": "dist/docts.js",
"typings": "dist/docts.d.ts",
"bin": {
"docts": "docts-cli.js"
},
"scripts": {
"tsc": "tsc",
"typings": "typings",
"prepublish": "typings install && tsc",
"test": "npm link docts && docts --help"
},
"author": "Juha Järvi",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/charto/docts.git"
},
"bugs": {
"url": "https://github.com/charto/docts/issues"
},
"homepage": "https://github.com/charto/docts#readme",
"devDependencies": {
"typescript": "^1.8.7",
"typings": "~0.7.9"
},
"dependencies": {
"readts": "0.0.1"
}
}
22 changes: 22 additions & 0 deletions src/Patcher.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// This file is part of docts, copyright (c) 2016 BusFaster Ltd.
// Released under the MIT license, see LICENSE.

import * as path from 'path';
import {Parser} from 'readts';

export function patchReadme(basePath: string) {
var parser = new Parser();

var packagePath = path.resolve(basePath, 'package.json');
var tsconfigPath = path.resolve(basePath, 'tsconfig.json');

var config = parser.parseConfig(tsconfigPath);

var pkgJson = require(packagePath);
var dtsPath = path.resolve(basePath, pkgJson.typings);

config.options.noEmit = true;
config.fileNames = [ dtsPath ];

console.log(JSON.stringify(parser.parse(config), null, 4));
}
6 changes: 6 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file is part of docts, copyright (c) 2016 BusFaster Ltd.
// Released under the MIT license, see LICENSE.

import {patchReadme} from './Patcher';

patchReadme(process.cwd());
4 changes: 4 additions & 0 deletions src/docts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// This file is part of docts, copyright (c) 2016 BusFaster Ltd.
// Released under the MIT license, see LICENSE.

export {patchReadme} from './Patcher';
17 changes: 17 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"declaration": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"outDir": "dist",
"removeComments": false,
"target": "es5"
},
"files": [
"typings/main.d.ts",

"src/cli.ts"
]
}
8 changes: 8 additions & 0 deletions typings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "docts",
"version": false,
"dependencies": {},
"ambientDependencies": {
"node": "registry:dt/node#4.0.0+20160317120654"
}
}

0 comments on commit a8d884c

Please sign in to comment.