Skip to content

Commit

Permalink
Publish non-private subdirectories when root is private (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeggchapman committed Feb 2, 2020
1 parent 4ad4146 commit 607e5c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion source/index.js
Expand Up @@ -53,7 +53,7 @@ module.exports = async (input = 'patch', options) => {
options.cleanup = false;
}

const pkg = util.readPkg();
const pkg = util.readPkg(options.contents);
const runTests = options.tests && !options.yolo;
const runCleanup = options.cleanup && !options.yolo;
const runPublish = options.publish && !pkg.private;
Expand Down
9 changes: 6 additions & 3 deletions source/util.js
Expand Up @@ -5,12 +5,15 @@ const terminalLink = require('terminal-link');
const execa = require('execa');
const pMemoize = require('p-memoize');
const ow = require('ow');
const pkgDir = require('pkg-dir');

exports.readPkg = () => {
const {packageJson} = readPkgUp.sync();
exports.readPkg = (packagePath = pkgDir.sync()) => {
const {packageJson} = readPkgUp.sync({
cwd: packagePath
});

if (!packageJson) {
throw new Error('No package.json found. Make sure you\'re in the correct project.');
throw new Error(`No package.json found. Make sure ${packagePath} is a valid package`);
}

return packageJson;
Expand Down

0 comments on commit 607e5c1

Please sign in to comment.