made cli.js path discovery smarter
This commit is contained in:
parent
3d78bf268d
commit
0b6fc610e8
@ -1,2 +1,2 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
var index = require("./index.js");
|
var index = require("../{{pathToIndex}}");
|
2
dist/cli.js
vendored
2
dist/cli.js
vendored
@ -1,2 +1,2 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
var index = require("./index.js");
|
var index = require("../{{pathToIndex}}");
|
6
dist/npmts.assets.js
vendored
6
dist/npmts.assets.js
vendored
@ -3,12 +3,16 @@ const plugins = require("./npmts.plugins");
|
|||||||
const paths = require("./npmts.paths");
|
const paths = require("./npmts.paths");
|
||||||
const q = require("q");
|
const q = require("q");
|
||||||
const npmts_promisechain_1 = require("./npmts.promisechain");
|
const npmts_promisechain_1 = require("./npmts.promisechain");
|
||||||
|
const npmts_check_1 = require("./npmts.check");
|
||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
let done = q.defer();
|
let done = q.defer();
|
||||||
let config = configArg;
|
let config = configArg;
|
||||||
npmts_promisechain_1.npmtsOra.text('now looking at ' + 'required assets'.yellow);
|
npmts_promisechain_1.npmtsOra.text('now looking at ' + 'required assets'.yellow);
|
||||||
if (config.cli === true) {
|
if (config.cli === true) {
|
||||||
plugins.smartfile.fs.copySync(plugins.path.join(paths.npmtsAssetsDir, 'cli.js'), plugins.path.join(paths.distDir, 'cli.js'));
|
let mainJsPath = npmts_check_1.projectInfo.packageJson.main;
|
||||||
|
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'));
|
||||||
plugins.beautylog.ok('installed CLI assets!');
|
plugins.beautylog.ok('installed CLI assets!');
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
}
|
}
|
||||||
|
@ -2,17 +2,19 @@ import plugins = require('./npmts.plugins')
|
|||||||
import paths = require('./npmts.paths')
|
import paths = require('./npmts.paths')
|
||||||
|
|
||||||
import * as q from 'q'
|
import * as q from 'q'
|
||||||
import {npmtsOra} from './npmts.promisechain'
|
|
||||||
|
import { npmtsOra } from './npmts.promisechain'
|
||||||
|
import { projectInfo } from './npmts.check'
|
||||||
|
|
||||||
export var run = function(configArg){
|
export var run = function(configArg){
|
||||||
let done = q.defer()
|
let done = q.defer()
|
||||||
let config = configArg
|
let config = configArg
|
||||||
npmtsOra.text('now looking at ' + 'required assets'.yellow)
|
npmtsOra.text('now looking at ' + 'required assets'.yellow)
|
||||||
if (config.cli === true) {
|
if (config.cli === true) {
|
||||||
plugins.smartfile.fs.copySync(
|
let mainJsPath = projectInfo.packageJson.main
|
||||||
plugins.path.join(paths.npmtsAssetsDir,'cli.js'),
|
let cliJsString: string = plugins.smartfile.fs.toStringSync(plugins.path.join(paths.npmtsAssetsDir,'cli.js'))
|
||||||
plugins.path.join(paths.distDir,'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!')
|
plugins.beautylog.ok('installed CLI assets!')
|
||||||
done.resolve(config)
|
done.resolve(config)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user