Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish non-private subdirectories when root is private #483

Merged
merged 2 commits into from Feb 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
lukeggchapman marked this conversation as resolved.
Show resolved Hide resolved
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