Skip to content

Commit

Permalink
build: discard npm version upgrade karma anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Oct 10, 2017
1 parent d1eae53 commit 948b46b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions afterbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@ const cp = require('child_process')

const karmaPath = path.join(__dirname, 'node_modules', 'karma')

function upgradeKarma () {
console.log(`you are using socket.io version under 2.x, upgrading now...`)
cp.execSync('npm install [email protected]', {
cwd: karmaPath
})
}

try {
const { version } = JSON.parse(
fs.readFileSync(
path.join(karmaPath, 'node_modules', 'socket.io', 'package.json')
)
)
if (parseInt(version, 10) < 2) {
console.log(`you are using karma version under 2.x, upgrading now...`)
cp.execSync('npm install [email protected]', {
cwd: karmaPath
})
upgradeKarma()
}
} catch (e) {}
} catch (e) {
upgradeKarma()
}

0 comments on commit 948b46b

Please sign in to comment.