1.0.1 • Published 7 years ago
@kingjs/create-package v1.0.1
@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:
$ cpkProduces 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 JsDocdescriptionfound in themainjs 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/packageor
$ npm install -g @kingjs/create-package
$ cpkExecute
With npx installed, run
$ npx @kingjs/create-packageLicense
MIT
1.0.1
7 years ago