File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,11 @@ import path from 'node:path'
6
6
import { exec as ecp , spawn } from 'node:child_process'
7
7
import os from 'node:os'
8
8
9
- const exec = util . promisify ( ecp )
10
9
const __dirname = path . dirname ( import . meta. url ) . replace ( `file://${ os . platform ( ) === 'win32' ? '/' : '' } ` , '' )
10
+
11
+ const csaVersion = JSON . parse ( await fs . readFile ( path . join ( __dirname , './package.json' ) ) ) . version ;
12
+
13
+ const exec = util . promisify ( ecp )
11
14
const DEFAULT_TEMPLATE = 'vanilla'
12
15
13
16
async function copyFileOrFolder ( source , target ) {
@@ -36,6 +39,7 @@ const cp = async (a, b) => copyFileOrFolder(
36
39
)
37
40
38
41
async function help ( templateNames ) {
42
+ console . log ( `create-socket-app v${ csaVersion } ` )
39
43
console . log ( `usage: npm create socket-app [${ templateNames . join ( ' | ' ) } ]` )
40
44
}
41
45
@@ -79,7 +83,7 @@ async function main (argv) {
79
83
80
84
const templateNames = await fs . readdir ( path . join ( __dirname , 'templates' ) )
81
85
82
- if ( argv . find ( s => s . includes ( '-h' ) ) ) {
86
+ if ( argv . find ( s => s . includes ( '-h' ) ) || argv . find ( s => s . includes ( '--help' ) ) || argv . find ( s => s . includes ( '-v' ) ) || argv . find ( s => s . includes ( '--version' ) ) ) {
83
87
return help ( templateNames )
84
88
}
85
89
You can’t perform that action at this time.
0 commit comments