@eighty4/dank 0.0.2 → 0.0.4-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@eighty4/dank",
3
- "version": "0.0.2",
3
+ "version": "0.0.4-0",
4
4
  "type": "module",
5
+ "license": "MIT",
6
+ "author": "Adam McKee Bennett <adam.be.g84d@gmail.com>",
5
7
  "description": "Multi-page development system for CDN-deployed websites",
6
8
  "keywords": [
7
9
  "frontend",
@@ -9,6 +11,10 @@
9
11
  "esbuild",
10
12
  "dank"
11
13
  ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/eighty4/dank"
17
+ },
12
18
  "bin": "./lib_js/bin.js",
13
19
  "exports": {
14
20
  ".": {
@@ -37,6 +43,8 @@
37
43
  "build": "tsc && tsc -p tsconfig.client.json && tsc -p tsconfig.exports.json",
38
44
  "fmt": "prettier --write .",
39
45
  "fmtcheck": "prettier --check .",
46
+ "test": "node --test \"test/**/*.test.ts\"",
47
+ "test:rebuild": "pnpm build && pnpm test",
40
48
  "typecheck": "tsc --noEmit"
41
49
  }
42
50
  }
package/lib/manifest.ts DELETED
@@ -1,61 +0,0 @@
1
- import { writeFile } from 'node:fs/promises'
2
- import { extname, join } from 'node:path'
3
-
4
- // catalog of build's filesystem output
5
- export type BuildManifest = {
6
- buildTag: string
7
- files: Array<string>
8
- }
9
-
10
- // functional data for service worker
11
- export type CacheManifest = {
12
- apiRoutes: Array<string>
13
- buildTag: string
14
- files: Array<string>
15
- }
16
-
17
- export async function writeBuildManifest(buildTag: string, files: Set<string>) {
18
- await writeJsonToBuildDir('manifest.json', {
19
- buildTag,
20
- files: Array.from(files).map(f =>
21
- extname(f).length
22
- ? f
23
- : f === '/'
24
- ? '/index.html'
25
- : f + '/index.html',
26
- ),
27
- })
28
- }
29
-
30
- export async function writeJsonToBuildDir(
31
- filename: `${string}.json`,
32
- json: any,
33
- ) {
34
- await writeFile(join('./build', filename), JSON.stringify(json, null, 4))
35
- }
36
-
37
- export async function writeMetafile(filename: `${string}.json`, json: any) {
38
- await writeJsonToBuildDir(
39
- join('metafiles', filename) as `${string}.json`,
40
- json,
41
- )
42
- }
43
-
44
- export async function writeCacheManifest(buildTag: string, files: Set<string>) {
45
- await writeJsonToBuildDir('cache.json', {
46
- apiRoutes: [],
47
- buildTag,
48
- files: Array.from(files).map(filenameToWebappPath),
49
- })
50
- }
51
-
52
- // drops index.html from path
53
- function filenameToWebappPath(p: string): string {
54
- if (p === '/index.html') {
55
- return '/'
56
- } else if (p.endsWith('/index.html')) {
57
- return p.substring(0, p.length - '/index.html'.length) as `/${string}`
58
- } else {
59
- return p
60
- }
61
- }
@@ -1,37 +0,0 @@
1
- import { writeFile } from 'node:fs/promises';
2
- import { extname, join } from 'node:path';
3
- export async function writeBuildManifest(buildTag, files) {
4
- await writeJsonToBuildDir('manifest.json', {
5
- buildTag,
6
- files: Array.from(files).map(f => extname(f).length
7
- ? f
8
- : f === '/'
9
- ? '/index.html'
10
- : f + '/index.html'),
11
- });
12
- }
13
- export async function writeJsonToBuildDir(filename, json) {
14
- await writeFile(join('./build', filename), JSON.stringify(json, null, 4));
15
- }
16
- export async function writeMetafile(filename, json) {
17
- await writeJsonToBuildDir(join('metafiles', filename), json);
18
- }
19
- export async function writeCacheManifest(buildTag, files) {
20
- await writeJsonToBuildDir('cache.json', {
21
- apiRoutes: [],
22
- buildTag,
23
- files: Array.from(files).map(filenameToWebappPath),
24
- });
25
- }
26
- // drops index.html from path
27
- function filenameToWebappPath(p) {
28
- if (p === '/index.html') {
29
- return '/';
30
- }
31
- else if (p.endsWith('/index.html')) {
32
- return p.substring(0, p.length - '/index.html'.length);
33
- }
34
- else {
35
- return p;
36
- }
37
- }