Skip to content

Commit

Permalink
fixing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcherubini committed Jul 22, 2019
1 parent 76f27e7 commit 3de1fae
Show file tree
Hide file tree
Showing 4 changed files with 333 additions and 202 deletions.
30 changes: 22 additions & 8 deletions bin/index.js
Expand Up @@ -7,6 +7,7 @@ const chalk = require("chalk").default;
const yargs = require("yargs");
const {ProntoWebpack} = require("vue-pronto");
const {GetConfig} = require("../lib/utils/config.utils");
const path = require("path");

//@ts-ignore
// tslint:disable-next-line:no-console
Expand All @@ -18,18 +19,31 @@ console.log(

// tslint:disable-next-line:no-unused-expression
yargs
.command("build [config]", "Build project", (yarg) => {
yarg
.positional("config", {
describe: "Config file location",
default: "./expressvue.config.js",
.command("build [configPath]", "Build project", (yarg) => {
return yarg
.positional("configPath", {
type: "string",
default: process.cwd(),
normalize: true,
describe: "The path where expressvue.config.js lives",
})
.coerce("configPath", (arg) => {
return path.join(process.cwd(), arg);
})
.option("verbose", {
alias: "v",
default: false,
boolean: true,
});
}, async (argv) => {
try {
const config = await GetConfig(process.cwd());
if (argv.verbose) {
console.info(config);
}
console.info("Loading config from " + argv.configPath);
}
const config = await GetConfig(argv.configPath);
if (argv.verbose) {
console.info(config);
}
const renderer = new ProntoWebpack(config);
await renderer.Bootstrap(true);
} catch (e) {
Expand Down
4 changes: 1 addition & 3 deletions lib/utils/config.utils.js
Expand Up @@ -17,9 +17,7 @@ function FindNodeModules(cwdPath) {
* @returns {Promise<object>}
*/
async function GetConfig(pwd) {
const nodeModulesPath = FindNodeModules(pwd);
const rootPath = path.resolve(nodeModulesPath, "../");
const configPath = path.join(rootPath, "./expressvue.config.js");
const configPath = path.join(pwd, "./expressvue.config.js");
const isFile = fs.statSync(configPath).isFile();
if (!isFile) {
const error = new Error(`ExpressVue cannot a file at ${configPath}`);
Expand Down

0 comments on commit 3de1fae

Please sign in to comment.