Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

lzwme/unpkg

Open more actions menu
 
 

Repository files navigation

UNPKG (fork)

The goals of this fork are:

  • Make it easier to self-host Unpkg.
  • Keep it upstream compatible.
  • Keep dependencies up to date.
  • Make no functional changes or add new features.

UNPKG is a fast, global content delivery network for everything on npm.

Development

prepare:

git clone https://github.com/lzwme/unpkg.git
cd unpkg
pnpm i
cp .env.sample .env.local # and edit the env.local config for local development

dev:

pnpm watch
pnpm serve

Build and deploy

cp .env.sample .env.prod # and edit the env.prod config for production
set NODE_ENV=production # or staging
pnpm build
pnpm pack

A file will be generated like unpkg-<version>.tgz. Deploy it in your server with pm2:

tar zxvf unpkg-<version>.tgz
cd package
npm i --omit dev
# pnpm i -P
pm2 -n unpkg start.js

With Docker

docker pull lzwme/unpkg
docker run -d -p 8080:8080 -e NPM_REGISTRY_URL=https://registry.npmjs.org -e ORGIN=* lzwme/unpkg

Configuration with .env[.prod|.local]

Learn more from the file .env.sample.

# config for private registry url
NPM_REGISTRY_URL=https://registry.npmjs.org

# your unpkg website url
ORIGIN=https://npmcdn.lzw.me
# port to listen on. default 8080
PORT=8080

# enableDebugging
# DEBUG=1

# Google Analytics MEASUREMENT_ID. your can set empty to disable it.
GTAG_MEASUREMENT_ID=UA-140352188-1

# ENABLE_CLOUDFLARE=1
# CLOUDFLARE_EMAIL=test@lzw.me
# CLOUDFLARE_KEY=test

Documentation

Please visit the UNPKG website to learn more about how to use it.

Sponsors

Our sponsors and backers are listed in SPONSORS.md.

About

The CDN for everything on npm

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 99.2%
  • Dockerfile 0.8%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.