gmoonc 0.0.20 → 0.0.21

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.
package/README.md CHANGED
@@ -63,6 +63,11 @@ The logo is installed at `src/gmoonc/assets/gmoonc-logo.png`. You can replace it
63
63
 
64
64
  ## Changelog
65
65
 
66
+ ### 0.0.21
67
+ - Fix: Navigate import now always added when route protection is present in GMooncAppLayout.tsx
68
+ - Fix: Improved Navigate import detection - checks for route protection code, not just usage
69
+ - Fix: More robust regex matching for react-router-dom imports (handles both single and double quotes)
70
+
66
71
  ### 0.0.20
67
72
  - Fix: Navigate import now always added to GMooncAppLayout.tsx when patching
68
73
  - Fix: Improved Navigate import detection and addition logic
package/dist/index.cjs CHANGED
@@ -1667,20 +1667,6 @@ function patchExistingCode(projectDir, gmooncDir) {
1667
1667
  /import\s+{\s*GMooncSessionProvider[^}]*}\s+from\s+['"][^'"]*session\/GMooncSessionContext['"]/g,
1668
1668
  "import { GMooncSupabaseSessionProvider, useGMooncSession } from '../supabase/auth/GMooncSupabaseSessionProvider'"
1669
1669
  );
1670
- const usesNavigate = /<Navigate\s+to=/.test(content);
1671
- const hasNavigateImport = /import\s+{[^}]*Navigate[^}]*}\s+from\s+['"]react-router-dom['"]/.test(content);
1672
- if (usesNavigate && !hasNavigateImport) {
1673
- content = content.replace(
1674
- /import\s+{\s*([^}]*)\s*}\s+from\s+['"]react-router-dom['"]/,
1675
- (match, imports) => {
1676
- if (/\bNavigate\b/.test(imports)) {
1677
- return match;
1678
- }
1679
- const cleanImports = imports.trim().replace(/,\s*$/, "");
1680
- return `import { ${cleanImports}, Navigate } from 'react-router-dom'`;
1681
- }
1682
- );
1683
- }
1684
1670
  content = content.replace(/GMooncSessionProvider/g, "GMooncSupabaseSessionProvider");
1685
1671
  if (!content.includes("!isAuthenticated")) {
1686
1672
  content = content.replace(
@@ -1745,6 +1731,26 @@ $2`
1745
1731
  $1`
1746
1732
  );
1747
1733
  }
1734
+ const usesNavigate = /<Navigate\s+to=/.test(content);
1735
+ const hasNavigateImport = /import\s+{[^}]*\bNavigate\b[^}]*}\s+from\s+['"]react-router-dom['"]/.test(content);
1736
+ if (usesNavigate && !hasNavigateImport) {
1737
+ const importRegex = /import\s+{\s*([^}]*)\s*}\s+from\s+['"]react-router-dom['"]/;
1738
+ const match = content.match(importRegex);
1739
+ if (match) {
1740
+ const imports = match[1];
1741
+ if (!/\bNavigate\b/.test(imports)) {
1742
+ const cleanImports = imports.trim().replace(/,\s*$/, "");
1743
+ const quote = match[0].includes("'") ? "'" : '"';
1744
+ content = content.replace(
1745
+ importRegex,
1746
+ `import { ${cleanImports}, Navigate } from ${quote}react-router-dom${quote}`
1747
+ );
1748
+ }
1749
+ } else {
1750
+ content = `import { Navigate } from 'react-router-dom';
1751
+ ${content}`;
1752
+ }
1753
+ }
1748
1754
  writeFileSafe(layoutPath, content);
1749
1755
  logSuccess("Patched layout/GMooncAppLayout.tsx to use GMooncSupabaseSessionProvider and add route protection");
1750
1756
  }
@@ -1804,7 +1810,7 @@ function updateAllSessionImports(gmooncDir) {
1804
1810
 
1805
1811
  // src/cli/index.ts
1806
1812
  var program = new import_commander.Command();
1807
- program.name("gmoonc").description("Goalmoon Ctrl (gmoonc): Install complete dashboard into your React project").version("0.0.20").option("--base <path>", "Base path for dashboard routes", "/app").option("--skip-router-patch", "Skip automatic router integration (only copy files and inject CSS)").option("--dry-run", "Show what would be done without making changes").action(async (options) => {
1813
+ program.name("gmoonc").description("Goalmoon Ctrl (gmoonc): Install complete dashboard into your React project").version("0.0.21").option("--base <path>", "Base path for dashboard routes", "/app").option("--skip-router-patch", "Skip automatic router integration (only copy files and inject CSS)").option("--dry-run", "Show what would be done without making changes").action(async (options) => {
1808
1814
  try {
1809
1815
  logInfo("\u{1F680} Starting gmoonc installer...");
1810
1816
  logInfo("\u{1F4E6} Installing complete dashboard into your React project\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gmoonc",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "Goalmoon Ctrl (gmoonc): Complete dashboard installer for React projects",
5
5
  "license": "MIT",
6
6
  "homepage": "https://gmoonc.com",