gmoonc 0.0.19 → 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 +9 -0
- package/dist/index.cjs +21 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,6 +63,15 @@ 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
|
+
|
|
71
|
+
### 0.0.20
|
|
72
|
+
- Fix: Navigate import now always added to GMooncAppLayout.tsx when patching
|
|
73
|
+
- Fix: Improved Navigate import detection and addition logic
|
|
74
|
+
|
|
66
75
|
### 0.0.19
|
|
67
76
|
- Fix: Added Navigate import to GMooncAppLayout.tsx template
|
|
68
77
|
- Fix: Corrected route protection order - isLoading checked before isAuthenticated
|
package/dist/index.cjs
CHANGED
|
@@ -1667,17 +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
|
-
if (!content.includes("from 'react-router-dom'") || !content.includes("Navigate")) {
|
|
1671
|
-
content = content.replace(
|
|
1672
|
-
/import\s+{\s*([^}]*)\s*}\s+from\s+['"]react-router-dom['"]/,
|
|
1673
|
-
(match, imports) => {
|
|
1674
|
-
if (!imports.includes("Navigate")) {
|
|
1675
|
-
return `import { ${imports}, Navigate } from 'react-router-dom'`;
|
|
1676
|
-
}
|
|
1677
|
-
return match;
|
|
1678
|
-
}
|
|
1679
|
-
);
|
|
1680
|
-
}
|
|
1681
1670
|
content = content.replace(/GMooncSessionProvider/g, "GMooncSupabaseSessionProvider");
|
|
1682
1671
|
if (!content.includes("!isAuthenticated")) {
|
|
1683
1672
|
content = content.replace(
|
|
@@ -1742,6 +1731,26 @@ $2`
|
|
|
1742
1731
|
$1`
|
|
1743
1732
|
);
|
|
1744
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
|
+
}
|
|
1745
1754
|
writeFileSafe(layoutPath, content);
|
|
1746
1755
|
logSuccess("Patched layout/GMooncAppLayout.tsx to use GMooncSupabaseSessionProvider and add route protection");
|
|
1747
1756
|
}
|
|
@@ -1801,7 +1810,7 @@ function updateAllSessionImports(gmooncDir) {
|
|
|
1801
1810
|
|
|
1802
1811
|
// src/cli/index.ts
|
|
1803
1812
|
var program = new import_commander.Command();
|
|
1804
|
-
program.name("gmoonc").description("Goalmoon Ctrl (gmoonc): Install complete dashboard into your React project").version("0.0.
|
|
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) => {
|
|
1805
1814
|
try {
|
|
1806
1815
|
logInfo("\u{1F680} Starting gmoonc installer...");
|
|
1807
1816
|
logInfo("\u{1F4E6} Installing complete dashboard into your React project\n");
|