Skip to content

Commit c847e50

Browse files
committed
add CSA version to the output
1 parent 47cf955 commit c847e50

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ import path from 'node:path'
66
import { exec as ecp, spawn } from 'node:child_process'
77
import os from 'node:os'
88

9-
const exec = util.promisify(ecp)
109
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)
1114
const DEFAULT_TEMPLATE = 'vanilla'
1215

1316
async function copyFileOrFolder (source, target) {
@@ -36,6 +39,7 @@ const cp = async (a, b) => copyFileOrFolder(
3639
)
3740

3841
async function help (templateNames) {
42+
console.log(`create-socket-app v${csaVersion}`)
3943
console.log(`usage: npm create socket-app [${templateNames.join(' | ')}]`)
4044
}
4145

@@ -79,7 +83,7 @@ async function main (argv) {
7983

8084
const templateNames = await fs.readdir(path.join(__dirname, 'templates'))
8185

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'))) {
8387
return help(templateNames)
8488
}
8589

0 commit comments

Comments
 (0)