https://github.com/npm/create-oss
init module used for OSS projects by the npm CLI team
https://github.com/npm/create-oss
npm-cli open-source oss
Last synced: 9 months ago
JSON representation
init module used for OSS projects by the npm CLI team
- Host: GitHub
- URL: https://github.com/npm/create-oss
- Owner: npm
- License: other
- Archived: true
- Created: 2019-09-23T15:30:26.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-09-24T16:37:16.000Z (over 1 year ago)
- Last Synced: 2024-09-24T16:55:11.915Z (over 1 year ago)
- Topics: npm-cli, open-source, oss
- Language: JavaScript
- Homepage:
- Size: 194 KB
- Stars: 10
- Watchers: 11
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# `@npmcli/create-oss`
This is a module designed to be consumed with `npm init @npmcli/oss`.
It creates a `package.json` containing some default fields for the npm CLI team.
## Usage
```
> mkdir foo
> cd foo
> npm init @npmcli/oss
```
### `package.json`
The default `package.json` is defined in `lib/defaults.js` and looks like the following:
```
const prompt = require('./prompt.js')
const defaults = {
name: prompt({
default: (_, { path }) => `@npmcli/${basename(path)}`,
edit: true,
}),
version: '1.0.0',
description: prompt(),
main: 'lib/index.js',
keywords: ['npm', 'oss'],
}
```
#### Prompting
The `prompt` function accepts any options allowed by [read](https://github.com/npm/read#readme)
with a few minor tweaks.
If a `prompt` option is not specified, it will default to the name of the field being prompted for.
As an example, in the above defaults the prompt for the description field will be `description:`.
The `default` option may be set to a value, or a function. If a function is used, it will be called
with the name of the property and the options object. The result is awaited, so async functions can
be used as well as sync.