Skip to content
This repository was archived by the owner on Jun 15, 2025. It is now read-only.

Commit 933cb69

Browse files
committed
prepare CSA main branch for Socket 0.5
1 parent bf6898e commit 933cb69

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ async function main (argv) {
186186
}
187187
process.stdout.write('Ok.\n')
188188

189+
const socketVersion = (await exec('npm info @socketsupply/socket version')).stdout.trim()
190+
// split by dot
191+
.split('.')
192+
// convert to numbers
193+
.map(s => parseInt(s))
194+
189195
process.stdout.write('Adding package scripts...')
190196
let pkg
191197

@@ -196,8 +202,10 @@ async function main (argv) {
196202
process.exit(1)
197203
}
198204

205+
const isSocket05orGreater = socketVersion[0] >= 1 || socketVersion[1] >= 5
206+
199207
pkg.type = 'module'
200-
pkg.scripts['init-project'] = 'ssc init'
208+
pkg.scripts['init-project'] = `ssc init${isSocket05orGreater ? ' --config' : ''}`
201209
pkg.scripts.start = 'ssc build -r -o'
202210
pkg.scripts.build = 'ssc build -o'
203211
pkg.scripts.test = 'ssc build -r -o --test=./test/index.js --headless'
@@ -287,7 +295,7 @@ async function main (argv) {
287295
return line.replace(line, 'script = "node build.js"')
288296
}
289297
// Socket 0.5 compatibility
290-
if (line.includes('forward_arguments = ')) {
298+
if (isSocket05orGreater && line.includes('forward_arguments = ')) {
291299
return line.replace(line, 'forward_arguments = true')
292300
}
293301
return line

0 commit comments

Comments
 (0)