Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
fix: 🐛 don't ask Lerna question, if Lerna not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Jun 5, 2018
1 parent 879d9c1 commit 843093c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 5 additions & 1 deletion lib/questions/lerna.js
@@ -1,6 +1,10 @@
const {getAllPackages, getChangedPackages} = require('../util/lerna');
const {getAllPackages, getChangedPackages, isLerna} = require('../util/lerna');

exports.createQuestion = (state) => {
if (!isLerna(state)) {
return null;
}

const changedPackages = getChangedPackages(state);
const question = {
choices: getAllPackages(state),
Expand Down
7 changes: 0 additions & 7 deletions lib/util/isLerna.js

This file was deleted.

6 changes: 5 additions & 1 deletion lib/util/lerna.js
Expand Up @@ -2,6 +2,9 @@ const {execSync} = require('child_process');
const path = require('path');
const fs = require('fs');

const isLerna = (state) =>
fs.existsSync(path.join(state.root, 'lerna.json'));

const isDir = (root) => (name) => {
const filepath = path.join(root, name);

Expand Down Expand Up @@ -48,5 +51,6 @@ const getChangedPackages = () => {

module.exports = {
getAllPackages,
getChangedPackages
getChangedPackages,
isLerna
};

0 comments on commit 843093c

Please sign in to comment.