diff --git a/src/tasks/delete-components.js b/src/tasks/delete-components.js index 61b2377..b8494a5 100644 --- a/src/tasks/delete-components.js +++ b/src/tasks/delete-components.js @@ -1,6 +1,7 @@ const chalk = require('chalk') const axios = require('axios') const fs = require('fs') +const isEmpty = require('lodash/isEmpty') const deleteComponent = require('./delete-component') const isUrl = source => source.indexOf('http') === 0 @@ -44,7 +45,7 @@ const getDataFromPath = async (path) => { const createContentList = (content, key) => { if (content[key]) return content[key] else if (Array.isArray(content)) return [...content] - else return [content] + else return !isEmpty(content) ? [content] : [] } /** diff --git a/src/tasks/push-components.js b/src/tasks/push-components.js index e29be04..6011ca3 100644 --- a/src/tasks/push-components.js +++ b/src/tasks/push-components.js @@ -2,6 +2,7 @@ const axios = require('axios') const fs = require('fs') const chalk = require('chalk') const PresetsLib = require('../utils/presets-lib') +const isEmpty = require('lodash/isEmpty') const isUrl = source => source.indexOf('http') === 0 @@ -58,7 +59,7 @@ const getDataFromPath = async (path) => { const createContentList = (content, key) => { if (content[key]) return content[key] else if (Array.isArray(content)) return [...content] - else return [content] + else return !isEmpty(content) ? [content] : [] } module.exports = async (api, { source, presetsSource }) => {