It would be great if sonnar-scanner-cli picks up the JS project name and version from package.json automatically. Currently, in the CI we have to do:
- export PACKAGE_NAME=$(cat package.json | grep name | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')
- export PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')
- sonar-scanner -Dsonar.login=$SONAR_TOKEN -Dsonar.host.url=$SONAR_URL -Dsonar.projectName=$PACKAGE_NAME -Dsonar.projectVersion=$PACKAGE_VERSION
but that could be either done automatically via JS parser or even the sonnar-scanner startup script.
I’m happy to contribute if someone suggests where.