Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add readme template for component-create(1) with more boilerplate

  • Loading branch information...
commit 68f68f2299920af4288c322a4da09aad3df7a858 1 parent 1b7ea04
@tj tj authored
View
3  Makefile
@@ -1,4 +1,7 @@
+templates/readme.js: templates/readme.md
+ ./node_modules/.bin/minstache < $< > $@
+
test:
@./node_modules/.bin/mocha \
--require should \
View
5 bin/component-create
@@ -11,7 +11,8 @@ var program = require('commander')
, fs = require('fs')
, join = path.join
, read = fs.readFileSync
- , mkdir = require('mkdirp').sync;
+ , mkdir = require('mkdirp').sync
+ , readme = require('../templates/readme');
// usage
@@ -95,7 +96,7 @@ program.prompt({
write(join(dir, 'Makefile'), createMakefile(obj));
// readme
- write(join(dir, 'Readme.md'), '\n# ' + name + '\n\n ' + obj.desc + '\n\n');
+ write(join(dir, 'Readme.md'), readme(obj));
// .gitignore
write(join(dir, '.gitignore'), 'components\nbuild\n');
View
1  package.json
@@ -23,6 +23,7 @@
"debug": "*"
},
"devDependencies": {
+ "minstache": "0.0.1",
"mocha": "*",
"should": "*"
},
View
20 templates/readme.js
@@ -0,0 +1,20 @@
+module.exports = function anonymous(obj) {
+
+ function escape(html) {
+ return String(html)
+ .replace(/&/g, '&amp;')
+ .replace(/"/g, '&quot;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;');
+ };
+
+ function section(obj, prop, negate, str) {
+ var val = obj[prop];
+ if ('function' == typeof val) return val.call(obj, str);
+ if (negate) val = !val;
+ if (val) return str;
+ return '';
+ };
+
+ return "\n# " + escape(obj.name) + "\n\n " + escape(obj.desc) + "\n\n## Installation\n\n $ component install " + escape(obj.repo) + "\n\n## API\n\n \n\n## License\n\n MIT\n"
+}
View
16 templates/readme.md
@@ -0,0 +1,16 @@
+
+# {name}
+
+ {desc}
+
+## Installation
+
+ $ component install {repo}
+
+## API
+
+
+
+## License
+
+ MIT
Please sign in to comment.
Something went wrong with that request. Please try again.