-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,3 @@ | ||
#!/usr/bin/env node | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
var consoler = require('consoler'); | ||
var docor = require('../index'); | ||
var files = ['README.md', 'LICENSE', '.gitignore', '.npmignore']; | ||
|
||
if (!checkPackage('package.json')) | ||
return consoler.error('Docor.init(); `package.json` file not found'); | ||
|
||
files.forEach(function(file) { | ||
docor.createFile(file, function(err) { | ||
if (err) | ||
return consoler.error(err); | ||
consoler.success(file + ' created'); | ||
}); | ||
}); | ||
|
||
function checkPackage(file) { | ||
return fs.existsSync(path.join(process.cwd(), file)); | ||
} | ||
require('../dist/cli')() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
import consoler from 'consoler' | ||
import docor from './docor' | ||
|
||
const files = ['README.md', 'LICENSE', '.gitignore', '.npmignore'] | ||
|
||
let checkPackage = (file) => { | ||
return fs.existsSync( | ||
path.join(process.cwd(), file) | ||
) | ||
} | ||
|
||
(() => { | ||
if (!checkPackage('package.json')) | ||
return consoler.error('Docor.init(); `package.json` file not found') | ||
|
||
files.forEach((file) => { | ||
docor.createFile(file, (err) => { | ||
if (err) | ||
return consoler.error(err) | ||
|
||
consoler.success(file + ' created') | ||
}) | ||
}) | ||
})() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
var path = require('path'); | ||
var swig = require('swig'); | ||
var templates = path.resolve(__dirname, '../templates'); | ||
import path from 'path' | ||
import swig from 'swig' | ||
|
||
module.exports = render; | ||
const templates = path.resolve(__dirname, '../templates') | ||
|
||
function render(filename) { | ||
export default function(filename) { | ||
if (!filename) | ||
return; | ||
return | ||
|
||
return swig.compileFile( | ||
path.join(templates, filename) | ||
); | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,12 @@ | |
"name": "docor", | ||
"version": "0.3.0", | ||
"description": "a tiny cli tool to create elegant readme by manifest files, like `package.json`, `bower.json` and `manifest.json`", | ||
"main": "index.js", | ||
"main": "dist/docor.js", | ||
"author": "turing <[email protected]>", | ||
"license": "MIT", | ||
"bin": "bin/cli", | ||
"scripts": { | ||
"build": "node_modules/.bin/babel lib --out-dir dist --source-maps", | ||
"example": "cd ./example && ../bin/cli" | ||
}, | ||
"repository": { | ||
|
@@ -27,5 +28,8 @@ | |
"dependencies":{ | ||
"swig": "~1.4.2", | ||
"consoler": "~0.2.0" | ||
}, | ||
"devDependencies": { | ||
"babel": "5.1.11" | ||
} | ||
} |