2016-10-02 18:35:13 +00:00
|
|
|
import * as q from 'q'
|
2016-10-05 10:27:30 +00:00
|
|
|
|
2016-10-21 15:48:52 +00:00
|
|
|
import paths = require('../npmts.paths')
|
|
|
|
import { npmtsOra } from '../npmts.log'
|
|
|
|
|
|
|
|
import plugins = require('./mod00.plugins')
|
|
|
|
import { projectInfo } from '../mod00/mod00.check'
|
2016-03-14 03:32:52 +00:00
|
|
|
|
|
|
|
export var run = function(configArg){
|
2016-10-02 18:35:13 +00:00
|
|
|
let done = q.defer()
|
2016-09-06 15:21:25 +00:00
|
|
|
let config = configArg
|
|
|
|
npmtsOra.text('now looking at ' + 'required assets'.yellow)
|
|
|
|
if (config.cli === true) {
|
2016-10-05 10:27:30 +00:00
|
|
|
let mainJsPath = projectInfo.packageJson.main
|
|
|
|
let cliJsString: string = plugins.smartfile.fs.toStringSync(plugins.path.join(paths.npmtsAssetsDir,'cli.js'))
|
|
|
|
cliJsString = cliJsString.replace('{{pathToIndex}}',mainJsPath)
|
|
|
|
plugins.smartfile.memory.toFsSync(cliJsString, plugins.path.join(paths.distDir,'cli.js'))
|
2016-09-06 15:21:25 +00:00
|
|
|
plugins.beautylog.ok('installed CLI assets!')
|
|
|
|
done.resolve(config)
|
2016-03-14 03:32:52 +00:00
|
|
|
} else {
|
2016-09-06 15:21:25 +00:00
|
|
|
plugins.beautylog.ok('No additional assets required!')
|
|
|
|
done.resolve(config)
|
2016-03-14 03:32:52 +00:00
|
|
|
}
|
2016-09-06 15:21:25 +00:00
|
|
|
return done.promise
|
|
|
|
}
|