tscoverage/ts/npmts.assets.ts

26 lines
949 B
TypeScript
Raw Normal View History

2016-09-06 15:21:25 +00:00
import plugins = require('./npmts.plugins')
import paths = require('./npmts.paths')
2016-10-02 18:35:13 +00:00
import * as q from 'q'
2016-10-05 10:27:30 +00:00
import { npmtsOra } from './npmts.promisechain'
import { projectInfo } from './npmts.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
}