Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 71 lines (54 sloc) 1.225 kB
5fffa47 @substack initial thing seems to work, doesn't hang anymore
authored
1 pkginit
2 =======
3
3946b61 @substack generated a package.json with pkginit itself
authored
4 Script building package.json files, like `npm init`.
5fffa47 @substack initial thing seems to work, doesn't hang anymore
authored
5
6 example
7 =======
8
9 Create a default.json using
10 [prompter syntax](https://github.com/substack/node-prompter#readme)
11 to serve as the basis for whenever you type `pkginit`:
12
13 ``` js
14 {
b07fc13 @substack updated docs
authored
15 "name": basename.replace(/^node-/, ''),
16 "description": prompt(),
5fffa47 @substack initial thing seems to work, doesn't hang anymore
authored
17 "version": "0.0.0",
18 "repository": {
b07fc13 @substack updated docs
authored
19 "url": "git://github.com/substack/" + basename + ".git"
5fffa47 @substack initial thing seems to work, doesn't hang anymore
authored
20 },
b07fc13 @substack updated docs
authored
21 "main": prompt('entry point', 'index.js'),
5fffa47 @substack initial thing seems to work, doesn't hang anymore
authored
22 "scripts": {
23 "test": "tap test/*.js"
24 },
25 "dependencies": {},
26 "devDependencies": {
27 "tap": "~0.2.5"
28 }
29 }
30 ```
31
32 Then add this file as the default:
33
34 ```
35 $ pkginit add default default.json
36 ```
37
38 Now when you type `pkginit`, you will only be prompted for the entries you've
39 scripted:
40
41 ```
42 $ mkdir beep-boop; cd beep-boop
43 $ pkginit
44 description: make beep and boop sounds
45 entry point: (index.js)
46 ```
47
48 variables
49 =========
50
51 In packages, these variables are availble:
52
53 * basename - shorthand for `path.basename(process.cwd())`
54 * process - node's `process`
b07fc13 @substack updated docs
authored
55 * require - node's `require`, rebased to `process.cwd()`
5fffa47 @substack initial thing seems to work, doesn't hang anymore
authored
56 * env - shorthand for `process.env`
b07fc13 @substack updated docs
authored
57
58 install
59 =======
60
61 With [npm](http://npmjs.org) do:
62
63 ```
e8e17b7 @substack -g since it's a command
authored
64 npm install -g pkginit
b07fc13 @substack updated docs
authored
65 ```
66
67 license
68 =======
69
70 MIT
Something went wrong with that request. Please try again.