Skip to content

Commit

Permalink
fix: correctly read package name from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Kampfmoehre committed Dec 20, 2019
1 parent 96d4324 commit 1f639fc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/verify.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const execa = require("execa");
const AggregateError = require("aggregate-error");
const path = require("path");

module.exports = async (pluginConfig) => {
module.exports = async (pluginConfig, { logger }) => {
const errors = [];
for (const envVar of ["SENTRY_PROJECT", "SENTRY_ORG", "SENTRY_URL", "SENTRY_AUTH_TOKEN"]) {
if (!process.env[envVar]) {
Expand All @@ -11,9 +12,9 @@ module.exports = async (pluginConfig) => {

let packageName = pluginConfig.packageName || process.env.npm_package_name;
if (!packageName) {
let pjson = require("package.json");
const content = JSON.parse(pjson);
packageName = content.name;
let pjson = require(path.resolve("package.json"));
logger.log(`reading package name ${pjson.name} from package.json`);
packageName = pjson.name;
}

process.env.RELEASE_NAME = packageName;
Expand Down

0 comments on commit 1f639fc

Please sign in to comment.