Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
my pkginit config
{
"name": basename.replace(/^node-/, ''),
"version": "0.0.0",
"description": (function (cb) {
var fs = require('fs');
var value;
try {
var src = fs.readFileSync('README.markdown', 'utf8');
value = src.split('\n').filter(function (line) {
return /\s+/.test(line)
&& line.trim() !== basename.replace(/^node-/, '')
;
})[0]
.trim()
.replace(/^./, function (c) { return c.toLowerCase() })
.replace(/\.$/, '')
;
}
catch (e) {}
return prompt('description', value);
})(),
"main": prompt('entry point', 'index.js'),
"dependencies": (function () {
return function (cb) {
var exec = require('child_process').exec;
exec('npmlv -t', function (err, out) {
if (err) return cb(null, {});
var deps = JSON.parse(out.split('\n').filter(function (line) {
return !/^skipping/.test(line);
}).join('\n'));
cb(err, Object.keys(deps).reduce(function (acc, key) {
if (!/_$/.test(key) && key !== 'tap' && key !== 'tape') {
acc[key] = deps[key];
}
return acc;
}, {}));
});
};
})(),
"devDependencies": {
"tape": "~1.0.4"
},
"scripts": {
"test": "tape test/*.js"
},
"repository": {
"type": "git",
"url": "git://github.com/substack/" + basename + ".git"
},
"homepage": "https://github.com/substack/" + basename,
"keywords": prompt(function (s) { return s.split(/\s+/) }),
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": function (cb) {
var fs = require('fs'), path = require('path');
var exists = fs.exists || path.exists;
var licenseFile = process.env.HOME + '/doc/license/mit';
var file = process.cwd() + '/LICENSE';
exists(file, function (ex) {
if (ex) return cb(null, 'MIT');
fs.readFile(licenseFile, function (err, src) {
if (err) return cb(err);
fs.writeFile(file, src);
cb(null, 'MIT');
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.