Skip to content

Commit

Permalink
prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
e9x committed Sep 13, 2022
1 parent 6cec2d4 commit 83669f9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tgz
31 changes: 4 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const publicPath: string;
3 changes: 3 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { fileURLToPath } from 'url';

export const publicPath = fileURLToPath(new URL('../public/', import.meta.url));
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "ultraviolet-static",
"main": "lib/index.js",
"version": "1.0.0",
"type": "module",
"files": [
"public",
"lib"
]
}

0 comments on commit 83669f9

Please sign in to comment.