2
2
3
3
A node module to get your node module started.
4
4
5
- [ ![ Build Status] ( https://secure.travis-ci.org/npm/init-package-json.svg )] ( http://travis-ci.org/npm/init-package-json )
6
-
7
5
## Usage
8
6
9
7
``` javascript
10
- var init = require (' init-package-json' )
11
- var path = require (' path' )
8
+ const init = require (' init-package-json' )
9
+ const path = require (' path' )
12
10
13
11
// a path to a promzard module. In the event that this file is
14
12
// not found, one will be provided for you.
15
- var initFile = path .resolve (process .env .HOME , ' .npm-init' )
13
+ const initFile = path .resolve (process .env .HOME , ' .npm-init' )
16
14
17
15
// the dir where we're doin stuff.
18
- var dir = process .cwd ()
16
+ const dir = process .cwd ()
19
17
20
18
// extra stuff that gets put into the PromZard module's context.
21
19
// In npm, this is the resolved config object. Exposed as 'config'
22
20
// Optional.
23
- var configData = { some: ' extra stuff' }
21
+ const configData = { some: ' extra stuff' }
24
22
25
23
// Any existing stuff from the package.json file is also exposed in the
26
24
// PromZard module as the `package` object. There will also be three
@@ -29,16 +27,9 @@ var configData = { some: 'extra stuff' }
29
27
// * `basename` the tip of the package dir
30
28
// * `dirname` the parent of the package dir
31
29
32
- init (dir, initFile, configData, function (er , data ) {
33
- // the data's already been written to {dir}/package.json
34
- // now you can do stuff with it
35
- })
36
- ```
37
-
38
- Or from the command line:
39
-
40
- ```
41
- $ npm-init
30
+ const data = await init (dir, initFile, configData)
31
+ // the data's already been written to {dir}/package.json
32
+ // now you can do stuff with it
42
33
```
43
34
44
35
See [ PromZard] ( https://github.com/npm/promzard ) for details about
0 commit comments