@@ -9,9 +9,10 @@ import { spawn } from 'child_process';
99import { fileURLToPath } from 'url' ;
1010import { dirname , join , delimiter } from 'path' ;
1111import chalk from 'chalk' ;
12- import { existsSync , mkdirSync } from 'fs' ;
12+ import { existsSync , mkdirSync , readFileSync } from 'fs' ;
1313
1414const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
15+ const pkg = JSON . parse ( readFileSync ( join ( __dirname , 'package.json' ) , 'utf8' ) ) ;
1516
1617// Parse CLI arguments
1718const args = process . argv . slice ( 2 ) ;
@@ -36,33 +37,37 @@ for (let i = 0; i < args.length; i++) {
3637 options . multiuser = true ;
3738 } else if ( arg === '--no-auth' ) {
3839 options . auth = false ;
40+ } else if ( arg === '--version' || arg === '-v' ) {
41+ console . log ( `jspod v${ pkg . version } ` ) ;
42+ process . exit ( 0 ) ;
3943 } else if ( arg === '--help' ) {
4044 console . log ( chalk . cyan ( `
4145╔═══════════════════════════════════════════════════════════════════╗
4246║ jspod - Help ║
4347╚═══════════════════════════════════════════════════════════════════╝
4448` ) ) ;
4549 console . log ( chalk . white ( 'Usage:' ) ) ;
46- console . log ( chalk . yellow ( ' jssd ' ) + chalk . dim ( ' [options]\n' ) ) ;
50+ console . log ( chalk . yellow ( ' jspod ' ) + chalk . dim ( ' [options]\n' ) ) ;
4751 console . log ( chalk . white ( 'Options:' ) ) ;
4852 console . log ( chalk . green ( ' -p, --port ' ) + chalk . yellow ( '<number>' ) + chalk . dim ( ' Port to listen on (default: 5444)' ) ) ;
4953 console . log ( chalk . green ( ' -h, --host ' ) + chalk . yellow ( '<address>' ) + chalk . dim ( ' Host to bind to (default: 0.0.0.0)' ) ) ;
5054 console . log ( chalk . green ( ' -r, --root ' ) + chalk . yellow ( '<path>' ) + chalk . dim ( ' Data directory (default: ./pod-data)' ) ) ;
5155 console . log ( chalk . green ( ' --multiuser' ) + chalk . dim ( ' Enable multi-user mode' ) ) ;
5256 console . log ( chalk . green ( ' --no-auth' ) + chalk . dim ( ' Disable authentication' ) ) ;
57+ console . log ( chalk . green ( ' -v, --version' ) + chalk . dim ( ' Show jspod version' ) ) ;
5358 console . log ( chalk . green ( ' --help' ) + chalk . dim ( ' Show this help message\n' ) ) ;
5459 console . log ( chalk . white ( 'Examples:' ) ) ;
55- console . log ( chalk . dim ( ' jssd ' ) ) ;
56- console . log ( chalk . dim ( ' jssd --port 8080 --root /var/pods' ) ) ;
57- console . log ( chalk . dim ( ' jssd --multiuser\n' ) ) ;
60+ console . log ( chalk . dim ( ' jspod ' ) ) ;
61+ console . log ( chalk . dim ( ' jspod --port 8080 --root /var/pods' ) ) ;
62+ console . log ( chalk . dim ( ' jspod --multiuser\n' ) ) ;
5863 console . log ( chalk . white ( 'Features:' ) ) ;
5964 console . log ( chalk . dim ( ' • Solid Protocol compliant' ) ) ;
6065 console . log ( chalk . dim ( ' • WebID authentication' ) ) ;
6166 console . log ( chalk . dim ( ' • Passkey support' ) ) ;
6267 console . log ( chalk . dim ( ' • WebSocket notifications' ) ) ;
6368 console . log ( chalk . dim ( ' • JSON-LD native\n' ) ) ;
6469 console . log ( chalk . white ( 'Resources:' ) ) ;
65- console . log ( chalk . blue ( ' https://github.com/JavaScriptSolidServer/jssd ' ) ) ;
70+ console . log ( chalk . blue ( ' https://github.com/JavaScriptSolidServer/jspod ' ) ) ;
6671 console . log ( chalk . blue ( ' https://solidproject.org\n' ) ) ;
6772 process . exit ( 0 ) ;
6873 } else {
@@ -111,7 +116,7 @@ console.log(chalk.cyan(' ├─ ') + chalk.green('Notifications ') + chal
111116console . log ( chalk . cyan ( ' └─ ' ) + chalk . green ( 'JSON-LD Native ' ) + chalk . bold . green ( '✓' ) ) ;
112117
113118console . log ( '\n' + chalk . bold . white ( '📚 Resources:\n' ) ) ;
114- console . log ( chalk . cyan ( ' ├─ ' ) + chalk . white ( 'Server: ' ) + chalk . blue . underline ( 'https://github.com/JavaScriptSolidServer/jssd ' ) ) ;
119+ console . log ( chalk . cyan ( ' ├─ ' ) + chalk . white ( 'Server: ' ) + chalk . blue . underline ( 'https://github.com/JavaScriptSolidServer/jspod ' ) ) ;
115120console . log ( chalk . cyan ( ' ├─ ' ) + chalk . white ( 'Solid: ' ) + chalk . blue . underline ( 'https://solidproject.org' ) ) ;
116121console . log ( chalk . cyan ( ' └─ ' ) + chalk . white ( 'WebID: ' ) + chalk . blue . underline ( 'https://www.w3.org/2005/Incubator/webid/spec' ) ) ;
117122
@@ -138,7 +143,7 @@ const jss = spawn('jss', jssArgs, {
138143 env : {
139144 ...process . env ,
140145 PATH : `${ join ( __dirname , 'node_modules' , '.bin' ) } ${ delimiter } ${ process . env . PATH } ` ,
141- TOKEN_SECRET : process . env . TOKEN_SECRET || 'jssd -default-secret-change-in-production' ,
146+ TOKEN_SECRET : process . env . TOKEN_SECRET || 'jspod -default-secret-change-in-production' ,
142147 NODE_ENV : process . env . NODE_ENV || 'development'
143148 }
144149} ) ;
0 commit comments