#CN
CDNJS是库镜像图书馆的所有资产cdnjs.cloudflare.com。
托马斯·戴维斯和瑞安Kirkman创建CDNJS,把freyling和彼得你好戴夫是维护人员。胡安Gallardo是我们的社区版主。
CDNJS将举办任何JavaScript和CSS库的任何生产版本,受许可权限。
- 图书馆必须有显著的受欢迎程度:100星/观察家在GitHub上,或超过500次的下载每月NPM的属性都是很好的例子,但只要合理的普及可以证明图书馆将增加。
- β,α发布候选版本,通常不考虑准备充分的生产现状。对于图书馆的预发布版本的要求五月被同行评议后下降。
- 我们会接受β,α发布候选版本,如果您使用我们的NPM / git自动更新机制,如果你真的想要它,请设置自动更新该库。
请提高图书馆新增加一个新的和现有的库拉请求更新,按照下面的说明。
- 所有新的图书馆主办的CDNJS应该有一个官方的公共库或新包装,和正式的预建配置文件(S)也应该有,所以我们可以应用在库的自动更新mechanishm。
- 注意,你应该有一个
文件名
指自民党的主要文件,如果文件不缩小,请仍用filename.min.js
或filename.min.css
结构的命名,我们会缩小工作。
CDNJS依靠用户提交的请求和自动更新新公共管理
或Git
库来填充和更新图书馆。
添加一个新的图书馆,或更新现有的图书馆外新公共管理
/Git
,开始分叉的CDNJS回购你自己的GitHub账户。
如果你添加/修改GitHub的浏览器界面之外,例如在命令行或GitHub的桌面应用程序,您将需要另外安装结
(Node.js
)本地,这样你可以运行测试或工具下工具
局部。
当你有分叉的CDNJS回购,它把你的图书馆。图书馆存储在AJAX / libs
目录每个图书馆都有它自己的子目录AJAX / libs
每个版本的图书馆有它自己的子目录,图书馆的目录名称,例如:
jQuery的AJAX库/ / / / / 2.0.0
“ionicabizau写一个NodeJS命令行工具的自动化新库添加过程。这个工具被命名为CDNJS进口商它是开源的
更多关于这个进口商的信息,请查看库文件。
你应该考虑以下时添加或更新库,使我们能够保持我们的项目整洁、干净:
文件名应该不包括版本号。
- 这是好的:
useful.min.js
,但这不是:useful-2.0.1.min.js
。
- 这是好的:
JavaScript和CSS文件应该缩小减少网络流量和浏览器的开销。
- 如果图书馆已经不提供一个缩小版,缩小镜是JavaScript CDNJS的首选uglifyjs
如果您正在更新库,请尽量保持一致性,与现有的文件和目录结构。
- 有时,特别是在主要版本的增量,这是不现实的。
你应该与我们的主分支新尽可能同步你的本地仓库,尽量使犯父母是新的。
- 请使用
git pull --垫底
而不是git pull
,使用git rebase上游/硕士
而不是git merge上游/硕士
,这样可以避免无谓的合并。
- 请使用
只做一有意义的在一个承诺的事情,不要将不同的东西到相同的承诺,如添加一个提交两库。
每一条应该是有意义的,不要把一件事分成多条,像在3添加lib犯。
检查你的工作
差异比较
&git status
在提交你的改变。检查你的承诺
git log -统计
&git log P
在发送pull请求。
每个图书馆都有相应的package.json
,写在新公共管理
格式(见测试/模式/ npm-package.json
详情或使用另一个package.json
婴儿床-它非常明显),我们使用文件名
场package.json
指向一个库的主要的工艺文件,这个字段将被要求。当一个现有的库更新,细节package.json
应更新所需的地方。
例如,如果添加一个新版本的库,版本号可能需要改变。同样的,如果你加入新公共管理
更新到图书馆的信息,这是在做package.json
。
如果你更新图书馆外新公共管理
或GitHub的浏览器,你应该运行NPM试验
从图书馆目录,确保一切都好。
如果你运行NPM试验
看到没有错误,一切都是好的;解决任何错误在你提出你的要求并重新运行拉NPM试验
确保一切正常。
如果你看到一个错误,然后运行NPM安装
在跑步前NPM试验
:
誓言:命令没有找到
NPM犯错!测试失败。上面看到的更多细节。
NPM!不好的代码0
- 你有没有遵守我们的约定?
- 你跟着图书馆目录结构?
- 没有一个有效的和准确的
package.json
存在for the library吗? - 你有缩小的JavaScript和CSS?
- 做
NPM试验
看看好吗?
如果是这样的话,大!你准备提高拉请求。
请把请求一个库。您可以包括> 1版本在单拉要求图书馆。
从维护的角度来看,它更简单的过程拉要求有一个承诺一个图书馆。
在你把请求的标题,告诉我们你在做什么。
如果你是图书馆的作者,请加
[作者]
对拉请求标题。如果你添加一个新的库,请添加
新
对拉请求标题。
请在你拉的要求如下:
- 例如,在你下载的版本
URL是理想的。提供文件的起源是很有帮助的CDNJS项目同行评议。实际上,这也有助于我们更有效地处理你的拉力要求,这意味着你的文件去住不久。帮助我们,我们会帮你找回来。
看到api.md
#EN # cdnjs Library Repositorycdnjs is the repository mirroring all library assets on cdnjs.cloudflare.com.
Thomas Davis and Ryan Kirkman created cdnjs, Drew Freyling and Peter Dave Hello are maintainers. Juan Gallardo is our community moderator.
cdnjs will host any production version of any JavaScript/CSS library, subject to license permissions.
- Libraries must have notable popularity: 100 stars/watchers on GitHub, or more then 500 times download per month on npm stats are both good examples, but as long as reasonable popularity can be demonstrated the library will be added.
- Beta, release candidate and alpha releases are not usually considered ready for full production status. Requests for pre-release versions of libraries may be declined after peer review.
- We'll accept beta, release candidate and alpha releases if you are using our npm/git auto-update mechanism, if you really want it, please setup auto-update for that lib.
Please raise a new pull request for new library additions and existing library updates, following the instructions below.
- All new libraries hosted on CDNJS should have a official public repository or npm package, and the officially pre-built distribution file(s) should also be there, so that we can apply the auto-update mechanishm on that lib.
- Now CDNJS supports adding a library by a single package.json, you just need to add a valid CDNJS package.json with npm/git auto-update config, and remove its version field in package.json, then we'll handle the remaining works.
- Notes that you should have a
filename
to point to the main file of a lib, if that file is not minified, please still usefilename.min.js
orfilename.min.css
structure naming, we'll do the minify job.
- Notes that you should have a
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 to your own GitHub account.
If you're adding/modifying outside of the GitHub browser interface, for example on the command line or with the GitHub desktop application, you will need to additionally install node
(node.js
) locally, so that you can run the test or utils under tools
locally.
When you have forked the cdnjs repo, add your library to it. 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/
@IonicaBizau wrote a NodeJS command line tool for automating the adding process of a new library. This tool is named cdnjs-importer and it's open source
For more information regarding this importer, please check out the repository documentation.
You should consider the following when adding to or updating the library, so that we can keep our project neat, clean and clear:
-
Filenames should not include a version number.
- This is OK:
useful.min.js
, but this is not:useful-2.0.1.min.js
.
- This is OK:
-
JavaScript & CSS files should be minified to reduce network traffic and browser overhead.
- If the library doesn't already provide a minified version, cdnjs's preferred JavaScript minifier is UglifyJS
-
If you are updating a library, please try to maintain consistency with the existing file and directory structure.
- There will be occasions, particularly with major version increments, where this is not practical.
-
You should sync your local repository with our master branch as new as possible, try to make the commits' parent be new.
-
Please use
git pull --rebase
instead ofgit pull
, usegit rebase upstream/master
instead ofgit merge upstream/master
, so that we can avoid of meaningless merging. -
Only do one meaningful thing in one commits, don't mix different things into the same commit, like add two libs in a commit.
-
Every commits should be meaningful, don't cut one thing into multiple commits, like add a lib in 3 commits.
-
Inspect your work by
git diff
&git status
before commit your change. -
Inspect your commit by
git log --stat
&git log -p
before sending a pull request.
Each library has a corresponding package.json
, written in npm
format (see test/schemata/npm-package.json
for details or use another package.json
to crib from - it's pretty self-explanatory), and we use filename
field in package.json
to point to the mainfile of a lib, this field will be required. When an existing library is updated, the details in package.json
should be updated where required.
For example, if a new version of the library is added, the version number may need changing. Likewise, if you're adding npm
update information to a library, this is done in package.json
.
If you're updating the library outside of npm
or the GitHub browser, you should run npm test
from the library directory to ensure everything is OK.
If you run npm test
and see no errors, all is well; resolve any errors before you raise your pull request and re-run npm test
to ensure everything works.
If you see an error then run npm install
before running npm test
:
vows: command not found
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
- Have you complied with our conventions?
- Have you followed the library directory structure?
- Does a valid and accurate
package.json
exist for the library? - Have you minified JavaScript and CSS?
- Did
npm test
check out OK?
...if so, great! You're ready to raise a pull request.
Please restrict your pull request to one library. You can include >1 version/release of a library in a single pull request.
From a maintenance standpoint, it's much more straightforward to process pull requests where there is one commit for one library.
In your pull request title, tell us what you're doing.
-
If you are the author of the library, please add
[author]
to the pull request title. -
If you are adding a new lib, please add
[new]
to the pull request title.
Please include the following in your pull request:
- The origin of your new files
- e.g., where you downloaded the version from
A URL is ideal. Providing the origin of your files is very helpful as the cdnjs project is peer-reviewed. Practically speaking, it also helps us process your pull request more efficiently, which means your files go live sooner. Help us and we'll help you back.
See autoupdate.md
See api.md