2018-04-08 23:03:39 +00:00
|
|
|
import * as q from 'smartq';
|
2017-11-28 16:33:55 +00:00
|
|
|
|
2018-04-08 23:03:39 +00:00
|
|
|
import paths = require('../npmts.paths');
|
2017-11-28 16:33:55 +00:00
|
|
|
|
2018-04-08 23:03:39 +00:00
|
|
|
import plugins = require('./mod.plugins');
|
|
|
|
import { projectInfo } from '../mod_compile/mod.check';
|
2017-11-28 16:33:55 +00:00
|
|
|
|
2018-04-08 23:03:39 +00:00
|
|
|
export let run = function(configArg) {
|
|
|
|
let done = q.defer();
|
|
|
|
let config = configArg;
|
|
|
|
plugins.beautylog.ora.text('now looking at ' + 'required assets');
|
2017-11-28 16:33:55 +00:00
|
|
|
if (config.cli === true) {
|
2018-04-08 23:03:39 +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'));
|
|
|
|
plugins.beautylog.ok('installed CLI assets!');
|
|
|
|
done.resolve(config);
|
2017-11-28 16:33:55 +00:00
|
|
|
} else {
|
2018-04-08 23:03:39 +00:00
|
|
|
plugins.beautylog.ok('No additional assets required!');
|
|
|
|
done.resolve(config);
|
2017-11-28 16:33:55 +00:00
|
|
|
}
|
2018-04-08 23:03:39 +00:00
|
|
|
return done.promise;
|
|
|
|
};
|