@vltpkg/vsr 0.0.0-26 → 0.0.0-27
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/LICENSE +10 -114
- package/dist/README.md +1 -0
- package/dist/assets/public/favicon.ico +0 -0
- package/dist/assets/public/fonts/courier-bold-italic.ttf +0 -0
- package/dist/assets/public/fonts/courier-bold.ttf +0 -0
- package/dist/assets/public/fonts/courier-italic.ttf +0 -0
- package/dist/assets/public/fonts/courier-regular.ttf +0 -0
- package/dist/assets/public/fonts/geist-mono.ttf +0 -0
- package/dist/assets/public/fonts/inter.ttf +0 -0
- package/dist/assets/public/index.html +70 -0
- package/dist/assets/public/index.js +1300 -0
- package/dist/assets/public/index.js.map +7 -0
- package/dist/assets/public/main.css +1 -0
- package/dist/bin/vsr.js +771 -0
- package/dist/index.js +28283 -0
- package/dist/index.js.map +8 -0
- package/package.json +6 -49
- package/DEPLOY.md +0 -163
- package/config.ts +0 -221
- package/drizzle.config.js +0 -40
- package/info/COMPARISONS.md +0 -37
- package/info/CONFIGURATION.md +0 -143
- package/info/CONTRIBUTING.md +0 -32
- package/info/DATABASE_SETUP.md +0 -108
- package/info/GRANULAR_ACCESS_TOKENS.md +0 -160
- package/info/PROJECT_STRUCTURE.md +0 -291
- package/info/ROADMAP.md +0 -27
- package/info/SUPPORT.md +0 -39
- package/info/TESTING.md +0 -301
- package/info/USER_SUPPORT.md +0 -31
- package/scripts/build-assets.js +0 -31
- package/scripts/build-bin.js +0 -62
- package/scripts/prepack.js +0 -27
- package/src/bin/vsr.ts +0 -484
- package/src/db/client.ts +0 -590
- package/src/db/migrations/0000_faulty_ricochet.sql +0 -14
- package/src/db/migrations/0000_initial.sql +0 -29
- package/src/db/migrations/0001_uuid_validation.sql +0 -35
- package/src/db/migrations/0001_wealthy_magdalene.sql +0 -7
- package/src/db/migrations/drop.sql +0 -3
- package/src/db/migrations/meta/0000_snapshot.json +0 -104
- package/src/db/migrations/meta/0001_snapshot.json +0 -155
- package/src/db/migrations/meta/_journal.json +0 -20
- package/src/db/schema.ts +0 -43
- package/src/index.ts +0 -434
- package/src/middleware/config.ts +0 -79
- package/src/middleware/telemetry.ts +0 -43
- package/src/queue/index.ts +0 -97
- package/src/routes/access.ts +0 -852
- package/src/routes/docs.ts +0 -63
- package/src/routes/misc.ts +0 -469
- package/src/routes/packages.ts +0 -2823
- package/src/routes/ping.ts +0 -39
- package/src/routes/search.ts +0 -131
- package/src/routes/static.ts +0 -74
- package/src/routes/tokens.ts +0 -259
- package/src/routes/users.ts +0 -68
- package/src/utils/auth.ts +0 -202
- package/src/utils/cache.ts +0 -587
- package/src/utils/config.ts +0 -50
- package/src/utils/database.ts +0 -69
- package/src/utils/docs.ts +0 -146
- package/src/utils/packages.ts +0 -453
- package/src/utils/response.ts +0 -125
- package/src/utils/routes.ts +0 -64
- package/src/utils/spa.ts +0 -52
- package/src/utils/tracing.ts +0 -52
- package/src/utils/upstream.ts +0 -172
- package/test/access.test.ts +0 -705
- package/test/audit.test.ts +0 -828
- package/test/dashboard.test.ts +0 -693
- package/test/dist-tags.test.ts +0 -678
- package/test/manifest.test.ts +0 -436
- package/test/packument.test.ts +0 -530
- package/test/ping.test.ts +0 -41
- package/test/search.test.ts +0 -472
- package/test/setup.ts +0 -130
- package/test/static.test.ts +0 -646
- package/test/tokens.test.ts +0 -389
- package/test/utils/auth.test.ts +0 -214
- package/test/utils/packages.test.ts +0 -235
- package/test/utils/response.test.ts +0 -184
- package/test/whoami.test.ts +0 -119
- package/tsconfig.json +0 -16
- package/tsconfig.worker.json +0 -3
- package/typedoc.mjs +0 -2
- package/types.ts +0 -598
- package/vitest.config.ts +0 -25
- package/vlt.json.example +0 -56
- package/wrangler.json +0 -65
- /package/{src → dist}/assets/public/images/bg.png +0 -0
- /package/{src → dist}/assets/public/images/clients/logo-bun.png +0 -0
- /package/{src → dist}/assets/public/images/clients/logo-deno.png +0 -0
- /package/{src → dist}/assets/public/images/clients/logo-npm.png +0 -0
- /package/{src → dist}/assets/public/images/clients/logo-pnpm.png +0 -0
- /package/{src → dist}/assets/public/images/clients/logo-vlt.png +0 -0
- /package/{src → dist}/assets/public/images/clients/logo-yarn.png +0 -0
- /package/{src → dist}/assets/public/images/favicon/apple-touch-icon.png +0 -0
- /package/{src → dist}/assets/public/images/favicon/favicon-96x96.png +0 -0
- /package/{src → dist}/assets/public/images/favicon/favicon.ico +0 -0
- /package/{src → dist}/assets/public/images/favicon/favicon.svg +0 -0
- /package/{src → dist}/assets/public/images/favicon/site.webmanifest +0 -0
- /package/{src → dist}/assets/public/images/favicon/web-app-manifest-192x192.png +0 -0
- /package/{src → dist}/assets/public/images/favicon/web-app-manifest-512x512.png +0 -0
- /package/{src → dist}/assets/public/styles/styles.css +0 -0
- /package/{src → dist}/bin/demo/package.json +0 -0
- /package/{src → dist}/bin/demo/vlt.json +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/vsr",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-27",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -21,57 +21,14 @@
|
|
|
21
21
|
"validate-npm-package-name": "6.0.2",
|
|
22
22
|
"wrangler": "^4.33.1",
|
|
23
23
|
"zod": "^3.25.76",
|
|
24
|
-
"@vltpkg/package-info": "0.0.0-
|
|
25
|
-
"@vltpkg/server": "0.0.0-
|
|
26
|
-
"@vltpkg/
|
|
27
|
-
"@vltpkg/
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@cloudflare/vitest-pool-workers": "^0.8.68",
|
|
31
|
-
"@cloudflare/workers-types": "^4.20250829.0",
|
|
32
|
-
"@types/node": "^22.17.2",
|
|
33
|
-
"@types/validate-npm-package-name": "^4.0.2",
|
|
34
|
-
"chokidar-cli": "^3.0.0",
|
|
35
|
-
"drizzle-kit": "^0.31.4",
|
|
36
|
-
"esbuild": "^0.25.9",
|
|
37
|
-
"eslint": "^9.34.0",
|
|
38
|
-
"typedoc": "~0.27.9",
|
|
39
|
-
"typescript": "5.7.3",
|
|
40
|
-
"typescript-eslint": "^8.40.0",
|
|
41
|
-
"vitest": "^3.2.4",
|
|
42
|
-
"@vltpkg/gui": "0.0.0-26"
|
|
24
|
+
"@vltpkg/package-info": "0.0.0-27",
|
|
25
|
+
"@vltpkg/server": "0.0.0-27",
|
|
26
|
+
"@vltpkg/package-json": "0.0.0-27",
|
|
27
|
+
"@vltpkg/vlt-json": "0.0.0-27"
|
|
43
28
|
},
|
|
44
29
|
"license": "FSL-1.1-MIT",
|
|
45
30
|
"engines": {
|
|
46
31
|
"node": ">=22"
|
|
47
32
|
},
|
|
48
|
-
"type": "module"
|
|
49
|
-
"scripts": {
|
|
50
|
-
"build": "pnpm build:dist && pnpm build:assets && pnpm build:worker && pnpm build:bin",
|
|
51
|
-
"build:assets": "node scripts/build-assets.js",
|
|
52
|
-
"build:bin": "node scripts/build-bin.js",
|
|
53
|
-
"build:dist": "node -e \"const fs=require('fs'); fs.rmSync('./dist', {recursive: true, force: true}); fs.mkdirSync('./dist/assets/public', {recursive: true});\"",
|
|
54
|
-
"build:worker": "npx wrangler deploy --dry-run --outdir dist",
|
|
55
|
-
"db:drop": "npx wrangler d1 execute vsr-local-database --file=src/db/migrations/drop.sql --local --persist-to=local-store --no-remote && node -e \"const fs=require('fs'); fs.rmSync('local-store',{recursive:true,force:true}); fs.rmSync('.wrangler',{recursive:true,force:true});\"",
|
|
56
|
-
"db:generate": "drizzle-kit generate",
|
|
57
|
-
"db:migrate": "drizzle-kit migrate",
|
|
58
|
-
"db:push": "drizzle-kit push",
|
|
59
|
-
"db:setup": "npx wrangler d1 execute vsr-local-database --file=src/db/migrations/0000_initial.sql --local --persist-to=local-store --no-remote && npx wrangler d1 execute vsr-local-database --file=src/db/migrations/0001_wealthy_magdalene.sql --local --persist-to=local-store --no-remote",
|
|
60
|
-
"db:studio": "drizzle-kit studio --port 4985",
|
|
61
|
-
"deploy": "pnpm build && npx wrangler deploy",
|
|
62
|
-
"format": "prettier --write . --log-level warn --ignore-path ../../.prettierignore --cache",
|
|
63
|
-
"format:check": "prettier --check . --ignore-path ../../.prettierignore --cache",
|
|
64
|
-
"lint": "eslint . --fix",
|
|
65
|
-
"lint:check": "eslint .",
|
|
66
|
-
"serve:build": "pnpm --silent build && node ./dist/bin/vsr.js --debug --daemon=false",
|
|
67
|
-
"serve:build:daemon": "pnpm --silent build && node ./dist/bin/vsr.js --debug --daemon=true",
|
|
68
|
-
"serve:death": "echo \"Killing wrangler dev processes...\" && (pkill -f 'wrangler.*dev' || true) && sleep 1 && (pids=$(lsof -ti :1337 2>/dev/null; lsof -ti :3000 2>/dev/null) && [ -n \"$pids\" ] && echo \"Force killing remaining processes: $pids\" && kill -9 $pids || echo \"No remaining processes found\") && echo \"Done.\"",
|
|
69
|
-
"serve:watch": "chokidar './src/**/*' -c 'pnpm serve:death && pnpm serve:build'",
|
|
70
|
-
"snap": "vitest --no-watch -u",
|
|
71
|
-
"pretest": "pnpm build",
|
|
72
|
-
"test": "vitest --no-watch",
|
|
73
|
-
"posttest": "tsc --noEmit",
|
|
74
|
-
"typecheck": "tsc --noEmit",
|
|
75
|
-
"typecheck:worker": "tsc -p tsconfig.worker.json --noEmit"
|
|
76
|
-
}
|
|
33
|
+
"type": "module"
|
|
77
34
|
}
|
package/DEPLOY.md
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
# VSR Deploy Command
|
|
2
|
-
|
|
3
|
-
The VSR CLI now includes a `deploy` subcommand that allows you to
|
|
4
|
-
deploy your VSR instance to Cloudflare Workers using configuration
|
|
5
|
-
from your `vlt.json` file.
|
|
6
|
-
|
|
7
|
-
## Usage
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# Deploy to default environment (dev)
|
|
11
|
-
vsr deploy
|
|
12
|
-
|
|
13
|
-
# Deploy to specific environment
|
|
14
|
-
vsr deploy --env=prod
|
|
15
|
-
|
|
16
|
-
# Preview deployment without actually deploying
|
|
17
|
-
vsr deploy --dry-run
|
|
18
|
-
|
|
19
|
-
# Override specific resource names
|
|
20
|
-
vsr deploy --env=staging --db-name=my-custom-db --bucket-name=my-custom-bucket
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Configuration
|
|
24
|
-
|
|
25
|
-
Add a `deploy` section to your `vlt.json` file under the `registry`
|
|
26
|
-
key:
|
|
27
|
-
|
|
28
|
-
```json
|
|
29
|
-
{
|
|
30
|
-
"registry": {
|
|
31
|
-
"deploy": {
|
|
32
|
-
"sentry": {
|
|
33
|
-
"dsn": "https://your-default-sentry-dsn@sentry.io/project-id",
|
|
34
|
-
"sampleRate": 1.0,
|
|
35
|
-
"tracesSampleRate": 0.1
|
|
36
|
-
},
|
|
37
|
-
"environments": {
|
|
38
|
-
"dev": {
|
|
39
|
-
"databaseName": "vsr-dev-database",
|
|
40
|
-
"bucketName": "vsr-dev-bucket",
|
|
41
|
-
"queueName": "vsr-dev-cache-refresh-queue",
|
|
42
|
-
"sentry": {
|
|
43
|
-
"environment": "development"
|
|
44
|
-
},
|
|
45
|
-
"vars": {
|
|
46
|
-
"CUSTOM_VAR": "dev-value"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"prod": {
|
|
50
|
-
"databaseName": "vsr-prod-database",
|
|
51
|
-
"bucketName": "vsr-prod-bucket",
|
|
52
|
-
"queueName": "vsr-prod-cache-refresh-queue",
|
|
53
|
-
"sentry": {
|
|
54
|
-
"environment": "production",
|
|
55
|
-
"dsn": "https://your-prod-sentry-dsn@sentry.io/project-id",
|
|
56
|
-
"sampleRate": 0.1,
|
|
57
|
-
"tracesSampleRate": 0.01
|
|
58
|
-
},
|
|
59
|
-
"vars": {
|
|
60
|
-
"API_BASE_URL": "https://api.example.com"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Configuration Options
|
|
70
|
-
|
|
71
|
-
### Global Deploy Settings
|
|
72
|
-
|
|
73
|
-
- `sentry.dsn`: Default Sentry DSN for error reporting
|
|
74
|
-
- `sentry.sampleRate`: Default error sample rate (0.0 to 1.0)
|
|
75
|
-
- `sentry.tracesSampleRate`: Default performance traces sample rate
|
|
76
|
-
(0.0 to 1.0)
|
|
77
|
-
|
|
78
|
-
### Environment-Specific Settings
|
|
79
|
-
|
|
80
|
-
Each environment can override any global setting and specify:
|
|
81
|
-
|
|
82
|
-
- `databaseName`: D1 database name for this environment
|
|
83
|
-
- `bucketName`: R2 bucket name for this environment
|
|
84
|
-
- `queueName`: Queue name for cache refresh operations
|
|
85
|
-
- `sentry`: Environment-specific Sentry configuration
|
|
86
|
-
- `vars`: Custom environment variables to pass to the Worker
|
|
87
|
-
|
|
88
|
-
### CLI Options
|
|
89
|
-
|
|
90
|
-
- `--env=<string>`: Environment to deploy to (defaults to "dev")
|
|
91
|
-
- `--db-name=<string>`: Override D1 database name
|
|
92
|
-
- `--bucket-name=<string>`: Override R2 bucket name
|
|
93
|
-
- `--queue-name=<string>`: Override queue name
|
|
94
|
-
- `--dry-run`: Show what would be deployed without actually deploying
|
|
95
|
-
|
|
96
|
-
## Precedence
|
|
97
|
-
|
|
98
|
-
Configuration values are resolved in the following order (highest
|
|
99
|
-
precedence first):
|
|
100
|
-
|
|
101
|
-
1. CLI arguments (`--db-name`, `--bucket-name`, etc.)
|
|
102
|
-
2. Environment-specific config (`environments.prod.databaseName`)
|
|
103
|
-
3. Default values
|
|
104
|
-
|
|
105
|
-
## Examples
|
|
106
|
-
|
|
107
|
-
### Basic Deployment
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
# Deploy to development environment
|
|
111
|
-
vsr deploy --env=dev
|
|
112
|
-
|
|
113
|
-
# Deploy to production
|
|
114
|
-
vsr deploy --env=prod
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Custom Resource Names
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
# Override database and bucket names
|
|
121
|
-
vsr deploy --env=staging --db-name=my-staging-db --bucket-name=my-staging-bucket
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Preview Deployment
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
# See what would be deployed without actually deploying
|
|
128
|
-
vsr deploy --env=prod --dry-run
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Using Custom Config File
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
# Use a specific vlt.json file
|
|
135
|
-
vsr deploy --config=/path/to/custom-vlt.json --env=prod
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## Generated Wrangler Command
|
|
139
|
-
|
|
140
|
-
The deploy command generates a `wrangler deploy` command with the
|
|
141
|
-
appropriate bindings and variables. For example:
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
wrangler deploy dist/index.js \
|
|
145
|
-
--name vsr-prod \
|
|
146
|
-
--compatibility-date 2024-09-23 \
|
|
147
|
-
--var SENTRY_DSN:https://your-sentry-dsn@sentry.io/project-id \
|
|
148
|
-
--var SENTRY_ENVIRONMENT:production \
|
|
149
|
-
--var ARG_DEBUG:false \
|
|
150
|
-
--var ARG_TELEMETRY:true \
|
|
151
|
-
--var ARG_DAEMON:true \
|
|
152
|
-
--d1 DB=vsr-prod-database \
|
|
153
|
-
--r2 BUCKET=vsr-prod-bucket \
|
|
154
|
-
--queue-producer CACHE_REFRESH_QUEUE=vsr-prod-cache-refresh-queue \
|
|
155
|
-
--queue-consumer vsr-prod-cache-refresh-queue
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
## Prerequisites
|
|
159
|
-
|
|
160
|
-
- Wrangler CLI must be installed and authenticated
|
|
161
|
-
- Cloudflare Workers account with appropriate permissions
|
|
162
|
-
- D1 databases, R2 buckets, and queues must exist (or be created by
|
|
163
|
-
Wrangler)
|
package/config.ts
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
// get openapi schema
|
|
2
|
-
import wranglerJson from './wrangler.json' with { type: 'json' }
|
|
3
|
-
import packageJson from './package.json' with { type: 'json' }
|
|
4
|
-
import { apiBody } from './src/utils/docs.ts'
|
|
5
|
-
import type {
|
|
6
|
-
OriginConfig,
|
|
7
|
-
CookieOptions,
|
|
8
|
-
ApiDocsConfig,
|
|
9
|
-
} from './types.ts'
|
|
10
|
-
|
|
11
|
-
export const YEAR = new Date().getFullYear()
|
|
12
|
-
|
|
13
|
-
export const WRANGLER_CONFIG = wranglerJson.dev
|
|
14
|
-
|
|
15
|
-
export const PORT = WRANGLER_CONFIG.port || (1337 as number)
|
|
16
|
-
|
|
17
|
-
export const TELEMETRY_ENABLED = true as boolean
|
|
18
|
-
|
|
19
|
-
export const HELP_ENABLED = false as boolean
|
|
20
|
-
|
|
21
|
-
// Sentry configuration for error reporting (when telemetry is enabled)
|
|
22
|
-
export const SENTRY_CONFIG = {
|
|
23
|
-
dsn: 'https://909b085eb764c00250ad312660c2fdf1@o4506397716054016.ingest.us.sentry.io/4509492612300800',
|
|
24
|
-
sendDefaultPii: true,
|
|
25
|
-
environment: 'development', // Will be overridden by environment variable
|
|
26
|
-
sampleRate: 1.0,
|
|
27
|
-
tracesSampleRate: 0.1, // Lower sample rate for performance traces
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const DEBUG_ENABLED = false as boolean
|
|
31
|
-
|
|
32
|
-
export const API_DOCS_ENABLED = true as boolean
|
|
33
|
-
|
|
34
|
-
export const DAEMON_ENABLED = true as boolean
|
|
35
|
-
|
|
36
|
-
export const DAEMON_PORT = 3000 as number
|
|
37
|
-
|
|
38
|
-
// Runtime configuration is now handled by configMiddleware
|
|
39
|
-
// which enriches c.env with computed values like DAEMON_ENABLED, TELEMETRY_ENABLED, etc.
|
|
40
|
-
|
|
41
|
-
export const DAEMON_URL = `http://localhost:${DAEMON_PORT}`
|
|
42
|
-
|
|
43
|
-
export const VERSION: string = packageJson.version
|
|
44
|
-
|
|
45
|
-
export const URL = `http://localhost:${PORT}`
|
|
46
|
-
|
|
47
|
-
export const REDIRECT_URI = `${URL}/-/auth/callback`
|
|
48
|
-
|
|
49
|
-
// how to handle packages requests
|
|
50
|
-
export const ORIGIN_CONFIG: OriginConfig = {
|
|
51
|
-
default: 'local',
|
|
52
|
-
upstreams: {
|
|
53
|
-
local: {
|
|
54
|
-
type: 'local',
|
|
55
|
-
url: URL,
|
|
56
|
-
allowPublish: true,
|
|
57
|
-
},
|
|
58
|
-
npm: {
|
|
59
|
-
type: 'npm',
|
|
60
|
-
url: 'https://registry.npmjs.org',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Reserved route prefixes that cannot be used as upstream names
|
|
66
|
-
export const RESERVED_ROUTES: string[] = [
|
|
67
|
-
'-',
|
|
68
|
-
'user',
|
|
69
|
-
'docs',
|
|
70
|
-
'search',
|
|
71
|
-
'tokens',
|
|
72
|
-
'auth',
|
|
73
|
-
'ping',
|
|
74
|
-
'package',
|
|
75
|
-
'v1',
|
|
76
|
-
'api',
|
|
77
|
-
'admin',
|
|
78
|
-
'*', // Reserved for hash-based routes
|
|
79
|
-
]
|
|
80
|
-
|
|
81
|
-
// Backward compatibility - maintain old PROXY behavior
|
|
82
|
-
export const PROXY: boolean =
|
|
83
|
-
Object.keys(ORIGIN_CONFIG.upstreams).length > 1
|
|
84
|
-
|
|
85
|
-
export const PROXY_URL: string | undefined =
|
|
86
|
-
ORIGIN_CONFIG.upstreams[ORIGIN_CONFIG.default]?.url
|
|
87
|
-
|
|
88
|
-
// the time in seconds to cache the registry
|
|
89
|
-
export const REQUEST_TIMEOUT: number = 60 * 1000
|
|
90
|
-
|
|
91
|
-
// cookie options
|
|
92
|
-
export const COOKIE_OPTIONS: CookieOptions = {
|
|
93
|
-
path: '/',
|
|
94
|
-
httpOnly: true,
|
|
95
|
-
secure: true,
|
|
96
|
-
sameSite: 'strict',
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// OpenAPI Docs
|
|
100
|
-
export const OPEN_API_CONFIG = {
|
|
101
|
-
openapi: '3.1.0',
|
|
102
|
-
info: {
|
|
103
|
-
title: 'vlt serverless registry',
|
|
104
|
-
version: VERSION,
|
|
105
|
-
description: 'The vlt serverless registry API',
|
|
106
|
-
},
|
|
107
|
-
tags: [
|
|
108
|
-
{
|
|
109
|
-
name: 'Health Check',
|
|
110
|
-
description: 'Registry health and status endpoints',
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: 'Authentication',
|
|
114
|
-
description: 'User authentication and token management',
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: 'Packages',
|
|
118
|
-
description: 'Package publishing, downloading, and management',
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: 'Dist-Tags',
|
|
122
|
-
description: 'Package version tagging and lifecycle management',
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: 'Access Control',
|
|
126
|
-
description:
|
|
127
|
-
'Package access permissions and collaborator management',
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: 'Search',
|
|
131
|
-
description: 'Package discovery and search functionality',
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: 'Security',
|
|
135
|
-
description: 'Security auditing and vulnerability scanning',
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: 'Dashboard',
|
|
139
|
-
description: 'Registry dashboard and administration',
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: 'Static Assets',
|
|
143
|
-
description: 'Static file serving and web assets',
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
name: 'NPM Compatibility',
|
|
147
|
-
description: 'Legacy npm client compatibility redirects',
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// the docs configuration for the API reference
|
|
153
|
-
export const SCALAR_API_CONFIG: ApiDocsConfig = {
|
|
154
|
-
metaData: {
|
|
155
|
-
title: 'vlt serverless registry',
|
|
156
|
-
},
|
|
157
|
-
hideModels: false,
|
|
158
|
-
hideDownloadButton: false,
|
|
159
|
-
darkMode: false,
|
|
160
|
-
favicon: '/public/images/favicon/favicon.svg',
|
|
161
|
-
defaultHttpClient: {
|
|
162
|
-
targetKey: 'curl',
|
|
163
|
-
clientKey: 'fetch',
|
|
164
|
-
},
|
|
165
|
-
authentication: {
|
|
166
|
-
http: {
|
|
167
|
-
bearer: {
|
|
168
|
-
token: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
169
|
-
},
|
|
170
|
-
basic: {
|
|
171
|
-
username: 'user',
|
|
172
|
-
password: 'pass',
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
hiddenClients: {
|
|
177
|
-
python: true,
|
|
178
|
-
c: true,
|
|
179
|
-
go: true,
|
|
180
|
-
java: true,
|
|
181
|
-
ruby: true,
|
|
182
|
-
shell: ['httpie', 'wget', 'fetch'],
|
|
183
|
-
clojure: true,
|
|
184
|
-
csharp: true,
|
|
185
|
-
kotlin: true,
|
|
186
|
-
objc: true,
|
|
187
|
-
swift: true,
|
|
188
|
-
r: true,
|
|
189
|
-
powershell: false,
|
|
190
|
-
ocaml: true,
|
|
191
|
-
curl: false,
|
|
192
|
-
http: true,
|
|
193
|
-
php: true,
|
|
194
|
-
node: ['request', 'unirest'],
|
|
195
|
-
javascript: ['xhr', 'jquery'],
|
|
196
|
-
},
|
|
197
|
-
spec: {
|
|
198
|
-
content: {
|
|
199
|
-
openapi: OPEN_API_CONFIG.openapi,
|
|
200
|
-
servers: [
|
|
201
|
-
{
|
|
202
|
-
url: URL,
|
|
203
|
-
description: 'localhost',
|
|
204
|
-
},
|
|
205
|
-
],
|
|
206
|
-
info: {
|
|
207
|
-
title: 'vlt serverless registry',
|
|
208
|
-
version: VERSION,
|
|
209
|
-
license: {
|
|
210
|
-
identifier: 'FSL-1.1-MIT',
|
|
211
|
-
name: 'Functional Source License, Version 1.1, MIT Future License',
|
|
212
|
-
url: 'https://fsl.software/FSL-1.1-MIT.template.md',
|
|
213
|
-
},
|
|
214
|
-
description: apiBody({ YEAR }),
|
|
215
|
-
},
|
|
216
|
-
// Include tag ordering and descriptions
|
|
217
|
-
tags: OPEN_API_CONFIG.tags,
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
customCss: `@import '${URL}/public/styles/styles.css';`,
|
|
221
|
-
}
|
package/drizzle.config.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'drizzle-kit'
|
|
2
|
-
import { join } from 'path'
|
|
3
|
-
import { existsSync, readdirSync } from 'fs'
|
|
4
|
-
|
|
5
|
-
// Find the actual SQLite database file in the miniflare-D1DatabaseObject directory
|
|
6
|
-
const miniflareDir = join(
|
|
7
|
-
import.meta.dirname,
|
|
8
|
-
'./local-store',
|
|
9
|
-
'v3',
|
|
10
|
-
'd1',
|
|
11
|
-
'miniflare-D1DatabaseObject',
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
if (!existsSync(miniflareDir)) {
|
|
15
|
-
throw new Error(
|
|
16
|
-
`Miniflare directory not found at ${miniflareDir}. Make sure to run \`pnpm run db:setup\` first.`,
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
// Look for the most recently modified SQLite file
|
|
20
|
-
const file = readdirSync(miniflareDir, { withFileTypes: true })
|
|
21
|
-
.filter(file => file.isFile() && file.name.endsWith('.sqlite'))
|
|
22
|
-
.sort((a, b) => b.mtime.getTime() - a.mtime.getTime())
|
|
23
|
-
.map(file => join(file.parentPath, file.name))
|
|
24
|
-
.find(file => existsSync(file))
|
|
25
|
-
|
|
26
|
-
if (!file) {
|
|
27
|
-
throw new Error(
|
|
28
|
-
`No SQLite file found in ${miniflareDir}. Make sure to run \`pnpm run db:setup\` first.`,
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// For Drizzle Kit
|
|
33
|
-
export default defineConfig({
|
|
34
|
-
schema: './src/db/schema.ts',
|
|
35
|
-
out: './src/db/migrations',
|
|
36
|
-
dialect: 'sqlite',
|
|
37
|
-
dbCredentials: {
|
|
38
|
-
url: file,
|
|
39
|
-
},
|
|
40
|
-
})
|
package/info/COMPARISONS.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Registry Comparisons
|
|
2
|
-
|
|
3
|
-
| Feature | **vsr** | **npm** | **GitHub** | **Verdaccio** | **JSR** | **jFrog** | **Sonatype** | **Cloudsmith** | **Buildkite** | **Bit** |
|
|
4
|
-
| ---------------------------- | :-----------: | :-------------: | :-------------: | :-----------: | :-----: | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
|
|
5
|
-
| License | `FSL-1.1-MIT` | `Closed Source` | `Closed Source` | `MIT` | `MIT` | `Closed Source` | `Closed Source` | `Closed Source` | `Closed Source` | `Closed Source` |
|
|
6
|
-
| Authored Language | `JavaScript` | `JavaScript` | `Ruby`/`Go` | `TypeScript` | `Rust` | `-` | `-` | `-` | `-` | `-` |
|
|
7
|
-
| Publishing | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
8
|
-
| Installation | ✅ | ✅ | ✅ | ✅ | ✴️ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
9
|
-
| Search | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
10
|
-
| Scoped Packages | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
11
|
-
| Unscoped Packages | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ |
|
|
12
|
-
| Proxying Upstream Sources | ✅ | ❌ | ✴️ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ |
|
|
13
|
-
| Hosted Instance | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
14
|
-
| Hosted Instance Cost | `$` | `-` | `$$$$` | `-` | `-` | `$$$$` | `$$$$` | `$$$$` | `$$$` | `$$$` |
|
|
15
|
-
| Self-Hosted Instance | ✅ | ❌ | ✴️ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
|
|
16
|
-
| Self-Hosted Instance Cost | 🆓 | `-` | `$$$$$` | `$` | `$` | `$$$$$` | `$$$$$` | `-` | `-` | `-` |
|
|
17
|
-
| Hosted Public Packages | ⏳ | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ |
|
|
18
|
-
| Hosted Private Packages | ⏳ | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ |
|
|
19
|
-
| Hosted Private Package Cost | `-` | `$$` | 🆓 | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | 🆓 |
|
|
20
|
-
| Granular Access/Permissions | ✅ | ✴️ | ❌ | ✅ | ❌ | ✴️ | ✴️ | ✴️ | ✴️ | ❌ |
|
|
21
|
-
| Manifest Validation | ✅ | ✴️ | ❌ | ❌ | ✴️ | ✴️ | ✴️ | ❌ | ❌ | ❌ |
|
|
22
|
-
| Audit | 🕤 | ✴️ | ❌ | ✴️ | ✴️ | ✴️ | ✴️ | ✴️ | ❌ | ❌ |
|
|
23
|
-
| Events/Hooks | 🕤 | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ |
|
|
24
|
-
| Plugins | 🕤 | ❌ | ❌ | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ |
|
|
25
|
-
| Multi-Cloud | 🕤 | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
|
|
26
|
-
| Documentation Generation | 🕤 | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ✴️ |
|
|
27
|
-
| Unpackaged Files/ESM Imports | 🕤 | ❌ | ❌ | ❌ | ✴️ | ❌ | ❌ | ❌ | ❌ | ❌ |
|
|
28
|
-
| Variant Support | 🕤 | ❌ | ❌ | ❌ | ✴️ | ❌ | ❌ | ❌ | ❌ | ❌ |
|
|
29
|
-
|
|
30
|
-
#### Legend:
|
|
31
|
-
|
|
32
|
-
- ✅ implemented
|
|
33
|
-
- ✴️ supported with caveats
|
|
34
|
-
- ⏳ in-progress
|
|
35
|
-
- 🕤 planned
|
|
36
|
-
- ❌ unsupported
|
|
37
|
-
- `$` expense estimation (0-5)
|
package/info/CONFIGURATION.md
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
# Configuration
|
|
2
|
-
|
|
3
|
-
You can use `vsr` as a private local registry, a proxy registry, or
|
|
4
|
-
both. If you want to publish into or consume from the local registry
|
|
5
|
-
you can use `http://localhost:<port>`.
|
|
6
|
-
|
|
7
|
-
To proxy requests to `npm` you can just add `npm` to the pathname (ex.
|
|
8
|
-
`http://localhost:<port>/npm` will proxy all requests to `npmjs.org`)
|
|
9
|
-
|
|
10
|
-
## CLI Configuration
|
|
11
|
-
|
|
12
|
-
VSR supports both development and deployment commands with various
|
|
13
|
-
configuration options:
|
|
14
|
-
|
|
15
|
-
### Development Server (`vsr dev`)
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
# Start with defaults
|
|
19
|
-
vsr dev
|
|
20
|
-
|
|
21
|
-
# Custom configuration
|
|
22
|
-
vsr dev --port 3000 --debug --config ./vlt.json
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Deployment (`vsr deploy`)
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# Deploy to default environment (dev)
|
|
29
|
-
vsr deploy
|
|
30
|
-
|
|
31
|
-
# Deploy to specific environment
|
|
32
|
-
vsr deploy --env=prod
|
|
33
|
-
|
|
34
|
-
# Override resource names
|
|
35
|
-
vsr deploy --env=staging --db-name=custom-db --bucket-name=custom-bucket
|
|
36
|
-
|
|
37
|
-
# Preview deployment
|
|
38
|
-
vsr deploy --dry-run --env=prod
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Configuration File (`vlt.json`)
|
|
42
|
-
|
|
43
|
-
VSR can be configured using a `vlt.json` file that supports both
|
|
44
|
-
development and deployment settings:
|
|
45
|
-
|
|
46
|
-
### Development Configuration
|
|
47
|
-
|
|
48
|
-
```json
|
|
49
|
-
{
|
|
50
|
-
"registry": {
|
|
51
|
-
"port": 4000,
|
|
52
|
-
"debug": true,
|
|
53
|
-
"telemetry": false,
|
|
54
|
-
"daemon": true
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Deployment Configuration
|
|
60
|
-
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"registry": {
|
|
64
|
-
"deploy": {
|
|
65
|
-
"sentry": {
|
|
66
|
-
"dsn": "https://your-default-sentry-dsn@sentry.io/project-id",
|
|
67
|
-
"sampleRate": 1.0,
|
|
68
|
-
"tracesSampleRate": 0.1
|
|
69
|
-
},
|
|
70
|
-
"environments": {
|
|
71
|
-
"dev": {
|
|
72
|
-
"databaseName": "vsr-dev-database",
|
|
73
|
-
"bucketName": "vsr-dev-bucket",
|
|
74
|
-
"queueName": "vsr-dev-cache-refresh-queue",
|
|
75
|
-
"sentry": {
|
|
76
|
-
"environment": "development"
|
|
77
|
-
},
|
|
78
|
-
"vars": {
|
|
79
|
-
"CUSTOM_VAR": "dev-value"
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"staging": {
|
|
83
|
-
"databaseName": "vsr-staging-database",
|
|
84
|
-
"bucketName": "vsr-staging-bucket",
|
|
85
|
-
"queueName": "vsr-staging-cache-refresh-queue",
|
|
86
|
-
"sentry": {
|
|
87
|
-
"environment": "staging"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
"prod": {
|
|
91
|
-
"databaseName": "vsr-prod-database",
|
|
92
|
-
"bucketName": "vsr-prod-bucket",
|
|
93
|
-
"queueName": "vsr-prod-cache-refresh-queue",
|
|
94
|
-
"sentry": {
|
|
95
|
-
"environment": "production",
|
|
96
|
-
"dsn": "https://your-prod-sentry-dsn@sentry.io/project-id",
|
|
97
|
-
"sampleRate": 0.1,
|
|
98
|
-
"tracesSampleRate": 0.01
|
|
99
|
-
},
|
|
100
|
-
"vars": {
|
|
101
|
-
"API_BASE_URL": "https://api.example.com"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
See the [Deployment Guide](../DEPLOY.md) for complete deployment
|
|
111
|
-
configuration documentation.
|
|
112
|
-
|
|
113
|
-
## Package Manager Integration
|
|
114
|
-
|
|
115
|
-
##### For `vlt`:
|
|
116
|
-
|
|
117
|
-
In your project or user-level `vlt.json` file add the relevant
|
|
118
|
-
configuration.
|
|
119
|
-
|
|
120
|
-
```json
|
|
121
|
-
{
|
|
122
|
-
"registries": {
|
|
123
|
-
"npm": "http://localhost:1337/npm",
|
|
124
|
-
"local": "http://localhost:1337"
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
##### For `npm`, `pnpm`, `yarn` & `bun`:
|
|
130
|
-
|
|
131
|
-
To use `vsr` as your registry you must either pass a registry config
|
|
132
|
-
through a client-specific flag (ex. `--registry=...` for `npm`) or
|
|
133
|
-
define client-specific configuration which stores the reference to
|
|
134
|
-
your registry (ex. `.npmrc` for `npm`). Access to the registry &
|
|
135
|
-
packages is private by default although an `"admin"` user is created
|
|
136
|
-
during setup locally (for development purposes) with a default auth
|
|
137
|
-
token of `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"`.
|
|
138
|
-
|
|
139
|
-
```ini
|
|
140
|
-
; .npmrc
|
|
141
|
-
registry=http://localhost:1337
|
|
142
|
-
//localhost:1337/:_authToken=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
143
|
-
```
|