@kingjs/create-package
v1.0.1
Published
Creates or updates fields of `package.json` that can be inferred from the surrounding environment.
Downloads
1
Readme
@kingjs/create-package
Creates or updates fields of package.json
that can be inferred from the surrounding environment.
Usage
Given a package.json
at a relative path create-package/example
like this:
{
"name": "",
"version": "1.0.0",
"description": "",
"main": "index.js",
"files": [
"*.js"
],
"repository": {
"type": "git",
"url": ""
},
"license": "MIT",
"dependencies": {
}
}
And a index.js
like this:
/**
* @description A description of the package.
*/
function example() { }
Running this:
$ cpk
Produces a package.json
like this:
{
"name": "@kingjs/create-package.example",
"version": "1.0.0",
"description": "A description of the package.",
"main": "index.js",
"files": [
"*.js"
],
"repository": {
"type": "git",
"url": "https://repository.kingjs.net/create-package/example"
},
"license": "MIT",
"dependencies": {}
}
API
createPackage()
Remarks
The following are harvested from environment:
description
: The first JsDocdescription
found in themain
js file.name
: A join with period of the relative path of this package in the repository.repository.url
:https://repository.kingjs.net/
plus a join with forward slash of the relative paths in the repository.
Install
With npm installed, run
$ npm init @kingjs/package
or
$ npm install -g @kingjs/create-package
$ cpk
Execute
With npx installed, run
$ npx @kingjs/create-package
License
MIT