Skip to content

Commit 79cc028

Browse files
committed
fix: add package.json/npm-shrinkwrap.json only if they exists
1 parent 01735bd commit 79cc028

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/publish.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {readFile, writeFile, ensureFile} = require('fs-extra');
1+
const {readFile, writeFile, ensureFile, pathExists} = require('fs-extra');
22
const {isUndefined, isPlainObject, isArray} = require('lodash');
33
const {template, castArray, uniq} = require('lodash');
44
const micromatch = require('micromatch');
@@ -54,9 +54,11 @@ module.exports = async (pluginConfig, {branch, repositoryUrl}, lastRelease, next
5454

5555
const modifiedFiles = await getModifiedFiles();
5656

57-
if (isUndefined(assets)) {
57+
if (isUndefined(assets) && (await pathExists(PKG_JSON))) {
5858
logger.log('Add %s to the release commit', PKG_JSON);
5959
patterns.push(PKG_JSON);
60+
}
61+
if (isUndefined(assets) && (await pathExists(SKW_JSON))) {
6062
logger.log('Add %s to the release commit', SKW_JSON);
6163
patterns.push(SKW_JSON);
6264
}

0 commit comments

Comments
 (0)