@wordpress-flow/cli 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1859,10 +1859,22 @@ async function buildBlock() {
1859
1859
  };
1860
1860
  } catch (error) {
1861
1861
  cleanupTempFiles(tempDir);
1862
+ let errorMessage = "Unknown error";
1863
+ if (error instanceof Error) {
1864
+ errorMessage = error.message;
1865
+ if (error.stack) {
1866
+ errorMessage += `
1867
+ ${error.stack}`;
1868
+ }
1869
+ } else if (typeof error === "string") {
1870
+ errorMessage = error;
1871
+ } else if (error) {
1872
+ errorMessage = JSON.stringify(error);
1873
+ }
1862
1874
  return {
1863
1875
  success: false,
1864
1876
  blockName: block.name,
1865
- error: error.message || String(error)
1877
+ error: errorMessage
1866
1878
  };
1867
1879
  }
1868
1880
  }
@@ -1895,22 +1907,27 @@ async function buildBlockScripts(scripts, scriptsPath, scriptsOutputDir) {
1895
1907
  for (const script of scripts) {
1896
1908
  const scriptPath = path.resolve(scriptsPath, script);
1897
1909
  if (!fs.existsSync(scriptPath)) {
1898
- continue;
1910
+ throw new Error(`Script file not found: ${scriptPath}`);
1899
1911
  }
1900
1912
  const scriptName = path.basename(script);
1901
1913
  const outputPath = path.join(scriptsOutputDir, scriptName.replace(/\.ts$/, ".js"));
1902
- await esbuild.build({
1903
- entryPoints: [scriptPath],
1904
- outfile: outputPath,
1905
- bundle: true,
1906
- minify: true,
1907
- platform: "browser",
1908
- target: "es2015",
1909
- format: "iife",
1910
- external: ["react", "react-dom", "@wordpress/*", "jquery"],
1911
- define: { "process.env.NODE_ENV": '"production"' },
1912
- logLevel: "warning"
1913
- });
1914
+ try {
1915
+ await esbuild.build({
1916
+ entryPoints: [scriptPath],
1917
+ outfile: outputPath,
1918
+ bundle: true,
1919
+ minify: true,
1920
+ platform: "browser",
1921
+ target: "es2015",
1922
+ format: "iife",
1923
+ external: ["react", "react-dom", "@wordpress/*", "jquery"],
1924
+ define: { "process.env.NODE_ENV": '"production"' },
1925
+ logLevel: "warning",
1926
+ allowOverwrite: true
1927
+ });
1928
+ } catch (err) {
1929
+ throw new Error(`Failed to build script ${script}: ${err.message}`);
1930
+ }
1914
1931
  outputPaths.push(outputPath);
1915
1932
  }
1916
1933
  return outputPaths;
package/dist/index.js CHANGED
@@ -35037,7 +35037,7 @@ var require_pool_connection = __commonJS((exports, module) => {
35037
35037
 
35038
35038
  // ../../node_modules/mysql2/lib/promise/make_done_cb.js
35039
35039
  var require_make_done_cb = __commonJS((exports, module) => {
35040
- function makeDoneCb(resolve3, reject, localErr) {
35040
+ function makeDoneCb(resolve2, reject, localErr) {
35041
35041
  return function(err, rows, fields) {
35042
35042
  if (err) {
35043
35043
  localErr.message = err.message;
@@ -35048,7 +35048,7 @@ var require_make_done_cb = __commonJS((exports, module) => {
35048
35048
  localErr.sqlMessage = err.sqlMessage;
35049
35049
  reject(localErr);
35050
35050
  } else {
35051
- resolve3([rows, fields]);
35051
+ resolve2([rows, fields]);
35052
35052
  }
35053
35053
  };
35054
35054
  }
@@ -35067,8 +35067,8 @@ var require_prepared_statement_info = __commonJS((exports, module) => {
35067
35067
  execute(parameters) {
35068
35068
  const s = this.statement;
35069
35069
  const localErr = new Error;
35070
- return new this.Promise((resolve3, reject) => {
35071
- const done = makeDoneCb(resolve3, reject, localErr);
35070
+ return new this.Promise((resolve2, reject) => {
35071
+ const done = makeDoneCb(resolve2, reject, localErr);
35072
35072
  if (parameters) {
35073
35073
  s.execute(parameters, done);
35074
35074
  } else {
@@ -35077,9 +35077,9 @@ var require_prepared_statement_info = __commonJS((exports, module) => {
35077
35077
  });
35078
35078
  }
35079
35079
  close() {
35080
- return new this.Promise((resolve3) => {
35080
+ return new this.Promise((resolve2) => {
35081
35081
  this.statement.close();
35082
- resolve3();
35082
+ resolve2();
35083
35083
  });
35084
35084
  }
35085
35085
  }
@@ -35138,8 +35138,8 @@ var require_connection2 = __commonJS((exports, module) => {
35138
35138
  if (typeof params === "function") {
35139
35139
  throw new Error("Callback function is not available with promise clients.");
35140
35140
  }
35141
- return new this.Promise((resolve3, reject) => {
35142
- const done = makeDoneCb(resolve3, reject, localErr);
35141
+ return new this.Promise((resolve2, reject) => {
35142
+ const done = makeDoneCb(resolve2, reject, localErr);
35143
35143
  if (params !== undefined) {
35144
35144
  c.query(query, params, done);
35145
35145
  } else {
@@ -35153,8 +35153,8 @@ var require_connection2 = __commonJS((exports, module) => {
35153
35153
  if (typeof params === "function") {
35154
35154
  throw new Error("Callback function is not available with promise clients.");
35155
35155
  }
35156
- return new this.Promise((resolve3, reject) => {
35157
- const done = makeDoneCb(resolve3, reject, localErr);
35156
+ return new this.Promise((resolve2, reject) => {
35157
+ const done = makeDoneCb(resolve2, reject, localErr);
35158
35158
  if (params !== undefined) {
35159
35159
  c.execute(query, params, done);
35160
35160
  } else {
@@ -35163,38 +35163,38 @@ var require_connection2 = __commonJS((exports, module) => {
35163
35163
  });
35164
35164
  }
35165
35165
  end() {
35166
- return new this.Promise((resolve3) => {
35167
- this.connection.end(resolve3);
35166
+ return new this.Promise((resolve2) => {
35167
+ this.connection.end(resolve2);
35168
35168
  });
35169
35169
  }
35170
35170
  beginTransaction() {
35171
35171
  const c = this.connection;
35172
35172
  const localErr = new Error;
35173
- return new this.Promise((resolve3, reject) => {
35174
- const done = makeDoneCb(resolve3, reject, localErr);
35173
+ return new this.Promise((resolve2, reject) => {
35174
+ const done = makeDoneCb(resolve2, reject, localErr);
35175
35175
  c.beginTransaction(done);
35176
35176
  });
35177
35177
  }
35178
35178
  commit() {
35179
35179
  const c = this.connection;
35180
35180
  const localErr = new Error;
35181
- return new this.Promise((resolve3, reject) => {
35182
- const done = makeDoneCb(resolve3, reject, localErr);
35181
+ return new this.Promise((resolve2, reject) => {
35182
+ const done = makeDoneCb(resolve2, reject, localErr);
35183
35183
  c.commit(done);
35184
35184
  });
35185
35185
  }
35186
35186
  rollback() {
35187
35187
  const c = this.connection;
35188
35188
  const localErr = new Error;
35189
- return new this.Promise((resolve3, reject) => {
35190
- const done = makeDoneCb(resolve3, reject, localErr);
35189
+ return new this.Promise((resolve2, reject) => {
35190
+ const done = makeDoneCb(resolve2, reject, localErr);
35191
35191
  c.rollback(done);
35192
35192
  });
35193
35193
  }
35194
35194
  ping() {
35195
35195
  const c = this.connection;
35196
35196
  const localErr = new Error;
35197
- return new this.Promise((resolve3, reject) => {
35197
+ return new this.Promise((resolve2, reject) => {
35198
35198
  c.ping((err) => {
35199
35199
  if (err) {
35200
35200
  localErr.message = err.message;
@@ -35204,7 +35204,7 @@ var require_connection2 = __commonJS((exports, module) => {
35204
35204
  localErr.sqlMessage = err.sqlMessage;
35205
35205
  reject(localErr);
35206
35206
  } else {
35207
- resolve3(true);
35207
+ resolve2(true);
35208
35208
  }
35209
35209
  });
35210
35210
  });
@@ -35212,7 +35212,7 @@ var require_connection2 = __commonJS((exports, module) => {
35212
35212
  connect() {
35213
35213
  const c = this.connection;
35214
35214
  const localErr = new Error;
35215
- return new this.Promise((resolve3, reject) => {
35215
+ return new this.Promise((resolve2, reject) => {
35216
35216
  c.connect((err, param) => {
35217
35217
  if (err) {
35218
35218
  localErr.message = err.message;
@@ -35222,7 +35222,7 @@ var require_connection2 = __commonJS((exports, module) => {
35222
35222
  localErr.sqlMessage = err.sqlMessage;
35223
35223
  reject(localErr);
35224
35224
  } else {
35225
- resolve3(param);
35225
+ resolve2(param);
35226
35226
  }
35227
35227
  });
35228
35228
  });
@@ -35231,7 +35231,7 @@ var require_connection2 = __commonJS((exports, module) => {
35231
35231
  const c = this.connection;
35232
35232
  const promiseImpl = this.Promise;
35233
35233
  const localErr = new Error;
35234
- return new this.Promise((resolve3, reject) => {
35234
+ return new this.Promise((resolve2, reject) => {
35235
35235
  c.prepare(options, (err, statement) => {
35236
35236
  if (err) {
35237
35237
  localErr.message = err.message;
@@ -35242,7 +35242,7 @@ var require_connection2 = __commonJS((exports, module) => {
35242
35242
  reject(localErr);
35243
35243
  } else {
35244
35244
  const wrappedStatement = new PromisePreparedStatementInfo(statement, promiseImpl);
35245
- resolve3(wrappedStatement);
35245
+ resolve2(wrappedStatement);
35246
35246
  }
35247
35247
  });
35248
35248
  });
@@ -35250,7 +35250,7 @@ var require_connection2 = __commonJS((exports, module) => {
35250
35250
  changeUser(options) {
35251
35251
  const c = this.connection;
35252
35252
  const localErr = new Error;
35253
- return new this.Promise((resolve3, reject) => {
35253
+ return new this.Promise((resolve2, reject) => {
35254
35254
  c.changeUser(options, (err) => {
35255
35255
  if (err) {
35256
35256
  localErr.message = err.message;
@@ -35260,7 +35260,7 @@ var require_connection2 = __commonJS((exports, module) => {
35260
35260
  localErr.sqlMessage = err.sqlMessage;
35261
35261
  reject(localErr);
35262
35262
  } else {
35263
- resolve3();
35263
+ resolve2();
35264
35264
  }
35265
35265
  });
35266
35266
  });
@@ -35538,12 +35538,12 @@ var require_pool2 = __commonJS((exports, module) => {
35538
35538
  }
35539
35539
  getConnection() {
35540
35540
  const corePool = this.pool;
35541
- return new this.Promise((resolve3, reject) => {
35541
+ return new this.Promise((resolve2, reject) => {
35542
35542
  corePool.getConnection((err, coreConnection) => {
35543
35543
  if (err) {
35544
35544
  reject(err);
35545
35545
  } else {
35546
- resolve3(new PromisePoolConnection(coreConnection, this.Promise));
35546
+ resolve2(new PromisePoolConnection(coreConnection, this.Promise));
35547
35547
  }
35548
35548
  });
35549
35549
  });
@@ -35558,8 +35558,8 @@ var require_pool2 = __commonJS((exports, module) => {
35558
35558
  if (typeof args === "function") {
35559
35559
  throw new Error("Callback function is not available with promise clients.");
35560
35560
  }
35561
- return new this.Promise((resolve3, reject) => {
35562
- const done = makeDoneCb(resolve3, reject, localErr);
35561
+ return new this.Promise((resolve2, reject) => {
35562
+ const done = makeDoneCb(resolve2, reject, localErr);
35563
35563
  if (args !== undefined) {
35564
35564
  corePool.query(sql, args, done);
35565
35565
  } else {
@@ -35573,8 +35573,8 @@ var require_pool2 = __commonJS((exports, module) => {
35573
35573
  if (typeof args === "function") {
35574
35574
  throw new Error("Callback function is not available with promise clients.");
35575
35575
  }
35576
- return new this.Promise((resolve3, reject) => {
35577
- const done = makeDoneCb(resolve3, reject, localErr);
35576
+ return new this.Promise((resolve2, reject) => {
35577
+ const done = makeDoneCb(resolve2, reject, localErr);
35578
35578
  if (args) {
35579
35579
  corePool.execute(sql, args, done);
35580
35580
  } else {
@@ -35585,7 +35585,7 @@ var require_pool2 = __commonJS((exports, module) => {
35585
35585
  end() {
35586
35586
  const corePool = this.pool;
35587
35587
  const localErr = new Error;
35588
- return new this.Promise((resolve3, reject) => {
35588
+ return new this.Promise((resolve2, reject) => {
35589
35589
  corePool.end((err) => {
35590
35590
  if (err) {
35591
35591
  localErr.message = err.message;
@@ -35595,7 +35595,7 @@ var require_pool2 = __commonJS((exports, module) => {
35595
35595
  localErr.sqlMessage = err.sqlMessage;
35596
35596
  reject(localErr);
35597
35597
  } else {
35598
- resolve3();
35598
+ resolve2();
35599
35599
  }
35600
35600
  });
35601
35601
  });
@@ -35996,12 +35996,12 @@ var require_pool_cluster2 = __commonJS((exports, module) => {
35996
35996
  }
35997
35997
  getConnection() {
35998
35998
  const corePoolNamespace = this.poolNamespace;
35999
- return new this.Promise((resolve3, reject) => {
35999
+ return new this.Promise((resolve2, reject) => {
36000
36000
  corePoolNamespace.getConnection((err, coreConnection) => {
36001
36001
  if (err) {
36002
36002
  reject(err);
36003
36003
  } else {
36004
- resolve3(new PromisePoolConnection(coreConnection, this.Promise));
36004
+ resolve2(new PromisePoolConnection(coreConnection, this.Promise));
36005
36005
  }
36006
36006
  });
36007
36007
  });
@@ -36012,8 +36012,8 @@ var require_pool_cluster2 = __commonJS((exports, module) => {
36012
36012
  if (typeof values === "function") {
36013
36013
  throw new Error("Callback function is not available with promise clients.");
36014
36014
  }
36015
- return new this.Promise((resolve3, reject) => {
36016
- const done = makeDoneCb(resolve3, reject, localErr);
36015
+ return new this.Promise((resolve2, reject) => {
36016
+ const done = makeDoneCb(resolve2, reject, localErr);
36017
36017
  corePoolNamespace.query(sql, values, done);
36018
36018
  });
36019
36019
  }
@@ -36023,8 +36023,8 @@ var require_pool_cluster2 = __commonJS((exports, module) => {
36023
36023
  if (typeof values === "function") {
36024
36024
  throw new Error("Callback function is not available with promise clients.");
36025
36025
  }
36026
- return new this.Promise((resolve3, reject) => {
36027
- const done = makeDoneCb(resolve3, reject, localErr);
36026
+ return new this.Promise((resolve2, reject) => {
36027
+ const done = makeDoneCb(resolve2, reject, localErr);
36028
36028
  corePoolNamespace.execute(sql, values, done);
36029
36029
  });
36030
36030
  }
@@ -36054,9 +36054,9 @@ var require_promise = __commonJS((exports) => {
36054
36054
  if (!thePromise) {
36055
36055
  throw new Error("no Promise implementation available." + "Use promise-enabled node version or pass userland Promise" + " implementation as parameter, for example: { Promise: require('bluebird') }");
36056
36056
  }
36057
- return new thePromise((resolve3, reject) => {
36057
+ return new thePromise((resolve2, reject) => {
36058
36058
  coreConnection.once("connect", () => {
36059
- resolve3(new PromiseConnection(coreConnection, thePromise));
36059
+ resolve2(new PromiseConnection(coreConnection, thePromise));
36060
36060
  });
36061
36061
  coreConnection.once("error", (err) => {
36062
36062
  createConnectionErr.message = err.message;
@@ -36085,12 +36085,12 @@ var require_promise = __commonJS((exports) => {
36085
36085
  }
36086
36086
  getConnection(pattern, selector) {
36087
36087
  const corePoolCluster = this.poolCluster;
36088
- return new this.Promise((resolve3, reject) => {
36088
+ return new this.Promise((resolve2, reject) => {
36089
36089
  corePoolCluster.getConnection(pattern, selector, (err, coreConnection) => {
36090
36090
  if (err) {
36091
36091
  reject(err);
36092
36092
  } else {
36093
- resolve3(new PromisePoolConnection(coreConnection, this.Promise));
36093
+ resolve2(new PromisePoolConnection(coreConnection, this.Promise));
36094
36094
  }
36095
36095
  });
36096
36096
  });
@@ -36101,8 +36101,8 @@ var require_promise = __commonJS((exports) => {
36101
36101
  if (typeof args === "function") {
36102
36102
  throw new Error("Callback function is not available with promise clients.");
36103
36103
  }
36104
- return new this.Promise((resolve3, reject) => {
36105
- const done = makeDoneCb(resolve3, reject, localErr);
36104
+ return new this.Promise((resolve2, reject) => {
36105
+ const done = makeDoneCb(resolve2, reject, localErr);
36106
36106
  corePoolCluster.query(sql, args, done);
36107
36107
  });
36108
36108
  }
@@ -36112,8 +36112,8 @@ var require_promise = __commonJS((exports) => {
36112
36112
  if (typeof args === "function") {
36113
36113
  throw new Error("Callback function is not available with promise clients.");
36114
36114
  }
36115
- return new this.Promise((resolve3, reject) => {
36116
- const done = makeDoneCb(resolve3, reject, localErr);
36115
+ return new this.Promise((resolve2, reject) => {
36116
+ const done = makeDoneCb(resolve2, reject, localErr);
36117
36117
  corePoolCluster.execute(sql, args, done);
36118
36118
  });
36119
36119
  }
@@ -36123,7 +36123,7 @@ var require_promise = __commonJS((exports) => {
36123
36123
  end() {
36124
36124
  const corePoolCluster = this.poolCluster;
36125
36125
  const localErr = new Error;
36126
- return new this.Promise((resolve3, reject) => {
36126
+ return new this.Promise((resolve2, reject) => {
36127
36127
  corePoolCluster.end((err) => {
36128
36128
  if (err) {
36129
36129
  localErr.message = err.message;
@@ -36133,7 +36133,7 @@ var require_promise = __commonJS((exports) => {
36133
36133
  localErr.sqlMessage = err.sqlMessage;
36134
36134
  reject(localErr);
36135
36135
  } else {
36136
- resolve3();
36136
+ resolve2();
36137
36137
  }
36138
36138
  });
36139
36139
  });
@@ -37820,14 +37820,14 @@ Check the top-level render call using <` + parentName + ">.";
37820
37820
  var thenableResult = result2;
37821
37821
  var wasAwaited = false;
37822
37822
  var thenable = {
37823
- then: function(resolve3, reject) {
37823
+ then: function(resolve2, reject) {
37824
37824
  wasAwaited = true;
37825
37825
  thenableResult.then(function(returnValue2) {
37826
37826
  popActScope(prevActScopeDepth);
37827
37827
  if (actScopeDepth === 0) {
37828
- recursivelyFlushAsyncActWork(returnValue2, resolve3, reject);
37828
+ recursivelyFlushAsyncActWork(returnValue2, resolve2, reject);
37829
37829
  } else {
37830
- resolve3(returnValue2);
37830
+ resolve2(returnValue2);
37831
37831
  }
37832
37832
  }, function(error2) {
37833
37833
  popActScope(prevActScopeDepth);
@@ -37856,20 +37856,20 @@ Check the top-level render call using <` + parentName + ">.";
37856
37856
  ReactCurrentActQueue.current = null;
37857
37857
  }
37858
37858
  var _thenable = {
37859
- then: function(resolve3, reject) {
37859
+ then: function(resolve2, reject) {
37860
37860
  if (ReactCurrentActQueue.current === null) {
37861
37861
  ReactCurrentActQueue.current = [];
37862
- recursivelyFlushAsyncActWork(returnValue, resolve3, reject);
37862
+ recursivelyFlushAsyncActWork(returnValue, resolve2, reject);
37863
37863
  } else {
37864
- resolve3(returnValue);
37864
+ resolve2(returnValue);
37865
37865
  }
37866
37866
  }
37867
37867
  };
37868
37868
  return _thenable;
37869
37869
  } else {
37870
37870
  var _thenable2 = {
37871
- then: function(resolve3, reject) {
37872
- resolve3(returnValue);
37871
+ then: function(resolve2, reject) {
37872
+ resolve2(returnValue);
37873
37873
  }
37874
37874
  };
37875
37875
  return _thenable2;
@@ -37885,7 +37885,7 @@ Check the top-level render call using <` + parentName + ">.";
37885
37885
  actScopeDepth = prevActScopeDepth;
37886
37886
  }
37887
37887
  }
37888
- function recursivelyFlushAsyncActWork(returnValue, resolve3, reject) {
37888
+ function recursivelyFlushAsyncActWork(returnValue, resolve2, reject) {
37889
37889
  {
37890
37890
  var queue = ReactCurrentActQueue.current;
37891
37891
  if (queue !== null) {
@@ -37894,16 +37894,16 @@ Check the top-level render call using <` + parentName + ">.";
37894
37894
  enqueueTask(function() {
37895
37895
  if (queue.length === 0) {
37896
37896
  ReactCurrentActQueue.current = null;
37897
- resolve3(returnValue);
37897
+ resolve2(returnValue);
37898
37898
  } else {
37899
- recursivelyFlushAsyncActWork(returnValue, resolve3, reject);
37899
+ recursivelyFlushAsyncActWork(returnValue, resolve2, reject);
37900
37900
  }
37901
37901
  });
37902
37902
  } catch (error2) {
37903
37903
  reject(error2);
37904
37904
  }
37905
37905
  } else {
37906
- resolve3(returnValue);
37906
+ resolve2(returnValue);
37907
37907
  }
37908
37908
  }
37909
37909
  }
@@ -78090,9 +78090,9 @@ var require_readdirp = __commonJS((exports, module) => {
78090
78090
  return new ReaddirpStream(options);
78091
78091
  };
78092
78092
  var readdirpPromise = (root3, options = {}) => {
78093
- return new Promise((resolve4, reject) => {
78093
+ return new Promise((resolve3, reject) => {
78094
78094
  const files = [];
78095
- readdirp(root3, options).on("data", (entry) => files.push(entry)).on("end", () => resolve4(files)).on("error", (error) => reject(error));
78095
+ readdirp(root3, options).on("data", (entry) => files.push(entry)).on("end", () => resolve3(files)).on("error", (error) => reject(error));
78096
78096
  });
78097
78097
  };
78098
78098
  readdirp.promise = readdirpPromise;
@@ -80086,13 +80086,13 @@ var require_nodefs_handler = __commonJS((exports, module) => {
80086
80086
  this._addToNodeFs(path8, initialAdd, wh, depth + 1);
80087
80087
  }
80088
80088
  }).on(EV_ERROR, this._boundHandleError);
80089
- return new Promise((resolve4) => stream6.once(STR_END, () => {
80089
+ return new Promise((resolve3) => stream6.once(STR_END, () => {
80090
80090
  if (this.fsw.closed) {
80091
80091
  stream6 = undefined;
80092
80092
  return;
80093
80093
  }
80094
80094
  const wasThrottled = throttler ? throttler.clear() : false;
80095
- resolve4();
80095
+ resolve3();
80096
80096
  previous2.getChildren().filter((item) => {
80097
80097
  return item !== directory && !current2.has(item) && (!wh.hasGlob || wh.filterPath({
80098
80098
  fullPath: sysPath.resolve(directory, item)
@@ -80691,206 +80691,70 @@ class SetupWizard {
80691
80691
  }
80692
80692
  async run() {
80693
80693
  console.log(import_chalk.default.blue.bold(`
80694
- \uD83D\uDE80 WordPress-MDX Sync Setup Wizard
80694
+ \uD83D\uDE80 WordPress Flow Setup
80695
80695
  `));
80696
- console.log(import_chalk.default.gray(`This wizard will help you configure the connection to your WordPress site.
80696
+ console.log(import_chalk.default.gray(`Configure your project. Press Enter to use defaults.
80697
80697
  `));
80698
80698
  try {
80699
- const responses = await this.collectResponses();
80700
- const config = this.buildConfig(responses);
80699
+ const config = await this.collectConfig();
80701
80700
  await this.saveConfig(config);
80702
80701
  console.log(import_chalk.default.green.bold(`
80703
- ✅ Configuration saved successfully!`));
80704
- console.log(import_chalk.default.gray(`You can now use the CLI commands: pull, push, and dev
80702
+ ✅ Configuration saved!`));
80703
+ console.log(import_chalk.default.gray(`Run 'wordpress-flow dev' to start developing.
80705
80704
  `));
80706
80705
  return config;
80707
80706
  } finally {
80708
80707
  this.rl.close();
80709
80708
  }
80710
80709
  }
80711
- async collectResponses() {
80712
- const connectionType = await this.askConnectionType();
80713
- const wordpressUrl = await this.askWordPressUrl();
80714
- const credentials = await this.askCredentials(connectionType);
80715
- const syncPath = await this.askSyncPath();
80716
- const postTypes = await this.askPostTypes();
80717
- const conflictResolution = await this.askConflictResolution();
80718
- return {
80719
- connectionType,
80720
- wordpressUrl,
80721
- credentials,
80722
- syncPath,
80723
- postTypes,
80724
- conflictResolution
80725
- };
80726
- }
80727
- async askConnectionType() {
80728
- console.log(import_chalk.default.yellow("Connection Method:"));
80729
- console.log("1. REST API (recommended - works with any WordPress installation)");
80730
- console.log(`2. Direct Database (faster - requires database access)
80731
- `);
80732
- const choice = await this.ask("Choose connection method (1 or 2): ");
80733
- if (choice === "1") {
80734
- return "rest-api";
80735
- } else if (choice === "2") {
80736
- return "database";
80737
- } else {
80738
- console.log(import_chalk.default.red("Invalid choice. Please enter 1 or 2."));
80739
- return this.askConnectionType();
80740
- }
80741
- }
80742
- async askWordPressUrl() {
80743
- const url = await this.ask("WordPress site URL (e.g., https://example.com): ");
80744
- if (!url.startsWith("http://") && !url.startsWith("https://")) {
80745
- console.log(import_chalk.default.red("Please enter a valid URL starting with http:// or https://"));
80746
- return this.askWordPressUrl();
80710
+ async collectConfig() {
80711
+ const config = {};
80712
+ console.log(import_chalk.default.yellow("Paths:"));
80713
+ const theme = await this.ask("Theme directory (./theme): ");
80714
+ const content2 = await this.ask("Content directory (./content): ");
80715
+ const plugins = await this.ask("Plugins directory (./plugins): ");
80716
+ if (theme || content2 || plugins) {
80717
+ config.paths = {};
80718
+ if (theme)
80719
+ config.paths.theme = theme;
80720
+ if (content2)
80721
+ config.paths.content = content2;
80722
+ if (plugins)
80723
+ config.paths.plugins = plugins;
80747
80724
  }
80748
- return url.replace(/\/$/, "");
80749
- }
80750
- async askCredentials(type) {
80751
- if (type === "rest-api") {
80752
- return this.askRestApiCredentials();
80753
- } else {
80754
- return this.askDatabaseCredentials();
80755
- }
80756
- }
80757
- async askRestApiCredentials() {
80758
- console.log(import_chalk.default.yellow(`
80759
- REST API Credentials:`));
80760
- console.log(import_chalk.default.gray(`You can generate an application password in your WordPress admin under Users > Profile.
80761
- `));
80762
- const username = await this.ask("WordPress username: ");
80763
- const applicationPassword = await this.ask("Application password: ", true);
80764
- return { username, applicationPassword };
80765
- }
80766
- async askDatabaseCredentials() {
80767
- console.log(import_chalk.default.yellow(`
80768
- Database Credentials:`));
80769
- const host = await this.ask("Database host (default: localhost): ") || "localhost";
80770
- const portStr = await this.ask("Database port (default: 3306): ") || "3306";
80771
- const port = parseInt(portStr, 10);
80772
- if (isNaN(port)) {
80773
- console.log(import_chalk.default.red("Invalid port number."));
80774
- return this.askDatabaseCredentials();
80775
- }
80776
- const database = await this.ask("Database name: ");
80777
- const username = await this.ask("Database username: ");
80778
- const password = await this.ask("Database password: ", true);
80779
- return { host, port, database, username, password };
80780
- }
80781
- async askSyncPath() {
80782
- const defaultPath = "./content";
80783
- const syncPath = await this.ask(`Local sync directory (default: ${defaultPath}): `) || defaultPath;
80784
- return path.resolve(syncPath);
80785
- }
80786
- async askPostTypes() {
80787
80725
  console.log(import_chalk.default.yellow(`
80788
- Post Types:`));
80789
- console.log(import_chalk.default.gray(`Specify which post types to sync (comma-separated).
80790
- `));
80791
- const postTypesStr = await this.ask("Post types to sync (default: post,page): ") || "post,page";
80792
- return postTypesStr.split(",").map((type) => type.trim()).filter(Boolean);
80793
- }
80794
- async askConflictResolution() {
80795
- console.log(import_chalk.default.yellow(`
80796
- Conflict Resolution:`));
80797
- console.log("1. Manual - Ask for each conflict");
80798
- console.log("2. WordPress wins - Always use WordPress version");
80799
- console.log(`3. Local wins - Always use local version
80800
- `);
80801
- const choice = await this.ask("Choose conflict resolution (1, 2, or 3): ");
80802
- switch (choice) {
80803
- case "1":
80804
- return "manual";
80805
- case "2":
80806
- return "wordpress-wins";
80807
- case "3":
80808
- return "local-wins";
80809
- default:
80810
- console.log(import_chalk.default.red("Invalid choice. Please enter 1, 2, or 3."));
80811
- return this.askConflictResolution();
80812
- }
80813
- }
80814
- buildConfig(responses) {
80815
- const baseConfig = {
80816
- wordpressUrl: responses.wordpressUrl,
80817
- syncPath: responses.syncPath,
80818
- postTypes: responses.postTypes
80819
- };
80820
- let wordpress;
80821
- if (responses.connectionType === "rest-api") {
80822
- const creds = responses.credentials;
80823
- wordpress = {
80824
- type: "rest-api",
80825
- ...baseConfig,
80826
- username: creds.username,
80827
- applicationPassword: creds.applicationPassword
80828
- };
80829
- } else {
80830
- const creds = responses.credentials;
80831
- wordpress = {
80832
- type: "database",
80833
- ...baseConfig,
80834
- database: creds
80835
- };
80836
- }
80837
- return {
80838
- wordpress,
80839
- paths: {
80840
- mdxOutputDir: responses.syncPath,
80841
- postTypeMappings: responses.postTypes.reduce((acc, type) => {
80842
- acc[type] = path.join(responses.syncPath, type);
80843
- return acc;
80844
- }, {})
80845
- },
80846
- sync: {
80847
- watchForChanges: true,
80848
- conflictResolution: responses.conflictResolution,
80849
- excludePostTypes: [],
80850
- includedPostStatuses: ["publish", "draft"]
80851
- }
80852
- };
80726
+ Dev Environment:`));
80727
+ const port = await this.ask("WordPress port (8888): ");
80728
+ const dbPort = await this.ask("Database port (3306): ");
80729
+ const phpVersion = await this.ask("PHP version (8.2): ");
80730
+ const wpVersion = await this.ask("WordPress version (latest): ");
80731
+ const sqlDump = await this.ask("SQL dump file to import (none): ");
80732
+ if (port || dbPort || phpVersion || wpVersion || sqlDump) {
80733
+ config.dev = {};
80734
+ if (port)
80735
+ config.dev.port = parseInt(port, 10);
80736
+ if (dbPort)
80737
+ config.dev.databasePort = parseInt(dbPort, 10);
80738
+ if (phpVersion)
80739
+ config.dev.phpVersion = phpVersion;
80740
+ if (wpVersion)
80741
+ config.dev.wordpressVersion = wpVersion;
80742
+ if (sqlDump)
80743
+ config.dev.sqlDump = sqlDump;
80744
+ }
80745
+ return config;
80853
80746
  }
80854
80747
  async saveConfig(config) {
80855
80748
  const configPath = path.join(process.cwd(), "wordpress-flow.config.json");
80856
- const envPath = path.join(process.cwd(), ".env");
80857
- const publicConfig = { ...config };
80858
- if (publicConfig.wordpress.type === "rest-api") {
80859
- delete publicConfig.wordpress.applicationPassword;
80860
- } else {
80861
- delete publicConfig.wordpress.database.password;
80862
- }
80863
- fs.writeFileSync(configPath, JSON.stringify(publicConfig, null, 2));
80864
- console.log(import_chalk.default.gray(`Configuration saved to: ${configPath}`));
80865
- const envVars = [];
80866
- if (config.wordpress.type === "rest-api") {
80867
- envVars.push(`WP_APPLICATION_PASSWORD=${config.wordpress.applicationPassword}`);
80868
- } else {
80869
- envVars.push(`DB_PASSWORD=${config.wordpress.database.password}`);
80870
- }
80871
- let existingEnv = "";
80872
- if (fs.existsSync(envPath)) {
80873
- existingEnv = fs.readFileSync(envPath, "utf8");
80874
- }
80875
- const newEnvContent = existingEnv + `
80876
- ` + envVars.join(`
80877
- `) + `
80878
- `;
80879
- fs.writeFileSync(envPath, newEnvContent);
80880
- console.log(import_chalk.default.gray(`Credentials saved to: ${envPath}`));
80881
- }
80882
- ask(question, isPassword = false) {
80883
- return new Promise((resolve2) => {
80884
- if (isPassword) {
80885
- this.rl.question(question, (answer) => {
80886
- resolve2(answer);
80887
- });
80888
- this.rl._writeToOutput = () => {};
80889
- } else {
80890
- this.rl.question(question, (answer) => {
80891
- resolve2(answer);
80892
- });
80893
- }
80749
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
80750
+ console.log(import_chalk.default.gray(`
80751
+ Saved to: ${configPath}`));
80752
+ }
80753
+ ask(question) {
80754
+ return new Promise((resolve) => {
80755
+ this.rl.question(question, (answer) => {
80756
+ resolve(answer.trim());
80757
+ });
80894
80758
  });
80895
80759
  }
80896
80760
  }
@@ -81170,7 +81034,7 @@ class ConfigManager {
81170
81034
  },
81171
81035
  build: {
81172
81036
  blocksDir: config.paths.blocks,
81173
- outputDir: config.paths.dist,
81037
+ outputDir: config.paths.blocksDist,
81174
81038
  scriptsPath: config.paths.scripts
81175
81039
  },
81176
81040
  templates: {
@@ -82480,10 +82344,10 @@ utils_default.inherits(CanceledError, AxiosError_default, {
82480
82344
  var CanceledError_default = CanceledError;
82481
82345
 
82482
82346
  // ../../node_modules/axios/lib/core/settle.js
82483
- function settle(resolve3, reject, response) {
82347
+ function settle(resolve2, reject, response) {
82484
82348
  const validateStatus2 = response.config.validateStatus;
82485
82349
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
82486
- resolve3(response);
82350
+ resolve2(response);
82487
82351
  } else {
82488
82352
  reject(new AxiosError_default("Request failed with status code " + response.status, [AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
82489
82353
  }
@@ -83106,7 +82970,7 @@ function setProxy(options, configProxy, location) {
83106
82970
  }
83107
82971
  var isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
83108
82972
  var wrapAsync = (asyncExecutor) => {
83109
- return new Promise((resolve3, reject) => {
82973
+ return new Promise((resolve2, reject) => {
83110
82974
  let onDone;
83111
82975
  let isDone;
83112
82976
  const done = (value, isRejected) => {
@@ -83117,7 +82981,7 @@ var wrapAsync = (asyncExecutor) => {
83117
82981
  };
83118
82982
  const _resolve = (value) => {
83119
82983
  done(value);
83120
- resolve3(value);
82984
+ resolve2(value);
83121
82985
  };
83122
82986
  const _reject = (reason) => {
83123
82987
  done(reason, true);
@@ -83169,7 +83033,7 @@ var http2Transport = {
83169
83033
  }
83170
83034
  };
83171
83035
  var http_default = isHttpAdapterSupported && function httpAdapter(config) {
83172
- return wrapAsync(async function dispatchHttpRequest(resolve3, reject, onDone) {
83036
+ return wrapAsync(async function dispatchHttpRequest(resolve2, reject, onDone) {
83173
83037
  let { data, lookup, family, httpVersion = 1, http2Options } = config;
83174
83038
  const { responseType, responseEncoding } = config;
83175
83039
  const method = config.method.toUpperCase();
@@ -83250,7 +83114,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
83250
83114
  }
83251
83115
  let convertedData;
83252
83116
  if (method !== "GET") {
83253
- return settle(resolve3, reject, {
83117
+ return settle(resolve2, reject, {
83254
83118
  status: 405,
83255
83119
  statusText: "method not allowed",
83256
83120
  headers: {},
@@ -83272,7 +83136,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
83272
83136
  } else if (responseType === "stream") {
83273
83137
  convertedData = stream3.Readable.from(convertedData);
83274
83138
  }
83275
- return settle(resolve3, reject, {
83139
+ return settle(resolve2, reject, {
83276
83140
  data: convertedData,
83277
83141
  status: 200,
83278
83142
  statusText: "OK",
@@ -83457,7 +83321,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
83457
83321
  };
83458
83322
  if (responseType === "stream") {
83459
83323
  response.data = responseStream;
83460
- settle(resolve3, reject, response);
83324
+ settle(resolve2, reject, response);
83461
83325
  } else {
83462
83326
  const responseBuffer = [];
83463
83327
  let totalResponseBytes = 0;
@@ -83496,7 +83360,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
83496
83360
  } catch (err) {
83497
83361
  return reject(AxiosError_default.from(err, null, config, response.request, response));
83498
83362
  }
83499
- settle(resolve3, reject, response);
83363
+ settle(resolve2, reject, response);
83500
83364
  });
83501
83365
  }
83502
83366
  abortEmitter.once("abort", (err) => {
@@ -83724,7 +83588,7 @@ var resolveConfig_default = (config) => {
83724
83588
  // ../../node_modules/axios/lib/adapters/xhr.js
83725
83589
  var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
83726
83590
  var xhr_default = isXHRAdapterSupported && function(config) {
83727
- return new Promise(function dispatchXhrRequest(resolve3, reject) {
83591
+ return new Promise(function dispatchXhrRequest(resolve2, reject) {
83728
83592
  const _config = resolveConfig_default(config);
83729
83593
  let requestData = _config.data;
83730
83594
  const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
@@ -83756,7 +83620,7 @@ var xhr_default = isXHRAdapterSupported && function(config) {
83756
83620
  request
83757
83621
  };
83758
83622
  settle(function _resolve(value) {
83759
- resolve3(value);
83623
+ resolve2(value);
83760
83624
  done();
83761
83625
  }, function _reject(err) {
83762
83626
  reject(err);
@@ -84113,8 +83977,8 @@ var factory = (env) => {
84113
83977
  responseType = responseType || "text";
84114
83978
  let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](response, config);
84115
83979
  !isStreamResponse && unsubscribe && unsubscribe();
84116
- return await new Promise((resolve3, reject) => {
84117
- settle(resolve3, reject, {
83980
+ return await new Promise((resolve2, reject) => {
83981
+ settle(resolve2, reject, {
84118
83982
  data: responseData,
84119
83983
  headers: AxiosHeaders_default.from(response.headers),
84120
83984
  status: response.status,
@@ -84462,8 +84326,8 @@ class CancelToken {
84462
84326
  throw new TypeError("executor must be a function.");
84463
84327
  }
84464
84328
  let resolvePromise;
84465
- this.promise = new Promise(function promiseExecutor(resolve3) {
84466
- resolvePromise = resolve3;
84329
+ this.promise = new Promise(function promiseExecutor(resolve2) {
84330
+ resolvePromise = resolve2;
84467
84331
  });
84468
84332
  const token = this;
84469
84333
  this.promise.then((cancel) => {
@@ -84477,9 +84341,9 @@ class CancelToken {
84477
84341
  });
84478
84342
  this.promise.then = (onfulfilled) => {
84479
84343
  let _resolve;
84480
- const promise = new Promise((resolve3) => {
84481
- token.subscribe(resolve3);
84482
- _resolve = resolve3;
84344
+ const promise = new Promise((resolve2) => {
84345
+ token.subscribe(resolve2);
84346
+ _resolve = resolve2;
84483
84347
  }).then(onfulfilled);
84484
84348
  promise.cancel = function reject() {
84485
84349
  token.unsubscribe(_resolve);
@@ -89032,10 +88896,10 @@ class Minipass extends EventEmitter2 {
89032
88896
  return this[ENCODING] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
89033
88897
  }
89034
88898
  async promise() {
89035
- return new Promise((resolve3, reject) => {
88899
+ return new Promise((resolve2, reject) => {
89036
88900
  this.on(DESTROYED, () => reject(new Error("stream destroyed")));
89037
88901
  this.on("error", (er) => reject(er));
89038
- this.on("end", () => resolve3());
88902
+ this.on("end", () => resolve2());
89039
88903
  });
89040
88904
  }
89041
88905
  [Symbol.asyncIterator]() {
@@ -89054,7 +88918,7 @@ class Minipass extends EventEmitter2 {
89054
88918
  return Promise.resolve({ done: false, value: res });
89055
88919
  if (this[EOF])
89056
88920
  return stop();
89057
- let resolve3;
88921
+ let resolve2;
89058
88922
  let reject;
89059
88923
  const onerr = (er) => {
89060
88924
  this.off("data", ondata);
@@ -89068,19 +88932,19 @@ class Minipass extends EventEmitter2 {
89068
88932
  this.off("end", onend);
89069
88933
  this.off(DESTROYED, ondestroy);
89070
88934
  this.pause();
89071
- resolve3({ value, done: !!this[EOF] });
88935
+ resolve2({ value, done: !!this[EOF] });
89072
88936
  };
89073
88937
  const onend = () => {
89074
88938
  this.off("error", onerr);
89075
88939
  this.off("data", ondata);
89076
88940
  this.off(DESTROYED, ondestroy);
89077
88941
  stop();
89078
- resolve3({ done: true, value: undefined });
88942
+ resolve2({ done: true, value: undefined });
89079
88943
  };
89080
88944
  const ondestroy = () => onerr(new Error("stream destroyed"));
89081
88945
  return new Promise((res2, rej) => {
89082
88946
  reject = rej;
89083
- resolve3 = res2;
88947
+ resolve2 = res2;
89084
88948
  this.once(DESTROYED, ondestroy);
89085
88949
  this.once("error", onerr);
89086
88950
  this.once("end", onend);
@@ -89780,8 +89644,8 @@ class PathBase {
89780
89644
  if (this.#asyncReaddirInFlight) {
89781
89645
  await this.#asyncReaddirInFlight;
89782
89646
  } else {
89783
- let resolve3 = () => {};
89784
- this.#asyncReaddirInFlight = new Promise((res) => resolve3 = res);
89647
+ let resolve2 = () => {};
89648
+ this.#asyncReaddirInFlight = new Promise((res) => resolve2 = res);
89785
89649
  try {
89786
89650
  for (const e of await this.#fs.promises.readdir(fullpath, {
89787
89651
  withFileTypes: true
@@ -89794,7 +89658,7 @@ class PathBase {
89794
89658
  children.provisional = 0;
89795
89659
  }
89796
89660
  this.#asyncReaddirInFlight = undefined;
89797
- resolve3();
89661
+ resolve2();
89798
89662
  }
89799
89663
  return children.slice(0, children.provisional);
89800
89664
  }
@@ -105057,10 +104921,10 @@ function resolveAll(constructs, events, context) {
105057
104921
  const called = [];
105058
104922
  let index2 = -1;
105059
104923
  while (++index2 < constructs.length) {
105060
- const resolve3 = constructs[index2].resolveAll;
105061
- if (resolve3 && !called.includes(resolve3)) {
105062
- events = resolve3(events, context);
105063
- called.push(resolve3);
104924
+ const resolve2 = constructs[index2].resolveAll;
104925
+ if (resolve2 && !called.includes(resolve2)) {
104926
+ events = resolve2(events, context);
104927
+ called.push(resolve2);
105064
104928
  }
105065
104929
  }
105066
104930
  return events;
@@ -111108,7 +110972,7 @@ class Processor2 extends CallableInstance {
111108
110972
  assertParser("process", this.parser || this.Parser);
111109
110973
  assertCompiler("process", this.compiler || this.Compiler);
111110
110974
  return done ? executor(undefined, done) : new Promise(executor);
111111
- function executor(resolve3, reject) {
110975
+ function executor(resolve2, reject) {
111112
110976
  const realFile = vfile(file);
111113
110977
  const parseTree = self2.parse(realFile);
111114
110978
  self2.run(parseTree, realFile, function(error, tree, file2) {
@@ -111127,8 +110991,8 @@ class Processor2 extends CallableInstance {
111127
110991
  function realDone(error, file2) {
111128
110992
  if (error || !file2) {
111129
110993
  reject(error);
111130
- } else if (resolve3) {
111131
- resolve3(file2);
110994
+ } else if (resolve2) {
110995
+ resolve2(file2);
111132
110996
  } else {
111133
110997
  ok(done, "`done` is defined if `resolve` is not");
111134
110998
  done(undefined, file2);
@@ -111161,7 +111025,7 @@ class Processor2 extends CallableInstance {
111161
111025
  file = undefined;
111162
111026
  }
111163
111027
  return done ? executor(undefined, done) : new Promise(executor);
111164
- function executor(resolve3, reject) {
111028
+ function executor(resolve2, reject) {
111165
111029
  ok(typeof file !== "function", "`file` can’t be a `done` anymore, we checked");
111166
111030
  const realFile = vfile(file);
111167
111031
  transformers.run(tree, realFile, realDone);
@@ -111169,8 +111033,8 @@ class Processor2 extends CallableInstance {
111169
111033
  const resultingTree = outputTree || tree;
111170
111034
  if (error) {
111171
111035
  reject(error);
111172
- } else if (resolve3) {
111173
- resolve3(resultingTree);
111036
+ } else if (resolve2) {
111037
+ resolve2(resultingTree);
111174
111038
  } else {
111175
111039
  ok(done, "`done` is defined if `resolve` is not");
111176
111040
  done(undefined, resultingTree, file2);
@@ -113061,7 +112925,7 @@ class PushCommand {
113061
112925
  this.blockRegistry = blockRegistry;
113062
112926
  } else {
113063
112927
  const config = this.configManager.getConfig();
113064
- const buildOutputDir = this.configManager.resolvePath(config.paths.dist);
112928
+ const buildOutputDir = this.configManager.resolvePath(config.paths.blocksDist);
113065
112929
  this.blockRegistry = new BlockRegistry(buildOutputDir);
113066
112930
  }
113067
112931
  }
@@ -114743,6 +114607,7 @@ import * as os from "os";
114743
114607
  class AbortableWorkerPool {
114744
114608
  concurrency;
114745
114609
  outputDir;
114610
+ scriptsOutputDir;
114746
114611
  webpackConfigPath;
114747
114612
  scriptsPath;
114748
114613
  workerPath;
@@ -114750,6 +114615,7 @@ class AbortableWorkerPool {
114750
114615
  constructor(options) {
114751
114616
  this.concurrency = options.concurrency ?? Math.max(1, os.cpus().length - 1);
114752
114617
  this.outputDir = options.outputDir;
114618
+ this.scriptsOutputDir = options.scriptsOutputDir;
114753
114619
  this.webpackConfigPath = options.webpackConfigPath;
114754
114620
  this.scriptsPath = options.scriptsPath;
114755
114621
  this.workerPath = path9.join(import.meta.dirname, "build", "block-build-worker.js");
@@ -114802,7 +114668,7 @@ class AbortableWorkerPool {
114802
114668
  const total = blocks.length;
114803
114669
  let activeCount = 0;
114804
114670
  logger.debug(`Building ${total} block(s) with ${this.concurrency} worker(s)`);
114805
- return new Promise((resolve4) => {
114671
+ return new Promise((resolve3) => {
114806
114672
  const processNext = () => {
114807
114673
  while (activeCount < this.concurrency && queue.length > 0) {
114808
114674
  const block = queue.shift();
@@ -114811,26 +114677,27 @@ class AbortableWorkerPool {
114811
114677
  results.push(result2);
114812
114678
  completed++;
114813
114679
  activeCount--;
114814
- onProgress?.(completed, total, result2.blockName, result2.success, result2.aborted || false);
114680
+ onProgress?.(completed, total, result2.blockName, result2.success, result2.error);
114815
114681
  if (queue.length > 0) {
114816
114682
  processNext();
114817
114683
  } else if (activeCount === 0) {
114818
- resolve4(results);
114684
+ resolve3(results);
114819
114685
  }
114820
114686
  }).catch((error) => {
114687
+ const errorMsg = error.message || String(error);
114821
114688
  const result2 = {
114822
114689
  success: false,
114823
114690
  blockName: block.name,
114824
- error: error.message || String(error)
114691
+ error: errorMsg
114825
114692
  };
114826
114693
  results.push(result2);
114827
114694
  completed++;
114828
114695
  activeCount--;
114829
- onProgress?.(completed, total, block.name, false, false);
114696
+ onProgress?.(completed, total, block.name, false, errorMsg);
114830
114697
  if (queue.length > 0) {
114831
114698
  processNext();
114832
114699
  } else if (activeCount === 0) {
114833
- resolve4(results);
114700
+ resolve3(results);
114834
114701
  }
114835
114702
  });
114836
114703
  }
@@ -114839,7 +114706,7 @@ class AbortableWorkerPool {
114839
114706
  });
114840
114707
  }
114841
114708
  buildBlockInWorker(block) {
114842
- return new Promise((resolve4, reject) => {
114709
+ return new Promise((resolve3, reject) => {
114843
114710
  const tempDir = path9.join(process.cwd(), ".wordpress-flow-temp", `worker-${block.name}-${Date.now()}`);
114844
114711
  const workerData = {
114845
114712
  block: {
@@ -114848,6 +114715,7 @@ class AbortableWorkerPool {
114848
114715
  scripts: block.scripts
114849
114716
  },
114850
114717
  outputDir: this.outputDir,
114718
+ scriptsOutputDir: this.scriptsOutputDir,
114851
114719
  webpackConfigPath: this.webpackConfigPath,
114852
114720
  scriptsPath: this.scriptsPath,
114853
114721
  tempDir
@@ -114865,7 +114733,7 @@ class AbortableWorkerPool {
114865
114733
  if (this.activeWorkers.has(block.name)) {
114866
114734
  this.activeWorkers.delete(block.name);
114867
114735
  worker.terminate();
114868
- resolve4({
114736
+ resolve3({
114869
114737
  success: false,
114870
114738
  blockName: block.name,
114871
114739
  error: `Build timeout after 5 minutes`,
@@ -114877,7 +114745,7 @@ class AbortableWorkerPool {
114877
114745
  clearTimeout(timeout);
114878
114746
  this.activeWorkers.delete(block.name);
114879
114747
  if (activeWorker.aborted) {
114880
- resolve4({
114748
+ resolve3({
114881
114749
  success: false,
114882
114750
  blockName: block.name,
114883
114751
  aborted: true,
@@ -114886,7 +114754,7 @@ class AbortableWorkerPool {
114886
114754
  return;
114887
114755
  }
114888
114756
  worker.terminate();
114889
- resolve4({
114757
+ resolve3({
114890
114758
  ...result2,
114891
114759
  buildTimeMs: Date.now() - startTime
114892
114760
  });
@@ -114896,7 +114764,7 @@ class AbortableWorkerPool {
114896
114764
  this.activeWorkers.delete(block.name);
114897
114765
  worker.terminate();
114898
114766
  if (activeWorker.aborted) {
114899
- resolve4({
114767
+ resolve3({
114900
114768
  success: false,
114901
114769
  blockName: block.name,
114902
114770
  aborted: true,
@@ -114904,7 +114772,7 @@ class AbortableWorkerPool {
114904
114772
  });
114905
114773
  return;
114906
114774
  }
114907
- resolve4({
114775
+ resolve3({
114908
114776
  success: false,
114909
114777
  blockName: block.name,
114910
114778
  error: error.message,
@@ -114916,14 +114784,14 @@ class AbortableWorkerPool {
114916
114784
  if (this.activeWorkers.has(block.name)) {
114917
114785
  this.activeWorkers.delete(block.name);
114918
114786
  if (activeWorker.aborted) {
114919
- resolve4({
114787
+ resolve3({
114920
114788
  success: false,
114921
114789
  blockName: block.name,
114922
114790
  aborted: true,
114923
114791
  buildTimeMs: Date.now() - startTime
114924
114792
  });
114925
114793
  } else if (code2 !== 0) {
114926
- resolve4({
114794
+ resolve3({
114927
114795
  success: false,
114928
114796
  blockName: block.name,
114929
114797
  error: `Worker exited with code ${code2}`,
@@ -116231,7 +116099,7 @@ class DockerEnvManager {
116231
116099
  return `http://localhost:${this.config.dev.port}`;
116232
116100
  }
116233
116101
  sleep(ms) {
116234
- return new Promise((resolve6) => setTimeout(resolve6, ms));
116102
+ return new Promise((resolve5) => setTimeout(resolve5, ms));
116235
116103
  }
116236
116104
  async cleanup() {
116237
116105
  logger.info("\uD83E\uDDF9 Cleaning up Docker environment...");
@@ -116264,7 +116132,7 @@ class DockerEnvManager {
116264
116132
  // package.json
116265
116133
  var package_default = {
116266
116134
  name: "@wordpress-flow/cli",
116267
- version: "1.2.1",
116135
+ version: "1.2.3",
116268
116136
  type: "module",
116269
116137
  description: "TypeScript-based WordPress block creation system",
116270
116138
  main: "dist/index.js",
@@ -116341,6 +116209,7 @@ class DevModeOrchestrator {
116341
116209
  isRunning = false;
116342
116210
  blocksDir;
116343
116211
  outputDir;
116212
+ scriptsOutputDir;
116344
116213
  templatesDir;
116345
116214
  templatesOutputDir;
116346
116215
  templatePartsDir;
@@ -116461,7 +116330,8 @@ class DevModeOrchestrator {
116461
116330
  async initializeConfig() {
116462
116331
  const config = this.configManager.getConfig();
116463
116332
  this.blocksDir = this.configManager.resolvePath(config.paths.blocks);
116464
- this.outputDir = this.configManager.resolvePath(config.paths.dist);
116333
+ this.outputDir = this.configManager.resolvePath(config.paths.blocksDist);
116334
+ this.scriptsOutputDir = this.configManager.resolvePath(config.paths.scriptsDist);
116465
116335
  this.webpackConfig = path17.join(__dirname2, "..", "webpack.config.cjs");
116466
116336
  this.scriptsPath = this.configManager.resolvePath(config.paths.scripts);
116467
116337
  this.contentDir = this.configManager.resolvePath(config.paths.content);
@@ -116472,11 +116342,15 @@ class DevModeOrchestrator {
116472
116342
  if (!fs15.existsSync(this.outputDir)) {
116473
116343
  fs15.mkdirSync(this.outputDir, { recursive: true });
116474
116344
  }
116345
+ if (!fs15.existsSync(this.scriptsOutputDir)) {
116346
+ fs15.mkdirSync(this.scriptsOutputDir, { recursive: true });
116347
+ }
116475
116348
  }
116476
116349
  initializeManagers() {
116477
116350
  this.workerPool = new AbortableWorkerPool({
116478
116351
  concurrency: this.options.concurrency,
116479
116352
  outputDir: this.outputDir,
116353
+ scriptsOutputDir: this.scriptsOutputDir,
116480
116354
  webpackConfigPath: this.webpackConfig,
116481
116355
  scriptsPath: this.scriptsPath
116482
116356
  });
@@ -116555,12 +116429,12 @@ class DevModeOrchestrator {
116555
116429
  let successCount = 0;
116556
116430
  let failCount = 0;
116557
116431
  const blockScripts = new Map;
116558
- const results = await this.workerPool.buildAll(blocksToRebuild, (completed, total, blockName, success) => {
116432
+ const results = await this.workerPool.buildAll(blocksToRebuild, (completed, total, blockName, success, error) => {
116559
116433
  if (success) {
116560
116434
  console.log(` ✅ ${blockName} [${completed}/${total}]`);
116561
116435
  successCount++;
116562
116436
  } else {
116563
- console.log(` ❌ ${blockName} failed [${completed}/${total}]`);
116437
+ console.log(` ❌ ${blockName} failed [${completed}/${total}]: ${error || "unknown error"}`);
116564
116438
  failCount++;
116565
116439
  }
116566
116440
  });
@@ -116578,7 +116452,8 @@ class DevModeOrchestrator {
116578
116452
  }
116579
116453
  }
116580
116454
  if (blockScripts.size > 0) {
116581
- const phpPath = path17.join(path17.dirname(this.outputDir), "functions-blocks-scripts.php");
116455
+ const distDir = path17.dirname(this.outputDir);
116456
+ const phpPath = path17.join(distDir, "functions-blocks-scripts.php");
116582
116457
  this.phpGenerator.generateScriptRegistrationPHP(blockScripts, phpPath);
116583
116458
  }
116584
116459
  await this.generateTypeDefinitions();
@@ -117632,7 +117507,7 @@ class WorkerPool {
117632
117507
  const total = blocks.length;
117633
117508
  let activeWorkers = 0;
117634
117509
  logger.info(`Building ${total} block(s) with ${this.concurrency} worker(s)`);
117635
- return new Promise((resolve8, reject) => {
117510
+ return new Promise((resolve7, reject) => {
117636
117511
  const processNext = () => {
117637
117512
  while (activeWorkers < this.concurrency && queue.length > 0) {
117638
117513
  const block = queue.shift();
@@ -117641,11 +117516,11 @@ class WorkerPool {
117641
117516
  results.push(result2);
117642
117517
  completed++;
117643
117518
  activeWorkers--;
117644
- onProgress?.(completed, total, result2.blockName, result2.success);
117519
+ onProgress?.(completed, total, result2.blockName, result2.success, result2.error);
117645
117520
  if (queue.length > 0) {
117646
117521
  processNext();
117647
117522
  } else if (activeWorkers === 0) {
117648
- resolve8(results);
117523
+ resolve7(results);
117649
117524
  }
117650
117525
  }).catch((error) => {
117651
117526
  const result2 = {
@@ -117656,11 +117531,11 @@ class WorkerPool {
117656
117531
  results.push(result2);
117657
117532
  completed++;
117658
117533
  activeWorkers--;
117659
- onProgress?.(completed, total, block.name, false);
117534
+ onProgress?.(completed, total, block.name, false, result2.error);
117660
117535
  if (queue.length > 0) {
117661
117536
  processNext();
117662
117537
  } else if (activeWorkers === 0) {
117663
- resolve8(results);
117538
+ resolve7(results);
117664
117539
  }
117665
117540
  });
117666
117541
  }
@@ -117669,7 +117544,7 @@ class WorkerPool {
117669
117544
  });
117670
117545
  }
117671
117546
  buildBlockInWorker(block) {
117672
- return new Promise((resolve8, reject) => {
117547
+ return new Promise((resolve7, reject) => {
117673
117548
  const tempDir = path21.join(process.cwd(), ".wordpress-flow-temp", `worker-${block.name}-${Date.now()}`);
117674
117549
  const workerData = {
117675
117550
  block: {
@@ -117691,7 +117566,7 @@ class WorkerPool {
117691
117566
  worker.on("message", (result2) => {
117692
117567
  clearTimeout(timeout);
117693
117568
  worker.terminate();
117694
- resolve8(result2);
117569
+ resolve7(result2);
117695
117570
  });
117696
117571
  worker.on("error", (error) => {
117697
117572
  clearTimeout(timeout);
@@ -117777,11 +117652,11 @@ class BuildCommand {
117777
117652
  webpackConfigPath: webpackConfig,
117778
117653
  scriptsPath
117779
117654
  });
117780
- const results = await workerPool.buildAll(blocks, (completed, total, blockName, success) => {
117655
+ const results = await workerPool.buildAll(blocks, (completed, total, blockName, success, error) => {
117781
117656
  if (success) {
117782
117657
  logger.success(`✅ Built: ${blockName} [${completed}/${total}]`);
117783
117658
  } else {
117784
- logger.error(`❌ Failed: ${blockName} [${completed}/${total}]`);
117659
+ logger.error(`❌ Failed: ${blockName} [${completed}/${total}]: ${error || "unknown error"}`);
117785
117660
  }
117786
117661
  });
117787
117662
  for (const block of blocks) {
@@ -117802,7 +117677,8 @@ Failed to build ${failures.length} block(s):`);
117802
117677
  }
117803
117678
  }
117804
117679
  if (this.blockScripts.size > 0) {
117805
- const phpPath = path22.join(path22.dirname(outputDir), "functions-blocks-scripts.php");
117680
+ const distDir = path22.dirname(outputDir);
117681
+ const phpPath = path22.join(distDir, "functions-blocks-scripts.php");
117806
117682
  this.phpGenerator.generateScriptRegistrationPHP(this.blockScripts, phpPath);
117807
117683
  }
117808
117684
  await this.generateTypeDefinitions(outputDir);
@@ -117857,7 +117733,7 @@ class BuildTemplatesCommand {
117857
117733
  return;
117858
117734
  }
117859
117735
  fs19.mkdirSync(outputDir, { recursive: true });
117860
- const blocksOutputDir = this.configManager.resolvePath(config.paths.dist);
117736
+ const blocksOutputDir = this.configManager.resolvePath(config.paths.blocksDist);
117861
117737
  const blockRegistry = new BlockRegistry(blocksOutputDir);
117862
117738
  await blockRegistry.loadBuiltBlocks();
117863
117739
  logger.info(`Loaded ${blockRegistry.getAllComponentMappings().length} built blocks`);
@@ -118119,12 +117995,31 @@ program2.command("database export").description("Export Docker database to SQL f
118119
117995
  async function ensureConfiguration() {
118120
117996
  const configManager = ConfigManager.getInstance();
118121
117997
  if (!configManager.hasConfig()) {
118122
- console.log(import_chalk4.default.yellow("⚠️ No configuration found. Running setup wizard..."));
118123
- const wizard = new SetupWizard;
118124
- await wizard.run();
117998
+ const shouldCreate = await askYesNo(import_chalk4.default.yellow("⚠️ No configuration found. Create wordpress-flow.config.json with defaults?"));
117999
+ if (shouldCreate) {
118000
+ await configManager.saveConfig({});
118001
+ console.log(import_chalk4.default.green("✅ Created wordpress-flow.config.json"));
118002
+ } else {
118003
+ console.log(import_chalk4.default.gray("Aborted. Run 'wordpress-flow setup' to configure manually."));
118004
+ process.exit(0);
118005
+ }
118125
118006
  }
118126
118007
  await configManager.loadConfig();
118127
118008
  }
118009
+ function askYesNo(question) {
118010
+ return new Promise((resolve7) => {
118011
+ const readline2 = __require("readline");
118012
+ const rl = readline2.createInterface({
118013
+ input: process.stdin,
118014
+ output: process.stdout
118015
+ });
118016
+ rl.question(`${question} (Y/n): `, (answer) => {
118017
+ rl.close();
118018
+ const normalized = answer.trim().toLowerCase();
118019
+ resolve7(normalized === "" || normalized === "y" || normalized === "yes");
118020
+ });
118021
+ });
118022
+ }
118128
118023
  async function main() {
118129
118024
  try {
118130
118025
  await program2.parseAsync();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress-flow/cli",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "type": "module",
5
5
  "description": "TypeScript-based WordPress block creation system",
6
6
  "main": "dist/index.js",