From eeb7b62dcef131bfbeda8b75026c9220fe5b3812 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Sun, 21 Feb 2016 18:52:19 -0800 Subject: [PATCH] Initial commit --- package.json | 11 +++++ public/favicon.ico | Bin 0 -> 32988 bytes public/index.html | 110 +++++++++++++++++++++++++++++++++++++++++++++ server.js | 18 ++++++++ 4 files changed, 139 insertions(+) create mode 100644 package.json create mode 100644 public/favicon.ico create mode 100644 public/index.html create mode 100644 server.js diff --git a/package.json b/package.json new file mode 100644 index 0000000..ded1e57 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "npmcdn.com", + "version": "1.0.0", + "author": "Michael Jackson", + "license": "MIT", + "main": "server.js", + "dependencies": { + "cors": "^2.7.1", + "express": "^4.13.4" + } +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..4b28f59c3e2bb7f22c8558b9c66bc928b8aab88e GIT binary patch literal 32988 zcmeI23AmM2xqvr{sN{q=pdtqo5wV^mO~tZ%R7Aa|S4FSo5D++<3F^I8jyaE6q1n{{ zhpw49ltW1hC~As{A{L1xI0TA{pj;J6>V40%KU)2FPiM2w0e$}Od0y7H*80}B=HcIm zLZL&UW1+dZK-ja;hj3t_Q0UpS7+OkWA5D{a~n_JFll!uGXglfHuUhvDx<#t{yHPqK8NbGyK;un3~>5iTI@2G|}x zY0{4l{TSYZ=x@1jAvWKK&%noBdeMO^;Wa4N-*V|MQ|3bG0UtNnlm?##FF~pPIUesP zd9I6jNjxnxll0SILs;3xHl7H7hO`f%&nNwA=nsEPY@SBn0mi_)NqUqsoC-$)H{D7n z+`@%nFd5P|hyEeyH-i0EI>GZ0`OlhIlxD));3J6qG<=lw!(la8(PF<31n;s^?Ojaz zJ>Wgh%Ve22huQvnKZLA~vL8GMe}lCD>W=3)*asZT6(K&$?tpCDB0iqHuR_`{qAgOb z|6%7G4~9n|{HEbj(ra2Dxj zLwBfE>g|8{|1^qingeNDLVua`bD#<8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iPFdE!@<>rj6$5K?-VYD7 zXobRO3GV=HUV*_-O*|9+43^Q)&XCIEL>@{L(7y;1z%qXX@6fFDCt(t3^Azk2rKFVq zu=Bik{PZyqb_B(-bAP&j+>@20lK&{@8SDMy_1 zn$+t5C>-gt3B2Fb9lvT)tAE#tKDUM4iux{u)udMc%{bD(J_i-`&k&~KIXD>BOcHDL zA7kI8!y?eH;`?GQ*eBls$^qcMGfk|c)IKG-MLP5EVmKehf@2ZldAShu^D=nmsN41f z;b8C_Fzsn@{<7j3<`{UM-wV$|NE3?ZujK>Rb5^X!I<=Vw?tT4+JdbiaJOREtI=~Q^ z1>rZs>7-o*y&)@(-IJj042XR?9{pi(TurwgZ6?4#u-vb~ag2K2N5293Lss@7VG?NT zy!{1S&#u8Je=2%bwkF|Bcn-qO@P2TP)AdWVjn`bBN|KVkO}Y7;nizXH$aZcs_q zBh$5b3%m>ZSO8;SEX)JbZ0}FNbHII5kE}%@=k9uV1N5y=$I5+FQTmW;V|zlK@1)OB z)OCIvd=_ezEifDl?p4>?%%VP;unEe^24q|bv*5?j70!dRz&z*EJkO=|A!Id_Q^2~M zmvpcFfVlP{4$G}zn?`_T{}bjy-214@`SIUxjk#%G%^P_G4ihJOfujGpqr* zk3c>G`3U4AkdHt<0{IB!Ban|kJ_7j&k3c>G f`3U4AkdHt<0{IB!Ban|kJ_7j& + + + npmcdn + + + + +
+

npmcdn

+
+
+

npmcdn is a CDN for packages that are published via npm. Use it to quickly and easily load files using a simple URL like https://npmcdn.com/package@version/path/to/file.

+

A few examples:

+ + +

You may also use a tag or version range instead of a fixed version number, or omit the version/tag entirely to use the latest tag.

+ + +

If you omit the file path, the main module will be returned. This is especially useful for loading libaries that publish a UMD build as their main module.

+ + +

If you use the special /bower.zip file path in a package that contains a bower.json file, a zip file will be created on the fly that Bower can use to install the package.

+ + +

Please note: We do NOT recommend JavaScript libraries use Bower. Bower places additional burdens on JavaScript package authors for little to no gain. npmcdn is intended to make it easier to publish code, not harder, so Bower support will be removed in January 2017. Please move to npm for installing packages and stop using Bower before that time. See here for our rationale.

+ +

Query Parameters

+ + + + + + + + + + + + + + + +
NameDefault ValueDescription
mainmainThe name of the field in package.json to use as the main entry point when there is no file path in the URL. This value may be dot-separated to specify a nested field (e.g. ?main=config.browserMain).
+ +

Suggested Workflow

+

For npm package authors, npmcdn relieves the burden of publishing your code to a CDN in addition to the npm registry. All you need to do is include your UMD build in your npm package (not your repo, that's different!).

+

You can do this easily using the following setup:

+
    +
  • Add the umd (or dist) directory to your .gitignore file
  • +
  • Make sure you have a separate .npmignore file that does not list the umd directory. If you don't have an .npmignore, npm will attempt to ignore everything in your .gitignore when you npm publish
  • +
  • Use a build script to generate your UMD build in the umd directory just before you publish. Your first thought might be to use npm's prepublish script for that, but I'd recommend you just use a separate build script, like this one because prepublish can also run when you don't expect it to
  • +
  • That's it! Now when you npm publish you'll have a version available on npmcdn as well
  • +
+ +

Feedback

+

If you think this is useful, I'd love to hear from you. Please reach out to @mjackson with any questions/concerns.

+

Also, please feel free to examine the source on GitHub.

+
+ + diff --git a/server.js b/server.js new file mode 100644 index 0000000..1037725 --- /dev/null +++ b/server.js @@ -0,0 +1,18 @@ +var port = process.env.PORT || 5000 + +var express = require('express') +var createRequestHandler = require('npm-http-server').createRequestHandler +var cors = require('cors') + +var app = express() + +app.disable('x-powered-by') +app.use(cors()) +app.use(express.static('public', { maxAge: 60000 })) +app.use( + createRequestHandler() +) + +app.listen(port, function () { + console.log('Server started on port ' + port + '. Ctrl+C to quit') +})