Fix Path issue.
This commit is contained in:
@@ -4,7 +4,7 @@ import {exec} from 'child_process';
|
||||
import config from 'config';
|
||||
import Generator from "yeoman-generator";
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development' || config.get('isDev'); // Check README file in case you get "missing files" error.
|
||||
const isDev = process.env.NODE_ENV === 'development' || (config.has('isDev') && config.get('isDev')); // Check README file in case you get "missing files" error.
|
||||
const modulePath = isDev ? '' : 'node_modules/create-block-dev-tool/';
|
||||
|
||||
const blockName = config.has('blockName') ? config.get('blockName') : 'development';
|
||||
@@ -14,7 +14,7 @@ class buildGenerator extends Generator {
|
||||
this.data = await this.prompt([
|
||||
{
|
||||
type: "list",
|
||||
name: "platfrom",
|
||||
name: "platform",
|
||||
message: "Choose Platform",
|
||||
choices: ['WordPress', 'Hubspot', 'JavaScript', 'PHP'],
|
||||
default: 'WordPress'
|
||||
@@ -24,8 +24,9 @@ class buildGenerator extends Generator {
|
||||
|
||||
writing() {
|
||||
new Promise((resolve => {
|
||||
if (['WordPress', 'PHP'].includes(this.data.platfrom)) {
|
||||
exec(`cd platforms/php && composer install && php build.php '${blockName}' '${modulePath}'`, function (error, stdout) {
|
||||
if (['WordPress', 'PHP'].includes(this.data.platform)) {
|
||||
const backPath = modulePath ? modulePath.substr(-1).split('/').map(() => '..').join('/') : '';
|
||||
exec(`cd ${modulePath}platforms/php && composer install && php build.php '${blockName}' '${backPath}'`, function (error, stdout) {
|
||||
console.log(stdout);
|
||||
resolve();
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ import {escape} from "lodash-es";
|
||||
* Constants
|
||||
*/
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development' || config.get('isDev'); // Check README file in case you get "missing files" error.
|
||||
const isDev = process.env.NODE_ENV === 'development' || (config.has('isDev') && config.get('isDev')); // Check README file in case you get "missing files" error.
|
||||
const modulePath = isDev ? '' : 'node_modules/create-block-dev-tool/';
|
||||
const projectDir = modulePath;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user