2016-03-14 03:32:52 +00:00
|
|
|
"use strict";
|
2016-10-02 18:35:13 +00:00
|
|
|
const q = require("q");
|
2016-10-21 15:48:52 +00:00
|
|
|
const paths = require("../npmts.paths");
|
|
|
|
const npmts_log_1 = require("../npmts.log");
|
|
|
|
const plugins = require("./mod00.plugins");
|
|
|
|
const mod00_check_1 = require("../mod00/mod00.check");
|
2016-03-14 03:32:52 +00:00
|
|
|
exports.run = function (configArg) {
|
2016-10-02 18:35:13 +00:00
|
|
|
let done = q.defer();
|
2016-09-22 21:23:16 +00:00
|
|
|
let config = configArg;
|
2016-10-21 15:48:52 +00:00
|
|
|
npmts_log_1.npmtsOra.text('now looking at ' + 'required assets'.yellow);
|
2016-09-06 15:21:25 +00:00
|
|
|
if (config.cli === true) {
|
2016-10-21 15:48:52 +00:00
|
|
|
let mainJsPath = mod00_check_1.projectInfo.packageJson.main;
|
2016-10-05 10:27:30 +00:00
|
|
|
let cliJsString = 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!');
|
2016-03-14 03:32:52 +00:00
|
|
|
done.resolve(config);
|
|
|
|
}
|
|
|
|
else {
|
2016-09-06 15:21:25 +00:00
|
|
|
plugins.beautylog.ok('No additional assets required!');
|
2016-03-14 03:32:52 +00:00
|
|
|
done.resolve(config);
|
|
|
|
}
|
|
|
|
return done.promise;
|
|
|
|
};
|