UNPKG

dmp-cli

Version:

Dmp component's cli

46 lines (40 loc) 991 B
const buildChart = require('./common/buildChart') const path = require('path') const fs = require('fs') const log = require('./utils/log') const Utils = require('./utils') module.exports = function (config, source, args) { if (typeof source !== 'string') { args = source source = process.cwd() } let fstat const cwd = process.cwd() source = (Utils.isAbsPath(source) && source) || path.join(cwd, source) try { fstat = fs.statSync(source) } catch (e) { log.err('source not found', e) return } if (fstat.isDirectory()) { const mainUrl = path.join(source, '/index.js') const configUrl = path.join(source, '/package.json') try { fstat = fs.statSync(mainUrl) fstat = fs.statSync(configUrl) } catch (e) { log.err('source not found', e) return } //打包 buildChart({ root: config.root, source, config, args }) } else { log.err('unknow type input source', source) } }