Skip to content

lzwme/unpkg

 
 

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.

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.2%
  • Dockerfile 0.8%