@donotdev/cli 0.0.36 → 0.1.0

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.
Files changed (64) hide show
  1. package/LICENSE.md +21 -48
  2. package/dependencies-matrix.json +24 -24
  3. package/dist/bin/commands/agent-setup.js +6965 -125
  4. package/dist/bin/commands/build.js +6 -3
  5. package/dist/bin/commands/bump.js +35 -15
  6. package/dist/bin/commands/cacheout.js +19 -3
  7. package/dist/bin/commands/coach.js +6 -3
  8. package/dist/bin/commands/create-app.js +18 -4
  9. package/dist/bin/commands/create-project.js +19 -5
  10. package/dist/bin/commands/db.js +1700 -3786
  11. package/dist/bin/commands/deploy.js +144 -98
  12. package/dist/bin/commands/dev.js +8 -7
  13. package/dist/bin/commands/doctor.js +6 -3
  14. package/dist/bin/commands/emu.js +8 -7
  15. package/dist/bin/commands/format.js +7 -5
  16. package/dist/bin/commands/get-demo.js +18 -4
  17. package/dist/bin/commands/make-admin.js +1809 -179
  18. package/dist/bin/commands/preview.js +8 -7
  19. package/dist/bin/commands/seed.js +1700 -3786
  20. package/dist/bin/commands/setup-cicd.js +6 -3
  21. package/dist/bin/commands/setup.js +23 -20
  22. package/dist/bin/commands/staging.js +144 -98
  23. package/dist/bin/commands/sync-secrets.js +6 -3
  24. package/dist/bin/commands/type-check.js +6 -3
  25. package/dist/bin/commands/wai.js +6 -3
  26. package/dist/bin/dndev.js +21 -1
  27. package/dist/bin/donotdev.js +21 -1
  28. package/dist/index.js +172 -107
  29. package/package.json +2 -2
  30. package/templates/app-next/src/locales/home_en.json.example +6 -6
  31. package/templates/app-vite/src/locales/home_en.json.example +6 -6
  32. package/templates/functions-supabase/supabase/functions/.env.example +12 -0
  33. package/templates/functions-supabase/supabase/functions/disconnect-oauth/index.ts.example +7 -0
  34. package/templates/functions-supabase/supabase/functions/exchange-token/index.ts.example +7 -0
  35. package/templates/functions-supabase/supabase/functions/get-connections/index.ts.example +7 -0
  36. package/templates/functions-supabase/supabase/functions/refresh-token/index.ts.example +7 -0
  37. package/templates/preset-admin/src/pages/DashboardPage.tsx.example +189 -0
  38. package/templates/preset-admin/src/pages/EntityPage.tsx.example +84 -0
  39. package/templates/preset-admin/src/pages/ReportsPage.tsx.example +243 -0
  40. package/templates/preset-admin/src/pages/SettingsPage.tsx.example +283 -0
  41. package/templates/preset-admin/src/pages/UsersPage.tsx.example +128 -0
  42. package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +167 -0
  43. package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +187 -0
  44. package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +244 -0
  45. package/templates/preset-ecommerce/src/pages/HomePage.tsx.example +268 -0
  46. package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +228 -0
  47. package/templates/preset-landing/src/pages/AboutPage.tsx.example +237 -0
  48. package/templates/preset-landing/src/pages/ContactPage.tsx.example +192 -0
  49. package/templates/preset-landing/src/pages/HomePage.tsx.example +399 -0
  50. package/templates/preset-saas/src/pages/DashboardPage.tsx.example +195 -0
  51. package/templates/preset-saas/src/pages/HomePage.tsx.example +270 -0
  52. package/templates/preset-saas/src/pages/PricingPage.tsx.example +204 -0
  53. package/templates/preset-saas/src/pages/ProfilePage.tsx.example +191 -0
  54. package/templates/preset-saas/src/pages/SettingsPage.tsx.example +292 -0
  55. package/templates/root-consumer/.claude/commands/brainstorm.md.example +28 -0
  56. package/templates/root-consumer/.claude/commands/design.md.example +31 -0
  57. package/templates/root-consumer/.claude/commands/grill.md.example +33 -6
  58. package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +16 -0
  59. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +50 -0
  60. package/templates/root-consumer/.claude/skills/design/SKILL.md.example +17 -0
  61. package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +11 -5
  62. package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +2 -1
  63. package/templates/root-consumer/guides/dndev/advanced/COOKIE_REFERENCE.md.example +252 -252
  64. package/templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example +174 -174
@@ -167,7 +167,7 @@ var require_picocolors = __commonJS({
167
167
  }
168
168
  });
169
169
 
170
- // node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs
170
+ // node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
171
171
  import { stdin as j, stdout as M } from "node:process";
172
172
  import * as g from "node:readline";
173
173
  import O from "node:readline";
@@ -283,7 +283,7 @@ function fD({ input: e2 = j, output: u2 = M, overwrite: t = true, hideCursor: F2
283
283
  }
284
284
  var import_sisteransi, import_picocolors, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, d, oD, y, V, nD, G, _, z, K, aD, k, hD, lD, xD, B, AD, S, gD, vD, h, x, dD, A, OD, PD, J, LD, RD;
285
285
  var init_dist = __esm({
286
- "node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs"() {
286
+ "node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs"() {
287
287
  init_utils();
288
288
  import_sisteransi = __toESM(require_src(), 1);
289
289
  import_picocolors = __toESM(require_picocolors(), 1);
@@ -3351,9 +3351,9 @@ var require_parse2 = __commonJS({
3351
3351
  const idx = prev.value.lastIndexOf("[");
3352
3352
  const pre = prev.value.slice(0, idx);
3353
3353
  const rest2 = prev.value.slice(idx + 2);
3354
- const posix2 = POSIX_REGEX_SOURCE[rest2];
3355
- if (posix2) {
3356
- prev.value = pre + posix2;
3354
+ const posix = POSIX_REGEX_SOURCE[rest2];
3355
+ if (posix) {
3356
+ prev.value = pre + posix;
3357
3357
  state.backtrack = true;
3358
3358
  advance();
3359
3359
  if (!bos.output && tokens.indexOf(prev) === 1) {
@@ -3875,7 +3875,7 @@ var require_picomatch = __commonJS({
3875
3875
  throw new TypeError("Expected pattern to be a non-empty string");
3876
3876
  }
3877
3877
  const opts = options || {};
3878
- const posix2 = utils.isWindows(options);
3878
+ const posix = utils.isWindows(options);
3879
3879
  const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
3880
3880
  const state = regex.state;
3881
3881
  delete regex.state;
@@ -3885,8 +3885,8 @@ var require_picomatch = __commonJS({
3885
3885
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
3886
3886
  }
3887
3887
  const matcher = (input, returnObject = false) => {
3888
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix: posix2 });
3889
- const result = { glob, state, regex, posix: posix2, input, output, match, isMatch };
3888
+ const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
3889
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
3890
3890
  if (typeof opts.onResult === "function") {
3891
3891
  opts.onResult(result);
3892
3892
  }
@@ -3911,7 +3911,7 @@ var require_picomatch = __commonJS({
3911
3911
  }
3912
3912
  return matcher;
3913
3913
  };
3914
- picomatch.test = (input, regex, options, { glob, posix: posix2 } = {}) => {
3914
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
3915
3915
  if (typeof input !== "string") {
3916
3916
  throw new TypeError("Expected input to be a string");
3917
3917
  }
@@ -3919,7 +3919,7 @@ var require_picomatch = __commonJS({
3919
3919
  return { isMatch: false, output: "" };
3920
3920
  }
3921
3921
  const opts = options || {};
3922
- const format = opts.format || (posix2 ? utils.toPosixSlashes : null);
3922
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
3923
3923
  let match = input === glob;
3924
3924
  let output = match && format ? format(input) : input;
3925
3925
  if (match === false) {
@@ -3928,14 +3928,14 @@ var require_picomatch = __commonJS({
3928
3928
  }
3929
3929
  if (match === false || opts.capture === true) {
3930
3930
  if (opts.matchBase === true || opts.basename === true) {
3931
- match = picomatch.matchBase(input, regex, options, posix2);
3931
+ match = picomatch.matchBase(input, regex, options, posix);
3932
3932
  } else {
3933
3933
  match = regex.exec(output);
3934
3934
  }
3935
3935
  }
3936
3936
  return { isMatch: Boolean(match), match, output };
3937
3937
  };
3938
- picomatch.matchBase = (input, glob, options, posix2 = utils.isWindows(options)) => {
3938
+ picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
3939
3939
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
3940
3940
  return regex.test(path.basename(input));
3941
3941
  };
@@ -4126,9 +4126,9 @@ var require_micromatch = __commonJS({
4126
4126
  return [].concat(patterns).every((p2) => picomatch(p2, options)(str));
4127
4127
  };
4128
4128
  micromatch.capture = (glob, input, options) => {
4129
- let posix2 = utils.isWindows(options);
4129
+ let posix = utils.isWindows(options);
4130
4130
  let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
4131
- let match = regex.exec(posix2 ? utils.toPosixSlashes(input) : input);
4131
+ let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
4132
4132
  if (match) {
4133
4133
  return match.slice(1).map((v2) => v2 === void 0 ? "" : v2);
4134
4134
  }
@@ -4308,15 +4308,15 @@ var require_pattern = __commonJS({
4308
4308
  exports.removeDuplicateSlashes = removeDuplicateSlashes;
4309
4309
  function partitionAbsoluteAndRelative(patterns) {
4310
4310
  const absolute = [];
4311
- const relative4 = [];
4311
+ const relative3 = [];
4312
4312
  for (const pattern of patterns) {
4313
4313
  if (isAbsolute(pattern)) {
4314
4314
  absolute.push(pattern);
4315
4315
  } else {
4316
- relative4.push(pattern);
4316
+ relative3.push(pattern);
4317
4317
  }
4318
4318
  }
4319
- return [absolute, relative4];
4319
+ return [absolute, relative3];
4320
4320
  }
4321
4321
  exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
4322
4322
  function isAbsolute(pattern) {
@@ -4616,7 +4616,7 @@ var require_async = __commonJS({
4616
4616
  init_utils();
4617
4617
  Object.defineProperty(exports, "__esModule", { value: true });
4618
4618
  exports.read = void 0;
4619
- function read(path, settings, callback) {
4619
+ function read2(path, settings, callback) {
4620
4620
  settings.fs.lstat(path, (lstatError, lstat) => {
4621
4621
  if (lstatError !== null) {
4622
4622
  callFailureCallback(callback, lstatError);
@@ -4626,7 +4626,7 @@ var require_async = __commonJS({
4626
4626
  callSuccessCallback(callback, lstat);
4627
4627
  return;
4628
4628
  }
4629
- settings.fs.stat(path, (statError, stat2) => {
4629
+ settings.fs.stat(path, (statError, stat) => {
4630
4630
  if (statError !== null) {
4631
4631
  if (settings.throwErrorOnBrokenSymbolicLink) {
4632
4632
  callFailureCallback(callback, statError);
@@ -4636,13 +4636,13 @@ var require_async = __commonJS({
4636
4636
  return;
4637
4637
  }
4638
4638
  if (settings.markSymbolicLink) {
4639
- stat2.isSymbolicLink = () => true;
4639
+ stat.isSymbolicLink = () => true;
4640
4640
  }
4641
- callSuccessCallback(callback, stat2);
4641
+ callSuccessCallback(callback, stat);
4642
4642
  });
4643
4643
  });
4644
4644
  }
4645
- exports.read = read;
4645
+ exports.read = read2;
4646
4646
  function callFailureCallback(callback, error2) {
4647
4647
  callback(error2);
4648
4648
  }
@@ -4659,17 +4659,17 @@ var require_sync = __commonJS({
4659
4659
  init_utils();
4660
4660
  Object.defineProperty(exports, "__esModule", { value: true });
4661
4661
  exports.read = void 0;
4662
- function read(path, settings) {
4662
+ function read2(path, settings) {
4663
4663
  const lstat = settings.fs.lstatSync(path);
4664
4664
  if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
4665
4665
  return lstat;
4666
4666
  }
4667
4667
  try {
4668
- const stat2 = settings.fs.statSync(path);
4668
+ const stat = settings.fs.statSync(path);
4669
4669
  if (settings.markSymbolicLink) {
4670
- stat2.isSymbolicLink = () => true;
4670
+ stat.isSymbolicLink = () => true;
4671
4671
  }
4672
- return stat2;
4672
+ return stat;
4673
4673
  } catch (error2) {
4674
4674
  if (!settings.throwErrorOnBrokenSymbolicLink) {
4675
4675
  return lstat;
@@ -4677,7 +4677,7 @@ var require_sync = __commonJS({
4677
4677
  throw error2;
4678
4678
  }
4679
4679
  }
4680
- exports.read = read;
4680
+ exports.read = read2;
4681
4681
  }
4682
4682
  });
4683
4683
 
@@ -4739,14 +4739,14 @@ var require_out = __commonJS({
4739
4739
  var sync = require_sync();
4740
4740
  var settings_1 = require_settings();
4741
4741
  exports.Settings = settings_1.default;
4742
- function stat2(path, optionsOrSettingsOrCallback, callback) {
4742
+ function stat(path, optionsOrSettingsOrCallback, callback) {
4743
4743
  if (typeof optionsOrSettingsOrCallback === "function") {
4744
4744
  async.read(path, getSettings(), optionsOrSettingsOrCallback);
4745
4745
  return;
4746
4746
  }
4747
4747
  async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
4748
4748
  }
4749
- exports.stat = stat2;
4749
+ exports.stat = stat;
4750
4750
  function statSync3(path, optionsOrSettings) {
4751
4751
  const settings = getSettings(optionsOrSettings);
4752
4752
  return sync.read(path, settings);
@@ -4911,14 +4911,14 @@ var require_async2 = __commonJS({
4911
4911
  var constants_1 = require_constants3();
4912
4912
  var utils = require_utils4();
4913
4913
  var common = require_common();
4914
- function read(directory, settings, callback) {
4914
+ function read2(directory, settings, callback) {
4915
4915
  if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
4916
4916
  readdirWithFileTypes(directory, settings, callback);
4917
4917
  return;
4918
4918
  }
4919
4919
  readdir2(directory, settings, callback);
4920
4920
  }
4921
- exports.read = read;
4921
+ exports.read = read2;
4922
4922
  function readdirWithFileTypes(directory, settings, callback) {
4923
4923
  settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
4924
4924
  if (readdirError !== null) {
@@ -5021,13 +5021,13 @@ var require_sync2 = __commonJS({
5021
5021
  var constants_1 = require_constants3();
5022
5022
  var utils = require_utils4();
5023
5023
  var common = require_common();
5024
- function read(directory, settings) {
5024
+ function read2(directory, settings) {
5025
5025
  if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
5026
5026
  return readdirWithFileTypes(directory, settings);
5027
5027
  }
5028
5028
  return readdir2(directory, settings);
5029
5029
  }
5030
- exports.read = read;
5030
+ exports.read = read2;
5031
5031
  function readdirWithFileTypes(directory, settings) {
5032
5032
  const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
5033
5033
  return dirents.map((dirent) => {
@@ -6628,19 +6628,19 @@ var require_out4 = __commonJS({
6628
6628
  return utils.path.convertPathToPattern(source);
6629
6629
  }
6630
6630
  FastGlob2.convertPathToPattern = convertPathToPattern;
6631
- let posix2;
6632
- (function(posix3) {
6631
+ let posix;
6632
+ (function(posix2) {
6633
6633
  function escapePath2(source) {
6634
6634
  assertPatternsInput(source);
6635
6635
  return utils.path.escapePosixPath(source);
6636
6636
  }
6637
- posix3.escapePath = escapePath2;
6637
+ posix2.escapePath = escapePath2;
6638
6638
  function convertPathToPattern2(source) {
6639
6639
  assertPatternsInput(source);
6640
6640
  return utils.path.convertPosixPathToPattern(source);
6641
6641
  }
6642
- posix3.convertPathToPattern = convertPathToPattern2;
6643
- })(posix2 = FastGlob2.posix || (FastGlob2.posix = {}));
6642
+ posix2.convertPathToPattern = convertPathToPattern2;
6643
+ })(posix = FastGlob2.posix || (FastGlob2.posix = {}));
6644
6644
  let win32;
6645
6645
  (function(win322) {
6646
6646
  function escapePath2(source) {
@@ -7787,7 +7787,10 @@ var init_PathResolver = __esm({
7787
7787
  */
7788
7788
  getEmptyCjsModulePath() {
7789
7789
  const resolved = this.resolvePackage("@donotdev/core/empty");
7790
- if (!resolved) throw new Error("Cannot resolve @donotdev/core/empty \u2014 package setup is broken");
7790
+ if (!resolved)
7791
+ throw new Error(
7792
+ "Cannot resolve @donotdev/core/empty \u2014 package setup is broken"
7793
+ );
7791
7794
  return resolved;
7792
7795
  }
7793
7796
  // === PRIVATE METHODS ===
@@ -7853,7 +7856,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
7853
7856
  function readdirSync2(dirPath, options) {
7854
7857
  return pathResolverInstance.readdirSync(dirPath, options);
7855
7858
  }
7856
- var pathResolverInstance, resolvePackage, normalizePath, pathExists, readSync, writeSync, removeSync, statSync2, ensureDirSync, getRelativePathBetween, getDirname, joinPath;
7859
+ var pathResolverInstance, resolvePackage, normalizePath, pathExists, read, readSync, writeSync, removeSync, statSync2, ensureDirSync, readdir, getRelativePathBetween, getDirname, joinPath;
7857
7860
  var init_pathResolver = __esm({
7858
7861
  "packages/tooling/src/utils/pathResolver.ts"() {
7859
7862
  "use strict";
@@ -7865,11 +7868,13 @@ var init_pathResolver = __esm({
7865
7868
  return pathResolverInstance.normalizePath(join2(...pathSegments));
7866
7869
  };
7867
7870
  pathExists = (filePath, silent = false) => pathResolverInstance.pathExists(filePath, silent);
7871
+ read = async (filePath, options) => pathResolverInstance.read(filePath, options);
7868
7872
  readSync = (filePath, options) => pathResolverInstance.readSync(filePath, options);
7869
7873
  writeSync = (filePath, content, options) => pathResolverInstance.writeSync(filePath, content, options);
7870
7874
  removeSync = (path) => pathResolverInstance.removeSync(path);
7871
7875
  statSync2 = (filePath) => pathResolverInstance.statSync(filePath);
7872
7876
  ensureDirSync = (dirPath) => pathResolverInstance.ensureDirSync(dirPath);
7877
+ readdir = async (dirPath, options) => pathResolverInstance.readdir(dirPath, options);
7873
7878
  getRelativePathBetween = (from, to) => {
7874
7879
  return normalizePath(relative2(from, to));
7875
7880
  };
@@ -8083,7 +8088,7 @@ function checkCLI(command, args = ["--version"], useCache = true) {
8083
8088
  "-ExecutionPolicy",
8084
8089
  "Bypass",
8085
8090
  "-Command",
8086
- `& '${fullPath}' ${args.join(" ")}`
8091
+ `& '${fullPath}' ${args.map((a) => `'${a}'`).join(" ")}`
8087
8092
  ],
8088
8093
  {
8089
8094
  stdio: "pipe",
@@ -8105,7 +8110,7 @@ function checkCLI(command, args = ["--version"], useCache = true) {
8105
8110
  "-ExecutionPolicy",
8106
8111
  "Bypass",
8107
8112
  "-Command",
8108
- `${command} ${args.join(" ")}`
8113
+ `& '${command}' ${args.map((a) => `'${a}'`).join(" ")}`
8109
8114
  ],
8110
8115
  {
8111
8116
  stdio: "pipe",
@@ -8113,9 +8118,8 @@ function checkCLI(command, args = ["--version"], useCache = true) {
8113
8118
  }
8114
8119
  );
8115
8120
  } else {
8116
- result = spawnSync(`${command} ${args.join(" ")}`, {
8117
- stdio: "pipe",
8118
- shell: true
8121
+ result = spawnSync(command, args, {
8122
+ stdio: "pipe"
8119
8123
  });
8120
8124
  }
8121
8125
  const isAvailable = result.status === 0;
@@ -16079,8 +16083,8 @@ function detectAppsWithFunctions() {
16079
16083
  try {
16080
16084
  const appsList = readdirSync2(appsDir).filter((item) => {
16081
16085
  const itemPath = joinPath(appsDir, item);
16082
- const stat2 = statSync2(itemPath);
16083
- return stat2?.isDirectory() === true;
16086
+ const stat = statSync2(itemPath);
16087
+ return stat?.isDirectory() === true;
16084
16088
  });
16085
16089
  for (const app of appsList) {
16086
16090
  const functionsEnvFile = joinPath(appsDir, app, "functions", ".env");
@@ -16564,8 +16568,8 @@ async function deploySupabaseFunctions(appDir, config) {
16564
16568
  );
16565
16569
  const functionDirs = readdirSync2(functionsDir).filter((item) => {
16566
16570
  const itemPath = joinPath(functionsDir, item);
16567
- const stat2 = statSync2(itemPath);
16568
- return stat2?.isDirectory() === true;
16571
+ const stat = statSync2(itemPath);
16572
+ return stat?.isDirectory() === true;
16569
16573
  }).filter((dir) => {
16570
16574
  const indexPath = joinPath(functionsDir, dir, "index.ts");
16571
16575
  return pathExists(indexPath);
@@ -16583,14 +16587,18 @@ async function deploySupabaseFunctions(appDir, config) {
16583
16587
  for (const functionName of functionDirs) {
16584
16588
  s.start(`Deploying Edge Function: ${functionName}...`);
16585
16589
  try {
16586
- const result = spawnSync6("supabase", ["functions", "deploy", functionName], {
16587
- cwd: supabaseDir,
16588
- stdio: config.verbose ? "inherit" : "pipe",
16589
- env: {
16590
- ...process.env,
16591
- DNDEV_APP_ROOT: appDir
16590
+ const result = spawnSync6(
16591
+ "supabase",
16592
+ ["functions", "deploy", functionName],
16593
+ {
16594
+ cwd: supabaseDir,
16595
+ stdio: config.verbose ? "inherit" : "pipe",
16596
+ env: {
16597
+ ...process.env,
16598
+ DNDEV_APP_ROOT: appDir
16599
+ }
16592
16600
  }
16593
- });
16601
+ );
16594
16602
  if (result.status !== 0) {
16595
16603
  throw new Error(result.stderr?.toString() || "Deploy failed");
16596
16604
  }
@@ -16668,10 +16676,12 @@ function executeFirebaseCommand(args, options) {
16668
16676
  env: deployEnv
16669
16677
  };
16670
16678
  let result;
16671
- result = spawnSync2(`firebase ${args.join(" ")}`, {
16672
- ...spawnOptions,
16673
- shell: true
16674
- });
16679
+ const isWindows = platform() === "win32";
16680
+ if (isWindows) {
16681
+ result = spawnSync2("firebase", args, { ...spawnOptions, shell: true });
16682
+ } else {
16683
+ result = spawnSync2("firebase", args, spawnOptions);
16684
+ }
16675
16685
  if (result.error) {
16676
16686
  return {
16677
16687
  success: false,
@@ -16774,8 +16784,8 @@ function detectAvailableApps() {
16774
16784
  }
16775
16785
  return readdirSync2(appsDir).filter((item) => {
16776
16786
  const itemPath = joinPath(appsDir, item);
16777
- const stat2 = statSync2(itemPath);
16778
- return stat2?.isDirectory() === true;
16787
+ const stat = statSync2(itemPath);
16788
+ return stat?.isDirectory() === true;
16779
16789
  }).filter((app) => {
16780
16790
  const appDir = joinPath(appsDir, app);
16781
16791
  const firebaseJsonPath = joinPath(appDir, "firebase.json");
@@ -17552,8 +17562,6 @@ init_vercel_token();
17552
17562
  init_cli_output();
17553
17563
  init_pathResolver();
17554
17564
  import { createHash } from "node:crypto";
17555
- import { readFile, readdir } from "node:fs/promises";
17556
- import { join as join3, relative as relative3 } from "node:path";
17557
17565
  var VERCEL_API2 = "https://api.vercel.com";
17558
17566
  var UPLOAD_BATCH_SIZE = 10;
17559
17567
  var POLL_INTERVAL_MS = 3e3;
@@ -17568,17 +17576,18 @@ function teamQuery(orgId) {
17568
17576
  async function collectDistFiles(distDir) {
17569
17577
  const files = [];
17570
17578
  async function walk(dir) {
17571
- const entries = await readdir(dir, { withFileTypes: true });
17579
+ const entries = await readdir(dir, {
17580
+ withFileTypes: true
17581
+ });
17572
17582
  for (const entry of entries) {
17573
- const fullPath = join3(dir, entry.name);
17583
+ const fullPath = joinPath(dir, entry.name);
17574
17584
  if (entry.isDirectory()) {
17575
17585
  await walk(fullPath);
17576
17586
  } else {
17577
- const content = await readFile(fullPath);
17587
+ const content = await read(fullPath, { format: "buffer" });
17578
17588
  const sha = createHash("sha1").update(content).digest("hex");
17579
- const rel = relative3(distDir, fullPath).split("\\").join("/");
17580
17589
  files.push({
17581
- relativePath: rel,
17590
+ relativePath: getRelativePathBetween(distDir, fullPath),
17582
17591
  content,
17583
17592
  sha,
17584
17593
  size: content.byteLength
@@ -17616,13 +17625,19 @@ async function uploadFiles(files, token, orgId) {
17616
17625
  );
17617
17626
  }
17618
17627
  }
17619
- function loadVercelConfig(appDir) {
17628
+ function sourceToRegex(source) {
17629
+ if (source.includes("(")) return source;
17630
+ let result = source.replace(/\./g, "\\.");
17631
+ result = result.replace(/:(\w+)\*/g, "(.+)");
17632
+ result = result.replace(/:(\w+)/g, "([^/]+)");
17633
+ return result;
17634
+ }
17635
+ function buildRoutes(appDir) {
17620
17636
  const configPath = joinPath(appDir, "vercel.json");
17621
- if (!pathExists(configPath)) return {};
17637
+ if (!pathExists(configPath)) return [];
17622
17638
  try {
17623
- const raw = readSync(configPath);
17624
- const config = JSON.parse(raw);
17625
- const result = {};
17639
+ const config = readSync(configPath);
17640
+ if (!config || typeof config !== "object") return [];
17626
17641
  const routes = [];
17627
17642
  if (Array.isArray(config.headers)) {
17628
17643
  for (const h2 of config.headers) {
@@ -17631,7 +17646,7 @@ function loadVercelConfig(appDir) {
17631
17646
  headersMap[entry.key] = entry.value;
17632
17647
  }
17633
17648
  routes.push({
17634
- src: h2.source,
17649
+ src: sourceToRegex(h2.source),
17635
17650
  headers: headersMap,
17636
17651
  continue: true
17637
17652
  });
@@ -17640,31 +17655,55 @@ function loadVercelConfig(appDir) {
17640
17655
  if (Array.isArray(config.redirects)) {
17641
17656
  for (const r2 of config.redirects) {
17642
17657
  routes.push({
17643
- src: r2.source,
17658
+ src: sourceToRegex(r2.source),
17644
17659
  dest: r2.destination,
17645
17660
  status: r2.statusCode ?? (r2.permanent ? 308 : 307)
17646
17661
  });
17647
17662
  }
17648
17663
  }
17649
- if (Array.isArray(config.rewrites)) {
17664
+ if (Array.isArray(config.rewrites) && config.rewrites.length > 0) {
17665
+ routes.push({ handle: "filesystem" });
17650
17666
  for (const rw of config.rewrites) {
17651
17667
  routes.push({
17652
- src: rw.source,
17668
+ src: sourceToRegex(rw.source),
17653
17669
  dest: rw.destination
17654
17670
  });
17655
17671
  }
17656
17672
  }
17657
- if (routes.length > 0) result.routes = routes;
17658
- if (config.cleanUrls != null) result.cleanUrls = config.cleanUrls;
17659
- if (config.trailingSlash != null) result.trailingSlash = config.trailingSlash;
17660
- return result;
17661
- } catch {
17662
- return {};
17673
+ return routes;
17674
+ } catch (err) {
17675
+ log.warn(
17676
+ `Failed to parse vercel.json: ${err instanceof Error ? err.message : String(err)}`
17677
+ );
17678
+ return [];
17663
17679
  }
17664
17680
  }
17665
- async function createDeployment(files, token, orgId, projectId, projectName, appDir) {
17681
+ function buildOutputConfig(appDir) {
17682
+ let routes = buildRoutes(appDir);
17683
+ const hasFilesystemHandle = routes.some(
17684
+ (r2) => "handle" in r2 && r2.handle === "filesystem"
17685
+ );
17686
+ if (!hasFilesystemHandle) {
17687
+ routes = [
17688
+ ...routes,
17689
+ { handle: "filesystem" },
17690
+ { src: "/(.*)", dest: "/index.html" }
17691
+ ];
17692
+ }
17693
+ const config = { version: 3, routes };
17694
+ const json = JSON.stringify(config, null, 2);
17695
+ const content = Buffer.from(json);
17696
+ const sha = createHash("sha1").update(content).digest("hex");
17697
+ log.debug(`Build Output config.json: ${routes.length} routes`);
17698
+ return {
17699
+ relativePath: ".vercel/output/config.json",
17700
+ content,
17701
+ sha,
17702
+ size: content.byteLength
17703
+ };
17704
+ }
17705
+ async function createDeployment(files, token, orgId, projectId, projectName) {
17666
17706
  const q2 = teamQuery(orgId);
17667
- const vercelConfig = loadVercelConfig(appDir);
17668
17707
  const body = {
17669
17708
  name: projectName,
17670
17709
  project: projectId,
@@ -17678,8 +17717,7 @@ async function createDeployment(files, token, orgId, projectId, projectName, app
17678
17717
  buildCommand: "",
17679
17718
  installCommand: "",
17680
17719
  outputDirectory: "."
17681
- },
17682
- ...vercelConfig
17720
+ }
17683
17721
  };
17684
17722
  const res = await fetch(`${VERCEL_API2}/v13/deployments${q2}`, {
17685
17723
  method: "POST",
@@ -17749,22 +17787,30 @@ async function deployVercelFrontend(appDir, _config) {
17749
17787
  const project = await validateProject(token, projectId, orgId);
17750
17788
  log.success(`Project accessible (${project.projectName})`);
17751
17789
  log.info("Collecting dist/ files...");
17752
- const files = await collectDistFiles(distDir);
17753
- if (files.length === 0) {
17754
- throw new Error("dist/ is empty \u2014 nothing to deploy.");
17755
- }
17756
- log.info(`Found ${files.length} files`);
17790
+ const distFiles = await collectDistFiles(distDir);
17791
+ if (distFiles.length === 0) {
17792
+ throw new Error("dist/ is empty - nothing to deploy.");
17793
+ }
17794
+ log.info(`Found ${distFiles.length} files`);
17795
+ const configFile = buildOutputConfig(appDir);
17796
+ const outputFiles = [
17797
+ configFile,
17798
+ ...distFiles.map((f) => ({
17799
+ ...f,
17800
+ relativePath: `.vercel/output/static/${f.relativePath}`
17801
+ }))
17802
+ ];
17803
+ log.debug(`Build Output: 1 config.json + ${distFiles.length} static files`);
17757
17804
  log.info("Uploading files to Vercel...");
17758
- await uploadFiles(files, token, orgId);
17759
- log.success(`${files.length} files uploaded`);
17805
+ await uploadFiles(outputFiles, token, orgId);
17806
+ log.success(`${outputFiles.length} files uploaded`);
17760
17807
  log.info("Creating production deployment...");
17761
17808
  const deployment = await createDeployment(
17762
- files,
17809
+ outputFiles,
17763
17810
  token,
17764
17811
  orgId,
17765
17812
  projectId,
17766
- project.projectName,
17767
- appDir
17813
+ project.projectName
17768
17814
  );
17769
17815
  log.info(`Deployment ${deployment.id} created, waiting...`);
17770
17816
  const ready = await waitForReady(deployment.id, token, orgId);
@@ -163,7 +163,7 @@ var require_picocolors = __commonJS({
163
163
  }
164
164
  });
165
165
 
166
- // node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs
166
+ // node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
167
167
  import { stdin as j, stdout as M } from "node:process";
168
168
  import O from "node:readline";
169
169
  import { Writable as X } from "node:stream";
@@ -257,7 +257,7 @@ function m(e2, u2) {
257
257
  }
258
258
  var import_sisteransi, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, d, oD, y, V, nD, G, _, z, K, aD, k, hD, lD, xD, B, AD, S, gD, vD, h, x, A, OD, PD, J, LD;
259
259
  var init_dist = __esm({
260
- "node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs"() {
260
+ "node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs"() {
261
261
  init_utils();
262
262
  import_sisteransi = __toESM(require_src(), 1);
263
263
  uD = DD();
@@ -7630,7 +7630,10 @@ var init_PathResolver = __esm({
7630
7630
  */
7631
7631
  getEmptyCjsModulePath() {
7632
7632
  const resolved = this.resolvePackage("@donotdev/core/empty");
7633
- if (!resolved) throw new Error("Cannot resolve @donotdev/core/empty \u2014 package setup is broken");
7633
+ if (!resolved)
7634
+ throw new Error(
7635
+ "Cannot resolve @donotdev/core/empty \u2014 package setup is broken"
7636
+ );
7634
7637
  return resolved;
7635
7638
  }
7636
7639
  // === PRIVATE METHODS ===
@@ -163,7 +163,7 @@ var require_picocolors = __commonJS({
163
163
  }
164
164
  });
165
165
 
166
- // node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs
166
+ // node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
167
167
  import { stdin as j, stdout as M } from "node:process";
168
168
  import * as g from "node:readline";
169
169
  import { Writable as X } from "node:stream";
@@ -231,7 +231,7 @@ function fD({ input: e2 = j, output: u2 = M, overwrite: t = true, hideCursor: F2
231
231
  }
232
232
  var import_sisteransi, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, nD, _, xD, B, AD, A;
233
233
  var init_dist = __esm({
234
- "node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs"() {
234
+ "node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs"() {
235
235
  init_utils();
236
236
  import_sisteransi = __toESM(require_src(), 1);
237
237
  uD = DD();
@@ -7422,7 +7422,10 @@ var init_PathResolver = __esm({
7422
7422
  */
7423
7423
  getEmptyCjsModulePath() {
7424
7424
  const resolved = this.resolvePackage("@donotdev/core/empty");
7425
- if (!resolved) throw new Error("Cannot resolve @donotdev/core/empty \u2014 package setup is broken");
7425
+ if (!resolved)
7426
+ throw new Error(
7427
+ "Cannot resolve @donotdev/core/empty \u2014 package setup is broken"
7428
+ );
7426
7429
  return resolved;
7427
7430
  }
7428
7431
  // === PRIVATE METHODS ===
@@ -163,7 +163,7 @@ var require_picocolors = __commonJS({
163
163
  }
164
164
  });
165
165
 
166
- // node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs
166
+ // node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
167
167
  import { stdin as j, stdout as M } from "node:process";
168
168
  import { Writable as X } from "node:stream";
169
169
  function DD({ onlyFirst: e2 = false } = {}) {
@@ -204,7 +204,7 @@ function rD() {
204
204
  }
205
205
  var import_sisteransi, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, nD, _, xD, B, AD, A;
206
206
  var init_dist = __esm({
207
- "node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs"() {
207
+ "node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs"() {
208
208
  init_utils();
209
209
  import_sisteransi = __toESM(require_src(), 1);
210
210
  uD = DD();
@@ -7169,7 +7169,10 @@ var init_PathResolver = __esm({
7169
7169
  */
7170
7170
  getEmptyCjsModulePath() {
7171
7171
  const resolved = this.resolvePackage("@donotdev/core/empty");
7172
- if (!resolved) throw new Error("Cannot resolve @donotdev/core/empty \u2014 package setup is broken");
7172
+ if (!resolved)
7173
+ throw new Error(
7174
+ "Cannot resolve @donotdev/core/empty \u2014 package setup is broken"
7175
+ );
7173
7176
  return resolved;
7174
7177
  }
7175
7178
  // === PRIVATE METHODS ===