@donotdev/cli 0.0.4 → 0.0.6

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 (54) hide show
  1. package/dependencies-matrix.json +234 -114
  2. package/dist/bin/commands/build.js +9 -3
  3. package/dist/bin/commands/bump.js +119 -100
  4. package/dist/bin/commands/cacheout.js +9 -3
  5. package/dist/bin/commands/create-app.js +60 -34
  6. package/dist/bin/commands/create-project.js +61 -34
  7. package/dist/bin/commands/deploy.js +22 -14
  8. package/dist/bin/commands/dev.js +9 -3
  9. package/dist/bin/commands/emu.js +9 -3
  10. package/dist/bin/commands/format.js +9 -3
  11. package/dist/bin/commands/lint.js +9 -3
  12. package/dist/bin/commands/make-admin.d.ts +11 -0
  13. package/dist/bin/commands/make-admin.d.ts.map +1 -0
  14. package/dist/bin/commands/make-admin.js +12 -0
  15. package/dist/bin/commands/make-admin.js.map +1 -0
  16. package/dist/bin/commands/preview.js +9 -3
  17. package/dist/bin/commands/sync-secrets.js +9 -3
  18. package/dist/index.js +72 -44
  19. package/package.json +1 -1
  20. package/templates/app-demo/index.html.example +4 -0
  21. package/templates/app-demo/src/App.tsx.example +28 -10
  22. package/templates/app-demo/src/config/app.ts.example +56 -0
  23. package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +5 -5
  24. package/templates/app-next/src/app/ClientLayout.tsx.example +5 -4
  25. package/templates/app-next/src/app/layout.tsx.example +17 -25
  26. package/templates/app-next/src/globals.css.example +10 -7
  27. package/templates/app-next/src/locales/dndev_en.json.example +68 -0
  28. package/templates/app-next/src/pages/locales/example_en.json.example +5 -0
  29. package/templates/app-vite/index.html.example +3 -0
  30. package/templates/app-vite/src/App.tsx.example +1 -1
  31. package/templates/app-vite/src/globals.css.example +14 -6
  32. package/templates/app-vite/src/locales/dndev_en.json.example +68 -0
  33. package/templates/functions-firebase/README.md.example +25 -0
  34. package/templates/functions-firebase/tsconfig.json.example +3 -13
  35. package/templates/functions-vercel/tsconfig.json.example +1 -13
  36. package/templates/root-consumer/firebase.json.example +1 -1
  37. package/templates/root-consumer/guides/AGENT_START_HERE.md.example +229 -7
  38. package/templates/root-consumer/guides/COMPONENTS_ADV.md.example +456 -0
  39. package/templates/root-consumer/guides/COMPONENTS_ATOMIC.md.example +43 -1
  40. package/templates/root-consumer/guides/COMPONENTS_UI.md.example +6 -0
  41. package/templates/root-consumer/guides/INDEX.md.example +3 -0
  42. package/templates/root-consumer/guides/SETUP_APP_CONFIG.md.example +5 -2
  43. package/templates/root-consumer/guides/SETUP_BILLING.md.example +44 -4
  44. package/templates/root-consumer/guides/SETUP_CRUD.md.example +1244 -0
  45. package/templates/root-consumer/guides/SETUP_FUNCTIONS.md.example +52 -0
  46. package/templates/root-consumer/guides/SETUP_I18N.md.example +145 -6
  47. package/templates/root-consumer/guides/SETUP_LAYOUTS.md.example +18 -0
  48. package/templates/root-consumer/guides/SETUP_PAGES.md.example +25 -0
  49. package/templates/root-consumer/guides/SETUP_PWA.md.example +213 -0
  50. package/templates/root-consumer/guides/USE_ROUTING.md.example +503 -0
  51. package/templates/root-consumer/vercel.json.example +315 -20
  52. package/templates/app-demo/src/Routes.tsx.example +0 -20
  53. package/templates/app-vite/src/Routes.tsx.example +0 -16
  54. package/templates/app-vite/src/pages/locales/README.md.example +0 -1
@@ -7687,11 +7687,17 @@ var init_PathResolver = __esm({
7687
7687
  /**
7688
7688
  * Get path to empty.js module for optional dependency aliasing
7689
7689
  * Used by Vite and Turbopack to alias missing optional deps
7690
- * @returns Absolute path to empty.js
7690
+ * @param returnPackageSpecifier - If true, returns package specifier '@donotdev/core/empty' for Turbopack. If false, returns absolute path for Vite.
7691
+ * @returns Package specifier or absolute path to empty.js
7691
7692
  */
7692
- getEmptyModulePath() {
7693
+ getEmptyModulePath(returnPackageSpecifier = false) {
7694
+ if (returnPackageSpecifier) {
7695
+ return "@donotdev/core/empty";
7696
+ }
7697
+ const resolved = this.resolvePackage("@donotdev/core/empty");
7698
+ if (resolved) return resolved;
7693
7699
  const thisDir = dirname(fileURLToPath(import.meta.url));
7694
- return this.normalizePath(join(thisDir, "../vite/empty.js"));
7700
+ return this.normalizePath(join(thisDir, "../empty.js"));
7695
7701
  }
7696
7702
  // === PRIVATE METHODS ===
7697
7703
  /**
@@ -8573,52 +8579,60 @@ async function mergeRootTurboJson(rootDir) {
8573
8579
  // packages/tooling/src/utils/matrix.ts
8574
8580
  init_utils();
8575
8581
  init_pathResolver();
8582
+ import { createRequire as createRequire4 } from "node:module";
8576
8583
  var cachedMatrix = null;
8577
8584
  function getMatrixPath(mode) {
8585
+ try {
8586
+ const require3 = createRequire4(import.meta.url);
8587
+ const resolved = require3.resolve("@donotdev/cli/dependencies-matrix.json");
8588
+ if (pathExists(resolved)) {
8589
+ return resolved;
8590
+ }
8591
+ } catch {
8592
+ }
8578
8593
  const executionMode = mode || detectExecutionMode();
8579
8594
  if (executionMode === "development") {
8580
8595
  const repoRoot = getRepoRoot();
8581
- const devPath = normalizePath(
8582
- repoRoot,
8583
- "packages/cli/dependencies-matrix.json"
8584
- );
8585
- if (!pathExists(devPath)) {
8586
- throw new Error(`[DEV] Matrix not found at: ${devPath}`);
8596
+ if (repoRoot) {
8597
+ const devPath = normalizePath(
8598
+ repoRoot,
8599
+ "packages/cli/dependencies-matrix.json"
8600
+ );
8601
+ if (pathExists(devPath)) {
8602
+ return devPath;
8603
+ }
8587
8604
  }
8588
- return devPath;
8589
8605
  }
8590
- const cliPackagePath = getCliRootFromBundle();
8591
- const matrixPath = joinPath(cliPackagePath, "dependencies-matrix.json");
8592
- if (!pathExists(matrixPath)) {
8593
- throw new Error(`[PROD] Matrix not found at: ${matrixPath}`);
8594
- }
8595
- return matrixPath;
8606
+ return null;
8596
8607
  }
8597
8608
  function getCliVersion(mode) {
8609
+ try {
8610
+ const require3 = createRequire4(import.meta.url);
8611
+ const packageJsonPath = require3.resolve("@donotdev/cli/package.json");
8612
+ const pkg = readSync(packageJsonPath, { format: "json" });
8613
+ return String(pkg?.version || "0.0.0");
8614
+ } catch {
8615
+ }
8598
8616
  const executionMode = mode || detectExecutionMode();
8599
8617
  if (executionMode === "development") {
8600
8618
  const repoRoot = getRepoRoot();
8601
8619
  const cliPackageJson = joinPath(repoRoot, "packages/cli/package.json");
8602
- if (!pathExists(cliPackageJson)) {
8603
- throw new Error(`[DEV] CLI package.json not found at: ${cliPackageJson}`);
8620
+ if (pathExists(cliPackageJson)) {
8621
+ const pkg = readSync(cliPackageJson, { format: "json" });
8622
+ return String(pkg?.version || "0.0.0");
8604
8623
  }
8605
- const pkg2 = readSync(cliPackageJson, { format: "json" });
8606
- return String(pkg2?.version || "0.0.0");
8607
8624
  }
8608
- const cliPackagePath = getCliRootFromBundle();
8609
- const packageJsonPath = joinPath(cliPackagePath, "package.json");
8610
- if (!pathExists(packageJsonPath)) {
8611
- throw new Error(`[PROD] CLI package.json not found at: ${packageJsonPath}`);
8612
- }
8613
- const pkg = readSync(packageJsonPath, { format: "json" });
8614
- return String(pkg?.version || "0.0.0");
8625
+ return "0.0.0";
8615
8626
  }
8616
8627
  function loadMatrix(mode) {
8617
8628
  if (cachedMatrix) return cachedMatrix;
8618
8629
  const matrixPath = getMatrixPath(mode);
8630
+ if (!matrixPath) {
8631
+ return null;
8632
+ }
8619
8633
  const content = readSync(matrixPath, { format: "json" });
8620
8634
  if (!content) {
8621
- throw new Error(`Failed to read dependencies-matrix.json at ${matrixPath}`);
8635
+ return null;
8622
8636
  }
8623
8637
  cachedMatrix = {
8624
8638
  matrix: content,
@@ -8768,7 +8782,7 @@ function generateScripts(templateName, options) {
8768
8782
  const scripts = {};
8769
8783
  if (templateName.includes("vite")) {
8770
8784
  scripts.dev = "vite";
8771
- scripts.build = "tsc --noEmit && cross-env NODE_ENV=production VITE_NODE_POLYFILL=true vite build";
8785
+ scripts.build = "vite build";
8772
8786
  scripts.preview = "vite preview";
8773
8787
  scripts.lint = "eslint src/";
8774
8788
  scripts["type-check"] = "tsc --noEmit";
@@ -8802,7 +8816,13 @@ function generateScripts(templateName, options) {
8802
8816
  return scripts;
8803
8817
  }
8804
8818
  function generatePackageJson(templateName, mode, options = {}) {
8805
- const { matrix, cliVersion } = loadMatrix(mode);
8819
+ const matrixResult = loadMatrix(mode);
8820
+ if (!matrixResult) {
8821
+ throw new Error(
8822
+ "dependencies-matrix.json not found. This command requires the matrix file."
8823
+ );
8824
+ }
8825
+ const { matrix, cliVersion } = matrixResult;
8806
8826
  const template = matrix.templateMapping?.[templateName];
8807
8827
  if (!template) {
8808
8828
  throw new Error(`Template "${templateName}" not found in matrix`);
@@ -8852,14 +8872,19 @@ function generatePackageJson(templateName, mode, options = {}) {
8852
8872
  result.peerDependencies = peerDependencies;
8853
8873
  }
8854
8874
  if (templateName === "consumer-root") {
8855
- result.packageManager = "bun@1.3.3";
8856
- result.engines = { node: ">=20.0.0", bun: ">=1.1.0" };
8875
+ result.packageManager = "bun@1.3.5";
8876
+ result.engines = { node: ">=24.0.0", bun: ">=1.3.0" };
8857
8877
  result.workspaces = ["apps/*", "entities"];
8858
8878
  }
8859
8879
  if (templateName === "entities") {
8860
8880
  result.main = "./index.ts";
8861
8881
  result.types = "./index.ts";
8862
8882
  }
8883
+ if (templateName.includes("vite") || templateName.includes("nextjs") || templateName.includes("functions")) {
8884
+ if (!dependencies.entities) {
8885
+ dependencies.entities = "workspace:*";
8886
+ }
8887
+ }
8863
8888
  if (templateName.includes("functions")) {
8864
8889
  result.engines = { node: "20" };
8865
8890
  if (options.appName) {
@@ -8982,7 +9007,8 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
8982
9007
  firebaseProjectId: appName.toLowerCase(),
8983
9008
  firebaseSecretName: appName.toUpperCase().replace(/-/g, "_"),
8984
9009
  monorepoRelativePath: "../../packages/tooling",
8985
- appTemplate
9010
+ appTemplate,
9011
+ isNextjs: appTemplate === "nextjs"
8986
9012
  };
8987
9013
  const templateSourceDir = joinPath(templatesRoot, templateDir);
8988
9014
  const templateFiles = await glob("**/*", {
@@ -9075,7 +9101,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
9075
9101
  await replacePlaceholders(firebaseJsonDest, replacements);
9076
9102
  }
9077
9103
  }
9078
- if (appConfig.needsBackend && appConfig.backendPlatform === "vercel") {
9104
+ if (appTemplate === "nextjs" || appConfig.needsBackend && appConfig.backendPlatform === "vercel") {
9079
9105
  const vercelJsonSource = joinPath(
9080
9106
  deploymentTemplateDir,
9081
9107
  "vercel.json.example"
@@ -9448,6 +9474,7 @@ async function main(options) {
9448
9474
  setupGithubActions: false,
9449
9475
  monorepoRelativePath: relativeMonorepoPath,
9450
9476
  appTemplate: "vite",
9477
+ isNextjs: false,
9451
9478
  firebaseProjectId: projectName.toLowerCase(),
9452
9479
  firebaseSecretName: projectName.toUpperCase().replace(/-/g, "_"),
9453
9480
  needsAuth,
@@ -7616,11 +7616,17 @@ var init_PathResolver = __esm({
7616
7616
  /**
7617
7617
  * Get path to empty.js module for optional dependency aliasing
7618
7618
  * Used by Vite and Turbopack to alias missing optional deps
7619
- * @returns Absolute path to empty.js
7619
+ * @param returnPackageSpecifier - If true, returns package specifier '@donotdev/core/empty' for Turbopack. If false, returns absolute path for Vite.
7620
+ * @returns Package specifier or absolute path to empty.js
7620
7621
  */
7621
- getEmptyModulePath() {
7622
+ getEmptyModulePath(returnPackageSpecifier = false) {
7623
+ if (returnPackageSpecifier) {
7624
+ return "@donotdev/core/empty";
7625
+ }
7626
+ const resolved = this.resolvePackage("@donotdev/core/empty");
7627
+ if (resolved) return resolved;
7622
7628
  const thisDir = dirname(fileURLToPath(import.meta.url));
7623
- return this.normalizePath(join(thisDir, "../vite/empty.js"));
7629
+ return this.normalizePath(join(thisDir, "../empty.js"));
7624
7630
  }
7625
7631
  // === PRIVATE METHODS ===
7626
7632
  /**
@@ -7795,13 +7801,14 @@ import {
7795
7801
  function readdirSync2(dirPath, options) {
7796
7802
  return pathResolverInstance.readdirSync(dirPath, options);
7797
7803
  }
7798
- var pathResolverInstance, normalizePath, pathExists, readSync, writeSync, removeSync, statSync2, ensureDirSync, joinPath;
7804
+ var pathResolverInstance, resolvePackage, normalizePath, pathExists, readSync, writeSync, removeSync, statSync2, ensureDirSync, joinPath;
7799
7805
  var init_pathResolver = __esm({
7800
7806
  "packages/tooling/src/utils/pathResolver.ts"() {
7801
7807
  "use strict";
7802
7808
  init_utils();
7803
7809
  init_PathResolver();
7804
7810
  pathResolverInstance = PathResolver.getInstance({ debug: false });
7811
+ resolvePackage = (spec, from) => pathResolverInstance.resolvePackage(spec, from || null);
7805
7812
  normalizePath = (...pathSegments) => {
7806
7813
  return pathResolverInstance.normalizePath(join2(...pathSegments));
7807
7814
  };
@@ -7924,12 +7931,7 @@ function executeFirebaseCommand(args, options) {
7924
7931
  env: deployEnv
7925
7932
  };
7926
7933
  let result;
7927
- if (process.platform === "win32") {
7928
- const firebaseCmd = "C:\\Program Files\\nodejs\\firebase.cmd";
7929
- result = spawnSync(firebaseCmd, args, { ...spawnOptions, shell: false });
7930
- } else {
7931
- result = spawnSync("firebase", args, { ...spawnOptions, shell: true });
7932
- }
7934
+ result = spawnSync("firebase", args, { ...spawnOptions, shell: true });
7933
7935
  if (result.error) {
7934
7936
  return {
7935
7937
  success: false,
@@ -8680,11 +8682,15 @@ async function deployFunctions(appDir, serviceAccountPath, projectId, config) {
8680
8682
  }
8681
8683
  const s = Y2();
8682
8684
  s.start("Validating function dependencies...");
8683
- const nodeModulesPath = joinPath(functionsDir, "node_modules");
8684
8685
  const requiredPackages = ["firebase-functions", "firebase-admin"];
8685
- const missingPackages = requiredPackages.filter(
8686
- (pkg) => !pathExists(joinPath(nodeModulesPath, pkg))
8687
- );
8686
+ const missingPackages = requiredPackages.filter((pkg) => {
8687
+ try {
8688
+ resolvePackage(pkg, functionsDir);
8689
+ return false;
8690
+ } catch {
8691
+ return true;
8692
+ }
8693
+ });
8688
8694
  if (missingPackages.length > 0) {
8689
8695
  s.stop("Missing dependencies");
8690
8696
  throw new DoNotDevError(
@@ -8699,6 +8705,8 @@ To fix this, run:
8699
8705
  }
8700
8706
  s.stop("Dependencies validated");
8701
8707
  prepareFunctionsForDeployment(functionsDir, config.verbose);
8708
+ log.debug("Waiting for file system sync...");
8709
+ await new Promise((resolve4) => setTimeout(resolve4, 1e3));
8702
8710
  try {
8703
8711
  if (!config.skipBuild) {
8704
8712
  const s2 = Y2();
@@ -7439,11 +7439,17 @@ var init_PathResolver = __esm({
7439
7439
  /**
7440
7440
  * Get path to empty.js module for optional dependency aliasing
7441
7441
  * Used by Vite and Turbopack to alias missing optional deps
7442
- * @returns Absolute path to empty.js
7442
+ * @param returnPackageSpecifier - If true, returns package specifier '@donotdev/core/empty' for Turbopack. If false, returns absolute path for Vite.
7443
+ * @returns Package specifier or absolute path to empty.js
7443
7444
  */
7444
- getEmptyModulePath() {
7445
+ getEmptyModulePath(returnPackageSpecifier = false) {
7446
+ if (returnPackageSpecifier) {
7447
+ return "@donotdev/core/empty";
7448
+ }
7449
+ const resolved = this.resolvePackage("@donotdev/core/empty");
7450
+ if (resolved) return resolved;
7445
7451
  const thisDir = dirname(fileURLToPath(import.meta.url));
7446
- return this.normalizePath(join(thisDir, "../vite/empty.js"));
7452
+ return this.normalizePath(join(thisDir, "../empty.js"));
7447
7453
  }
7448
7454
  // === PRIVATE METHODS ===
7449
7455
  /**
@@ -7522,11 +7522,17 @@ var init_PathResolver = __esm({
7522
7522
  /**
7523
7523
  * Get path to empty.js module for optional dependency aliasing
7524
7524
  * Used by Vite and Turbopack to alias missing optional deps
7525
- * @returns Absolute path to empty.js
7525
+ * @param returnPackageSpecifier - If true, returns package specifier '@donotdev/core/empty' for Turbopack. If false, returns absolute path for Vite.
7526
+ * @returns Package specifier or absolute path to empty.js
7526
7527
  */
7527
- getEmptyModulePath() {
7528
+ getEmptyModulePath(returnPackageSpecifier = false) {
7529
+ if (returnPackageSpecifier) {
7530
+ return "@donotdev/core/empty";
7531
+ }
7532
+ const resolved = this.resolvePackage("@donotdev/core/empty");
7533
+ if (resolved) return resolved;
7528
7534
  const thisDir = dirname(fileURLToPath(import.meta.url));
7529
- return this.normalizePath(join(thisDir, "../vite/empty.js"));
7535
+ return this.normalizePath(join(thisDir, "../empty.js"));
7530
7536
  }
7531
7537
  // === PRIVATE METHODS ===
7532
7538
  /**
@@ -7141,11 +7141,17 @@ var init_PathResolver = __esm({
7141
7141
  /**
7142
7142
  * Get path to empty.js module for optional dependency aliasing
7143
7143
  * Used by Vite and Turbopack to alias missing optional deps
7144
- * @returns Absolute path to empty.js
7144
+ * @param returnPackageSpecifier - If true, returns package specifier '@donotdev/core/empty' for Turbopack. If false, returns absolute path for Vite.
7145
+ * @returns Package specifier or absolute path to empty.js
7145
7146
  */
7146
- getEmptyModulePath() {
7147
+ getEmptyModulePath(returnPackageSpecifier = false) {
7148
+ if (returnPackageSpecifier) {
7149
+ return "@donotdev/core/empty";
7150
+ }
7151
+ const resolved = this.resolvePackage("@donotdev/core/empty");
7152
+ if (resolved) return resolved;
7147
7153
  const thisDir = dirname(fileURLToPath(import.meta.url));
7148
- return this.normalizePath(join(thisDir, "../vite/empty.js"));
7154
+ return this.normalizePath(join(thisDir, "../empty.js"));
7149
7155
  }
7150
7156
  // === PRIVATE METHODS ===
7151
7157
  /**
@@ -7141,11 +7141,17 @@ var init_PathResolver = __esm({
7141
7141
  /**
7142
7142
  * Get path to empty.js module for optional dependency aliasing
7143
7143
  * Used by Vite and Turbopack to alias missing optional deps
7144
- * @returns Absolute path to empty.js
7144
+ * @param returnPackageSpecifier - If true, returns package specifier '@donotdev/core/empty' for Turbopack. If false, returns absolute path for Vite.
7145
+ * @returns Package specifier or absolute path to empty.js
7145
7146
  */
7146
- getEmptyModulePath() {
7147
+ getEmptyModulePath(returnPackageSpecifier = false) {
7148
+ if (returnPackageSpecifier) {
7149
+ return "@donotdev/core/empty";
7150
+ }
7151
+ const resolved = this.resolvePackage("@donotdev/core/empty");
7152
+ if (resolved) return resolved;
7147
7153
  const thisDir = dirname(fileURLToPath(import.meta.url));
7148
- return this.normalizePath(join(thisDir, "../vite/empty.js"));
7154
+ return this.normalizePath(join(thisDir, "../empty.js"));
7149
7155
  }
7150
7156
  // === PRIVATE METHODS ===
7151
7157
  /**
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @fileoverview Make Admin Command Wrapper
3
+ * @description Re-exports makeAdmin from tooling for CLI bundling.
4
+ * Each command wrapper is bundled separately as a fully self-contained script.
5
+ *
6
+ * @version 0.0.1
7
+ * @since 0.0.1
8
+ * @author AMBROISE PARK Consulting
9
+ */
10
+ export { makeAdmin as main } from '@donotdev/tooling';
11
+ //# sourceMappingURL=make-admin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-admin.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/make-admin.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,12 @@
1
+ // packages/cli/src/bin/commands/make-admin.ts
2
+ /**
3
+ * @fileoverview Make Admin Command Wrapper
4
+ * @description Re-exports makeAdmin from tooling for CLI bundling.
5
+ * Each command wrapper is bundled separately as a fully self-contained script.
6
+ *
7
+ * @version 0.0.1
8
+ * @since 0.0.1
9
+ * @author AMBROISE PARK Consulting
10
+ */
11
+ export { makeAdmin as main } from '@donotdev/tooling';
12
+ //# sourceMappingURL=make-admin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-admin.js","sourceRoot":"","sources":["../../../src/bin/commands/make-admin.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
@@ -7439,11 +7439,17 @@ var init_PathResolver = __esm({
7439
7439
  /**
7440
7440
  * Get path to empty.js module for optional dependency aliasing
7441
7441
  * Used by Vite and Turbopack to alias missing optional deps
7442
- * @returns Absolute path to empty.js
7442
+ * @param returnPackageSpecifier - If true, returns package specifier '@donotdev/core/empty' for Turbopack. If false, returns absolute path for Vite.
7443
+ * @returns Package specifier or absolute path to empty.js
7443
7444
  */
7444
- getEmptyModulePath() {
7445
+ getEmptyModulePath(returnPackageSpecifier = false) {
7446
+ if (returnPackageSpecifier) {
7447
+ return "@donotdev/core/empty";
7448
+ }
7449
+ const resolved = this.resolvePackage("@donotdev/core/empty");
7450
+ if (resolved) return resolved;
7445
7451
  const thisDir = dirname(fileURLToPath(import.meta.url));
7446
- return this.normalizePath(join(thisDir, "../vite/empty.js"));
7452
+ return this.normalizePath(join(thisDir, "../empty.js"));
7447
7453
  }
7448
7454
  // === PRIVATE METHODS ===
7449
7455
  /**
@@ -7463,11 +7463,17 @@ var init_PathResolver = __esm({
7463
7463
  /**
7464
7464
  * Get path to empty.js module for optional dependency aliasing
7465
7465
  * Used by Vite and Turbopack to alias missing optional deps
7466
- * @returns Absolute path to empty.js
7466
+ * @param returnPackageSpecifier - If true, returns package specifier '@donotdev/core/empty' for Turbopack. If false, returns absolute path for Vite.
7467
+ * @returns Package specifier or absolute path to empty.js
7467
7468
  */
7468
- getEmptyModulePath() {
7469
+ getEmptyModulePath(returnPackageSpecifier = false) {
7470
+ if (returnPackageSpecifier) {
7471
+ return "@donotdev/core/empty";
7472
+ }
7473
+ const resolved = this.resolvePackage("@donotdev/core/empty");
7474
+ if (resolved) return resolved;
7469
7475
  const thisDir = dirname(fileURLToPath(import.meta.url));
7470
- return this.normalizePath(join(thisDir, "../vite/empty.js"));
7476
+ return this.normalizePath(join(thisDir, "../empty.js"));
7471
7477
  }
7472
7478
  // === PRIVATE METHODS ===
7473
7479
  /**
package/dist/index.js CHANGED
@@ -7762,11 +7762,17 @@ var init_PathResolver = __esm({
7762
7762
  /**
7763
7763
  * Get path to empty.js module for optional dependency aliasing
7764
7764
  * Used by Vite and Turbopack to alias missing optional deps
7765
- * @returns Absolute path to empty.js
7765
+ * @param returnPackageSpecifier - If true, returns package specifier '@donotdev/core/empty' for Turbopack. If false, returns absolute path for Vite.
7766
+ * @returns Package specifier or absolute path to empty.js
7766
7767
  */
7767
- getEmptyModulePath() {
7768
+ getEmptyModulePath(returnPackageSpecifier = false) {
7769
+ if (returnPackageSpecifier) {
7770
+ return "@donotdev/core/empty";
7771
+ }
7772
+ const resolved = this.resolvePackage("@donotdev/core/empty");
7773
+ if (resolved) return resolved;
7768
7774
  const thisDir = dirname(fileURLToPath(import.meta.url));
7769
- return this.normalizePath(join(thisDir, "../vite/empty.js"));
7775
+ return this.normalizePath(join(thisDir, "../empty.js"));
7770
7776
  }
7771
7777
  // === PRIVATE METHODS ===
7772
7778
  /**
@@ -8772,12 +8778,7 @@ function executeFirebaseCommand(args, options) {
8772
8778
  env: deployEnv
8773
8779
  };
8774
8780
  let result;
8775
- if (process.platform === "win32") {
8776
- const firebaseCmd = "C:\\Program Files\\nodejs\\firebase.cmd";
8777
- result = spawnSync2(firebaseCmd, args, { ...spawnOptions, shell: false });
8778
- } else {
8779
- result = spawnSync2("firebase", args, { ...spawnOptions, shell: true });
8780
- }
8781
+ result = spawnSync2("firebase", args, { ...spawnOptions, shell: true });
8781
8782
  if (result.error) {
8782
8783
  return {
8783
8784
  success: false,
@@ -9797,52 +9798,60 @@ async function mergeRootTurboJson(rootDir) {
9797
9798
  // packages/tooling/src/utils/matrix.ts
9798
9799
  init_utils();
9799
9800
  init_pathResolver();
9801
+ import { createRequire as createRequire4 } from "node:module";
9800
9802
  var cachedMatrix = null;
9801
9803
  function getMatrixPath(mode) {
9804
+ try {
9805
+ const require3 = createRequire4(import.meta.url);
9806
+ const resolved = require3.resolve("@donotdev/cli/dependencies-matrix.json");
9807
+ if (pathExists(resolved)) {
9808
+ return resolved;
9809
+ }
9810
+ } catch {
9811
+ }
9802
9812
  const executionMode = mode || detectExecutionMode();
9803
9813
  if (executionMode === "development") {
9804
9814
  const repoRoot = getRepoRoot();
9805
- const devPath = normalizePath(
9806
- repoRoot,
9807
- "packages/cli/dependencies-matrix.json"
9808
- );
9809
- if (!pathExists(devPath)) {
9810
- throw new Error(`[DEV] Matrix not found at: ${devPath}`);
9815
+ if (repoRoot) {
9816
+ const devPath = normalizePath(
9817
+ repoRoot,
9818
+ "packages/cli/dependencies-matrix.json"
9819
+ );
9820
+ if (pathExists(devPath)) {
9821
+ return devPath;
9822
+ }
9811
9823
  }
9812
- return devPath;
9813
- }
9814
- const cliPackagePath = getCliRootFromBundle();
9815
- const matrixPath = joinPath(cliPackagePath, "dependencies-matrix.json");
9816
- if (!pathExists(matrixPath)) {
9817
- throw new Error(`[PROD] Matrix not found at: ${matrixPath}`);
9818
9824
  }
9819
- return matrixPath;
9825
+ return null;
9820
9826
  }
9821
9827
  function getCliVersion(mode) {
9828
+ try {
9829
+ const require3 = createRequire4(import.meta.url);
9830
+ const packageJsonPath = require3.resolve("@donotdev/cli/package.json");
9831
+ const pkg = readSync(packageJsonPath, { format: "json" });
9832
+ return String(pkg?.version || "0.0.0");
9833
+ } catch {
9834
+ }
9822
9835
  const executionMode = mode || detectExecutionMode();
9823
9836
  if (executionMode === "development") {
9824
9837
  const repoRoot = getRepoRoot();
9825
9838
  const cliPackageJson = joinPath(repoRoot, "packages/cli/package.json");
9826
- if (!pathExists(cliPackageJson)) {
9827
- throw new Error(`[DEV] CLI package.json not found at: ${cliPackageJson}`);
9839
+ if (pathExists(cliPackageJson)) {
9840
+ const pkg = readSync(cliPackageJson, { format: "json" });
9841
+ return String(pkg?.version || "0.0.0");
9828
9842
  }
9829
- const pkg2 = readSync(cliPackageJson, { format: "json" });
9830
- return String(pkg2?.version || "0.0.0");
9831
9843
  }
9832
- const cliPackagePath = getCliRootFromBundle();
9833
- const packageJsonPath = joinPath(cliPackagePath, "package.json");
9834
- if (!pathExists(packageJsonPath)) {
9835
- throw new Error(`[PROD] CLI package.json not found at: ${packageJsonPath}`);
9836
- }
9837
- const pkg = readSync(packageJsonPath, { format: "json" });
9838
- return String(pkg?.version || "0.0.0");
9844
+ return "0.0.0";
9839
9845
  }
9840
9846
  function loadMatrix(mode) {
9841
9847
  if (cachedMatrix) return cachedMatrix;
9842
9848
  const matrixPath = getMatrixPath(mode);
9849
+ if (!matrixPath) {
9850
+ return null;
9851
+ }
9843
9852
  const content = readSync(matrixPath, { format: "json" });
9844
9853
  if (!content) {
9845
- throw new Error(`Failed to read dependencies-matrix.json at ${matrixPath}`);
9854
+ return null;
9846
9855
  }
9847
9856
  cachedMatrix = {
9848
9857
  matrix: content,
@@ -10368,11 +10377,15 @@ async function deployFunctions(appDir, serviceAccountPath, projectId, config) {
10368
10377
  }
10369
10378
  const s = Y2();
10370
10379
  s.start("Validating function dependencies...");
10371
- const nodeModulesPath = joinPath(functionsDir, "node_modules");
10372
10380
  const requiredPackages = ["firebase-functions", "firebase-admin"];
10373
- const missingPackages = requiredPackages.filter(
10374
- (pkg) => !pathExists(joinPath(nodeModulesPath, pkg))
10375
- );
10381
+ const missingPackages = requiredPackages.filter((pkg) => {
10382
+ try {
10383
+ resolvePackage(pkg, functionsDir);
10384
+ return false;
10385
+ } catch {
10386
+ return true;
10387
+ }
10388
+ });
10376
10389
  if (missingPackages.length > 0) {
10377
10390
  s.stop("Missing dependencies");
10378
10391
  throw new DoNotDevError(
@@ -10387,6 +10400,8 @@ To fix this, run:
10387
10400
  }
10388
10401
  s.stop("Dependencies validated");
10389
10402
  prepareFunctionsForDeployment(functionsDir, config.verbose);
10403
+ log.debug("Waiting for file system sync...");
10404
+ await new Promise((resolve4) => setTimeout(resolve4, 1e3));
10390
10405
  try {
10391
10406
  if (!config.skipBuild) {
10392
10407
  const s2 = Y2();
@@ -11117,7 +11132,7 @@ function generateScripts(templateName, options) {
11117
11132
  const scripts = {};
11118
11133
  if (templateName.includes("vite")) {
11119
11134
  scripts.dev = "vite";
11120
- scripts.build = "tsc --noEmit && cross-env NODE_ENV=production VITE_NODE_POLYFILL=true vite build";
11135
+ scripts.build = "vite build";
11121
11136
  scripts.preview = "vite preview";
11122
11137
  scripts.lint = "eslint src/";
11123
11138
  scripts["type-check"] = "tsc --noEmit";
@@ -11151,7 +11166,13 @@ function generateScripts(templateName, options) {
11151
11166
  return scripts;
11152
11167
  }
11153
11168
  function generatePackageJson(templateName, mode, options = {}) {
11154
- const { matrix, cliVersion } = loadMatrix(mode);
11169
+ const matrixResult = loadMatrix(mode);
11170
+ if (!matrixResult) {
11171
+ throw new Error(
11172
+ "dependencies-matrix.json not found. This command requires the matrix file."
11173
+ );
11174
+ }
11175
+ const { matrix, cliVersion } = matrixResult;
11155
11176
  const template = matrix.templateMapping?.[templateName];
11156
11177
  if (!template) {
11157
11178
  throw new Error(`Template "${templateName}" not found in matrix`);
@@ -11201,14 +11222,19 @@ function generatePackageJson(templateName, mode, options = {}) {
11201
11222
  result.peerDependencies = peerDependencies;
11202
11223
  }
11203
11224
  if (templateName === "consumer-root") {
11204
- result.packageManager = "bun@1.3.3";
11205
- result.engines = { node: ">=20.0.0", bun: ">=1.1.0" };
11225
+ result.packageManager = "bun@1.3.5";
11226
+ result.engines = { node: ">=24.0.0", bun: ">=1.3.0" };
11206
11227
  result.workspaces = ["apps/*", "entities"];
11207
11228
  }
11208
11229
  if (templateName === "entities") {
11209
11230
  result.main = "./index.ts";
11210
11231
  result.types = "./index.ts";
11211
11232
  }
11233
+ if (templateName.includes("vite") || templateName.includes("nextjs") || templateName.includes("functions")) {
11234
+ if (!dependencies.entities) {
11235
+ dependencies.entities = "workspace:*";
11236
+ }
11237
+ }
11212
11238
  if (templateName.includes("functions")) {
11213
11239
  result.engines = { node: "20" };
11214
11240
  if (options.appName) {
@@ -11331,7 +11357,8 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
11331
11357
  firebaseProjectId: appName.toLowerCase(),
11332
11358
  firebaseSecretName: appName.toUpperCase().replace(/-/g, "_"),
11333
11359
  monorepoRelativePath: "../../packages/tooling",
11334
- appTemplate
11360
+ appTemplate,
11361
+ isNextjs: appTemplate === "nextjs"
11335
11362
  };
11336
11363
  const templateSourceDir = joinPath(templatesRoot, templateDir);
11337
11364
  const templateFiles = await glob("**/*", {
@@ -11424,7 +11451,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
11424
11451
  await replacePlaceholders(firebaseJsonDest, replacements);
11425
11452
  }
11426
11453
  }
11427
- if (appConfig.needsBackend && appConfig.backendPlatform === "vercel") {
11454
+ if (appTemplate === "nextjs" || appConfig.needsBackend && appConfig.backendPlatform === "vercel") {
11428
11455
  const vercelJsonSource = joinPath(
11429
11456
  deploymentTemplateDir,
11430
11457
  "vercel.json.example"
@@ -11805,6 +11832,7 @@ async function main8(options) {
11805
11832
  setupGithubActions: false,
11806
11833
  monorepoRelativePath: relativeMonorepoPath,
11807
11834
  appTemplate: "vite",
11835
+ isNextjs: false,
11808
11836
  firebaseProjectId: projectName.toLowerCase(),
11809
11837
  firebaseSecretName: projectName.toUpperCase().replace(/-/g, "_"),
11810
11838
  needsAuth,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donotdev/cli",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Command-line interface for DoNotDev Framework",
5
5
  "type": "module",
6
6
  "private": false,