diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..aa1ec1ea --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.tgz diff --git a/README.md b/README.md index 853cfd07..cbf13dbc 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,7 @@ -# ultraviolet-scripts -Core Ultraviolet scripts +# Ultraviolet-Static -# Configuration -Configure Ultraviolet for both client-hooking & service worker in `uv.config.js` -```javascript -self.__uv$config = { - bare: '/bare/', - prefix: '/service/', - encodeUrl: Ultraviolet.codec.xor.encode, - decodeUrl: Ultraviolet.codec.xor.decode, - handler: '/uv.handler.js', - bundle: '/uv.bundle.js', - config: '/uv.config.js', -}; -``` +Static files/assets used to spin up an Ultraviolet website. +## Packaging -# Example Usage -```javascript -importScripts('/PATHTOSCRIPTS/uv.sw.js'); - -const sw = new UVServiceWorker(); - -self.addEventListener('fetch', event => - event.respondWith( - sw.fetch(event) - ) -); -``` +Run `npm pack` to produce a tgz containing the assets as an NPM package. diff --git a/lib/index.d.ts b/lib/index.d.ts new file mode 100644 index 00000000..8c8c80b0 --- /dev/null +++ b/lib/index.d.ts @@ -0,0 +1 @@ +export const publicPath: string; diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 00000000..bfd5d9a7 --- /dev/null +++ b/lib/index.js @@ -0,0 +1,3 @@ +import { fileURLToPath } from 'url'; + +export const publicPath = fileURLToPath(new URL('../public/', import.meta.url)); diff --git a/package.json b/package.json new file mode 100644 index 00000000..fb80460f --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "name": "ultraviolet-static", + "main": "lib/index.js", + "version": "1.0.0", + "type": "module", + "files": [ + "public", + "lib" + ] +}