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