Skip to content

Commit

Permalink
feat!: refactor
Browse files Browse the repository at this point in the history
BREAKING CHANGE: this module is now Promise only and no longer accepts a
callback parameter
  • Loading branch information
lukekarrys committed Feb 6, 2023
1 parent a3643d4 commit 8b919b7
Show file tree
Hide file tree
Showing 22 changed files with 720 additions and 822 deletions.
25 changes: 8 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@

A node module to get your node module started.

[![Build Status](https://secure.travis-ci.org/npm/init-package-json.svg)](http://travis-ci.org/npm/init-package-json)

## Usage

```javascript
var init = require('init-package-json')
var path = require('path')
const init = require('init-package-json')
const path = require('path')

// a path to a promzard module. In the event that this file is
// not found, one will be provided for you.
var initFile = path.resolve(process.env.HOME, '.npm-init')
const initFile = path.resolve(process.env.HOME, '.npm-init')

// the dir where we're doin stuff.
var dir = process.cwd()
const dir = process.cwd()

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

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

init(dir, initFile, configData, function (er, data) {
// the data's already been written to {dir}/package.json
// now you can do stuff with it
})
```

Or from the command line:

```
$ npm-init
const data = await init(dir, initFile, configData)
// the data's already been written to {dir}/package.json
// now you can do stuff with it
```

See [PromZard](https://github.com/npm/promzard) for details about
Expand Down
9 changes: 0 additions & 9 deletions docs/example/example-basic.js

This file was deleted.

8 changes: 0 additions & 8 deletions docs/example/example-default.js

This file was deleted.

2 changes: 0 additions & 2 deletions docs/example/init/basic-init.js

This file was deleted.

Loading

0 comments on commit 8b919b7

Please sign in to comment.