Skip to content

Commit

Permalink
Update the DOC about adding libs via package.json
Browse files Browse the repository at this point in the history
[no-ci], close #7793
  • Loading branch information
maruilian11 committed Nov 27, 2016
1 parent 9926dad commit 2ef2d1d
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions README.md
Expand Up @@ -30,6 +30,61 @@ Please raise a new pull request for new library additions and existing library u

## Adding a new or updating an existing library

There is a simple way to add a library via single package.json only.

You can follow these steps:

1. Fork cdnjs repository to your GitHub account.

2. Create a new folder named **libname** under `/ajax/libs`, then create a package.json under `/libname`.

> A tip: you can type `/libname/package.json` after cdnjs/ajax/libs/ to create them if you use web interface
> Note: the libname must match the name in package.json
3. Edit package.json:

take the npm package lib `frzr` for an example:
```js
{
"name": "frzr",
"description": "Turboboosted 2 KB view library",
"homepage": "https://frzr.js.org",
"repository": {
"type": "git",
"url": "git://github.com/pakastin/frzr"
},
"author": "Juha Lindstedt",
"license": "ISC",
"keywords": [
"frzr",
"tiny",
"view"
],
"filename": "frzr.min.js",
"npmName": "frzr",
"npmFileMap": [
{
"basePath": "dist",
"files": [
"frzr*.js"
]
}
]
}
```
you can change to use git auto-update, [autoupdate.md](https://github.com/cdnjs/cdnjs/blob/master/documents/autoupdate.md#enabling-npmrecommended-or-git-auto-update)

* Please don't add version in package.json if you don't want to commit with its assets.
* Please use [SPDX](https://spdx.org/licenses/) in license, [license-list.json](https://github.com/cdnjs/cdnjs/blob/master/tools/license-list.json).
* Please point to minified file in filename.

4. Submit the package.json.

5. Create a pull request.

We will merge the PR when it achieves the requirements.

cdnjs relies on user-submitted pull requests and automatic updating via `npm` or `git` repository to populate and update libraries.

To add a new library, or update an existing library outside of `npm`/`git`, start by [forking the cdnjs repo](https://github.com/cdnjs/cdnjs/fork) to your own GitHub account.
Expand Down

0 comments on commit 2ef2d1d

Please sign in to comment.