Skip to content

Commit 8b919b7

Browse files
committed
feat!: refactor
BREAKING CHANGE: this module is now Promise only and no longer accepts a callback parameter
1 parent a3643d4 commit 8b919b7

22 files changed

+720
-822
lines changed

README.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,23 @@
22

33
A node module to get your node module started.
44

5-
[![Build Status](https://secure.travis-ci.org/npm/init-package-json.svg)](http://travis-ci.org/npm/init-package-json)
6-
75
## Usage
86

97
```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')
1210

1311
// a path to a promzard module. In the event that this file is
1412
// 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')
1614

1715
// the dir where we're doin stuff.
18-
var dir = process.cwd()
16+
const dir = process.cwd()
1917

2018
// extra stuff that gets put into the PromZard module's context.
2119
// In npm, this is the resolved config object. Exposed as 'config'
2220
// Optional.
23-
var configData = { some: 'extra stuff' }
21+
const configData = { some: 'extra stuff' }
2422

2523
// Any existing stuff from the package.json file is also exposed in the
2624
// PromZard module as the `package` object. There will also be three
@@ -29,16 +27,9 @@ var configData = { some: 'extra stuff' }
2927
// * `basename` the tip of the package dir
3028
// * `dirname` the parent of the package dir
3129

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
4233
```
4334

4435
See [PromZard](https://github.com/npm/promzard) for details about

docs/example/example-basic.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/example/example-default.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/example/init/basic-init.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)