Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ Or use directly with npx:
npx servejss
```

servejss requires JSS >= 0.0.211, which never writes `index.html` or `.acl`
files into the served directory. If the bundled dependency is missing,
servejss requires JSS >= 0.0.217, which never writes `index.html` or `.acl`
files into the served directory and supports `--plugin` app mounting.
If the bundled dependency is missing,
servejss falls back to a globally installed `jss` — if you have an old
global install, update it too:

Expand Down Expand Up @@ -66,7 +67,7 @@ servejss --read-only
Local: http://localhost:3000
Network: http://192.168.1.5:3000

Mode: GET/PUT/DELETE enabled
Mode: GET/PUT/DELETE enabled (public, no auth)

Press Ctrl+C to stop
```
Expand Down Expand Up @@ -111,6 +112,7 @@ Options:
--no-port-switching Do not open a different port if specified one is taken
-r, --read-only Disable PUT/DELETE methods (like npx serve)
--solid Enable full Solid protocol features
--plugin <module[@prefix]> Mount a JSS app plugin (repeatable)
-q, --quiet Suppress all output
-h, --help Display help
```
Expand Down Expand Up @@ -186,6 +188,16 @@ servejss --read-only ~/shared-files
servejss ./mock-data
```

### Static Site + Live App
```bash
# Serve a directory AND mount a JSS app plugin beside it
servejss --plugin './chat/plugin.js@/chat' ./public
```

The plugin value is forwarded verbatim to JSS (`module[@prefix]`, repeatable —
see the [App Plugins docs](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/gh-pages/docs/configuration.md#app-plugins-plugins)).
Quote it: a leading `@` in scoped packages trips up some shells.

### WebDAV Alternative
```bash
# Lightweight file sync server — no auth, trusted networks only
Expand Down
12 changes: 11 additions & 1 deletion bin/jsserve.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function getNetworkAddress() {
* Print the startup banner
*/
function printBanner(options) {
const { port, host, directory, readOnly, live, solid, networkAddress } = options;
const { port, host, directory, readOnly, live, solid, plugins, networkAddress } = options;

const local = `http://${host === '0.0.0.0' ? 'localhost' : host}:${port}`;
const network = networkAddress ? `http://${networkAddress}:${port}` : null;
Expand All @@ -94,6 +94,9 @@ function printBanner(options) {
}
console.log();
console.log(` ${chalk.gray('Mode:')} ${chalk.yellow(mode)}`);
if (plugins && plugins.length) {
console.log(` ${chalk.gray('Plugins:')} ${chalk.magenta(plugins.join(', '))}`);
}
if (live) {
console.log(` ${chalk.gray('Live:')} ${chalk.green('Watching for changes')}`);
}
Expand Down Expand Up @@ -138,6 +141,7 @@ program
.option('--no-live', 'Disable live reload')
.option('--git', 'Enable git HTTP backend (default: true)')
.option('--no-git', 'Disable git HTTP backend')
.option('--plugin <module[@prefix]>', 'Mount a JSS app plugin (repeatable; requires JSS >= 0.0.217)', (value, previous) => previous.concat([value]), [])
.option('-q, --quiet', 'Suppress all output')
.addHelpText('after', `
Examples:
Expand Down Expand Up @@ -267,6 +271,11 @@ async function run(directory, options) {
jssArgs.push('--git');
}

// App plugins — forwarded verbatim; JSS owns parsing and loading (#594)
for (const plugin of options.plugin) {
jssArgs.push('--plugin', plugin);
}

// Debug mode
if (options.debug) {
console.log(chalk.gray(' JSS args:'), jssArgs.join(' '));
Expand All @@ -281,6 +290,7 @@ async function run(directory, options) {
readOnly: options.readOnly,
live: options.live !== false,
solid: options.solid,
plugins: options.plugin,
networkAddress: getNetworkAddress(),
});
}
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "servejss",
"version": "0.0.8",
"version": "0.0.9",
"description": "Static file server with REST write support - npx serve alternative",
"keywords": [
"serve",
Expand All @@ -27,7 +27,7 @@
"dependencies": {
"chalk": "^5.3.0",
"commander": "^12.1.0",
"javascript-solid-server": ">=0.0.211"
"javascript-solid-server": ">=0.0.217"
},
"repository": {
"type": "git",
Expand Down