Skip to content
/ cdn Public
forked from sab-sachsen/cdn

A CDN service for artifacts connectable to registries

License

Notifications You must be signed in to change notification settings

TomKopp/cdn

 
 

Repository files navigation

SAB Logo


CDN based on UNPKG

This started out as a fork from UNPKG, but has since diverged quite a bit as it has been modified to fulfill our needs:

  • Parameterized Registry URL for a npm compatible registry, like Artifactory or Nexus
  • Static index page, no client and browsing
  • No legacy routes support
  • Limit available scopes optionally, by setting SCOPES environment variable
  • Dockerized with buildable releases/pre-build images
  • Typescript based
  • Build tooling based on esbuild

Usage

Running local stack

  • Optionally provide an .env file, see sample file .env.sample
  • Use correct Node version, as declared in .nvmrc or package.json: nvm use.
  • Install dependencies: npm install
  • Build: npm run build or
  • Start locally in node: node dist/index.js

Run in Docker

You must provide UPLINK_* env vars. You may edit those in the docker-compose file.

You build the server and the image yourself and run it:

$ npm run build
$ docker compose up --build

Linting

This package uses ESLint for linting. You can run the linter with npm run lint.
The ESLint config works out of the box with VS Codes ESLint plugin.

Tests

Run the tests with npm test. Additionally, you can run the tests in watch mode with npm run test:watch.
They are configured to work out of the box with VS Codes Jest plugin.

Limiting available scopes

You can limit the available packages by setting the SCOPES environment variable. This is useful if you want to limit the available packages to a specific scope, e.g. @some-scope. Multiple scopes can be separated by a space, e.g. @scope @another-scope.

If no scope is defined, the whole package name is checked. Thus it is possible to limit the available packages to explicit packages as well, e.g. lit express.

License

As the original UNPKG, this project is licensed under the GNU Affero General Public License.

About

A CDN service for artifacts connectable to registries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 89.8%
  • TypeScript 10.0%
  • Other 0.2%