Upgrade Holepunch P2P stack and npm dependencies

Align p2ns with current Holepunch ecosystem versions: autopass 3,
hyperdb 6, hyperschema 1.21, hyperdrive 13, corestore 7.10, hyperswarm
4.17, protomux 3.11, and compact-encoding 3 (with npm overrides).
Also bump Tailwind/PostCSS, ws, node-forge, and related tooling; add
express and holesail-logger; remove unused install/npm packages.

Use cache/plugin-spec when plugin spec dirs are not writable, and
update docs and proxy install notes. Rebuild admin CSS for Tailwind 4.3.

Existing P2P storage must be wiped (--clean) after upgrading.
This commit is contained in:
Raven Scott
2026-05-27 19:33:06 -04:00
parent 022eeea263
commit bfc51b8edb
7 changed files with 2056 additions and 35 deletions
+1985 -2
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -153,10 +153,10 @@ async function getDatabase(pluginDomain, pluginDir, dbDir) {
logError('DBManager', `Database definition file does not exist: ${defPath}`);
logError('DBManager', `This means HyperDB schemas were not built successfully.`);
logError('DBManager', `Solutions:`);
logError('DBManager', `1. Delete plugin-sites/${pluginDomain}/spec/ directory and restart P2NS`);
logError('DBManager', `1. Delete plugin-sites/${pluginDomain}/spec/ or cache/plugin-spec/${pluginDomain}/ and restart P2NS`);
logError('DBManager', `2. Check plugin config.json has valid hyperdb configuration`);
logError('DBManager', `3. Verify schema builder has required dependencies installed`);
throw new Error(`Database definition file not found at ${defPath}. HyperDB schemas need to be built. Try: rm -rf plugin-sites/${pluginDomain}/spec/ && restart P2NS`);
throw new Error(`Database definition file not found at ${defPath}. HyperDB schemas need to be built. Try: rm -rf plugin-sites/${pluginDomain}/spec/ cache/plugin-spec/${pluginDomain}/ && restart P2NS`);
}
let def;
+42 -9
View File
@@ -8,9 +8,46 @@
const Hyperschema = require('hyperschema');
const HyperDBBuilder = require('hyperdb/builder');
const fs = require('fs').promises;
const fsSync = require('fs');
const path = require('path');
const { logDebug, logError, logInfo, logWarn } = require('../infrastructure/logger');
const PROJECT_ROOT = path.resolve(__dirname, '../..');
/**
* Resolve writable spec directories (plugin dir or cache fallback).
* @param {string} pluginDir - Plugin directory path
* @param {Object} config - Plugin config object
* @returns {{ schemaDir: string, dbDir: string }}
*/
function resolveSpecDirs(pluginDir, config) {
const pluginDomain = config.domain || path.basename(pluginDir);
const inPluginSpec = path.join(pluginDir, 'spec');
const isWritable = (dir) => {
try {
fsSync.accessSync(dir, fsSync.constants.W_OK);
return true;
} catch {
return false;
}
};
let specBase = inPluginSpec;
if (!isWritable(pluginDir) || (fsSync.existsSync(inPluginSpec) && !isWritable(inPluginSpec))) {
specBase = path.join(PROJECT_ROOT, 'cache', 'plugin-spec', pluginDomain, 'spec');
logInfo(
'HyperDBBuilder',
`Using cache spec path for ${pluginDomain} (plugin spec dir not writable): ${specBase}`
);
}
return {
schemaDir: path.join(specBase, 'hyperschema'),
dbDir: path.join(specBase, 'hyperdb')
};
}
/**
* Build HyperDB schemas and definitions from plugin config
* @param {string} pluginDir - Plugin directory path
@@ -23,8 +60,7 @@ async function buildSchemaFromConfig(pluginDir, config) {
}
const hyperdbConfig = config.hyperdb;
const schemaDir = path.join(pluginDir, 'spec', 'hyperschema');
const dbDir = path.join(pluginDir, 'spec', 'hyperdb');
const { schemaDir, dbDir } = resolveSpecDirs(pluginDir, config);
// Ensure directories exist
await fs.mkdir(schemaDir, { recursive: true });
@@ -208,8 +244,7 @@ async function needsRebuild(pluginDir, config) {
return false;
}
const schemaDir = path.join(pluginDir, 'spec', 'hyperschema');
const dbDir = path.join(pluginDir, 'spec', 'hyperdb');
const { schemaDir, dbDir } = resolveSpecDirs(pluginDir, config);
try {
// Check if directories exist
@@ -252,10 +287,7 @@ async function ensureSchemaBuilt(pluginDir, config) {
return await buildSchemaFromConfig(pluginDir, config);
}
const schemaDir = path.join(pluginDir, 'spec', 'hyperschema');
const dbDir = path.join(pluginDir, 'spec', 'hyperdb');
return { schemaDir, dbDir };
return resolveSpecDirs(pluginDir, config);
}
module.exports = {
@@ -263,6 +295,7 @@ module.exports = {
buildHyperschema,
buildHyperDBDefinition,
needsRebuild,
ensureSchemaBuilt
ensureSchemaBuilt,
resolveSpecDirs
};