Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing "filename" requirement for autoupdate #6765

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Expand Up @@ -85,7 +85,7 @@

4. For those libs can use auto-update, you should add [auto-update config](https://github.com/cdnjs/cdnjs#enabling-gitrecommended-or-npm-auto-update) for it, but as the first pull request to add a lib, you should still add its real files, or you won't pass the test.

### d. adding a new library
### d. Adding a new library

1. Libraries are stored in the ajax/libs directory. Each library has its own subdirectory of ajax/libs and each version of the library has its own subdirectory of the library directory name, for example:
> /ajax/libs/jquery/2.0.0/
Expand All @@ -94,6 +94,7 @@
* If there is an official `package.json`, please try to follow the official version, the best way is just copy from the official and do a little modification of it.
* If there is **not** an official `package.json`, please **create** it by yourself, you should refer to [doc of package.json](https://www.npmjs.org/doc/package.json.html) orother lib's `package.json`, and the data should be as close as official data as possible.
* If you will **create** its `package.json`, the indent of it **must** be `2 spaces`, others will be fine to follow official version or to use 2 spaces.
* Please include a `filename` property that points to the main minified file within the cdnjs target directory. If the file is in a subfolder, include it with the filename (e.g. `"filename" : "js/index.js"`).
* Please use [JSONLint](http://jsonlint.com/) to validate your `package.json`.

3. We use the directory/folder name and `name` property in `package.json` to identify a library, so this two string should be **totally** equal.
Expand Down
5 changes: 5 additions & 0 deletions documents/autoupdate.md
Expand Up @@ -5,6 +5,7 @@ cdnjs automatically updates libraries that are known to be hosted on `npm` or gi
To add `git` auto-update config to a library, update the `package.json` with configuration details and submit your pull request. An example configuration:

```js
"filename": "underscore-min.js",
"autoupdate": {
"source": "git",
"target": "git://github.com/jashkenas/underscore.git",
Expand All @@ -20,6 +21,7 @@ To add `git` auto-update config to a library, update the `package.json` with con
To add an `npm` hook to a library, update the `package.json` with configuration details and submit your pull request. An example configuration:

```js
"filename": "function-plot.min.js",
"npmName": "function-plot",
"npmFileMap": [
{
Expand All @@ -32,6 +34,7 @@ To add an `npm` hook to a library, update the `package.json` with configuration
```

* Please __don't__ touch `version` number in this step, it'll be automatically updated
* `filename` must point to a minified file within the cdnjs target directory. If the file is in a subfolder, then include the folder (e.g. `"js/function-plot.min.js"`)
* `npmName` should map to the name of the library on `npm`
* `npmFileMap` is a list of files to take from the `npm` tarball and host on cdnjs
* `basePath` will be ignored when copying over to the CDN
Expand All @@ -43,6 +46,7 @@ The above example looks in the tarball whose structure might look like this:
```
|__dist
| |__function-plot.js
| |__function-plot.min.js
|__bower.json
|__index.js
|__site.js
Expand All @@ -64,6 +68,7 @@ The auto-update process will look for `dist` inside the named tarball and copy a
|__function-plot
|__x.y.z
|__function-plot.js
|__function-plot.min.js
```

...where `x.y.z` is the version number, extracted from the `package.json` on npm.
Expand Down