gmoonc 0.0.22 → 0.0.23

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
@@ -101,6 +101,12 @@ The logo is installed at `src/gmoonc/assets/gmoonc-logo.png`. You can replace it
101
101
 
102
102
  ## Changelog
103
103
 
104
+ ### 0.0.23
105
+ - Fix: Improved package root detection for SQL files in supabase-seed command
106
+ - Fix: Added validation to check SQL files exist before attempting to copy
107
+ - Fix: Better error messages showing where SQL files are being searched
108
+ - Fix: SQL files are now correctly located when package is installed from npm
109
+
104
110
  ### 0.0.22
105
111
  - Feature: New `supabase-seed --vite` command to seed Supabase database
106
112
  - Feature: Automatic SQL file execution (tables, functions, RLS, seed data)
package/dist/index.cjs CHANGED
@@ -1818,12 +1818,55 @@ var import_fs11 = require("fs");
1818
1818
  var import_pg = require("pg");
1819
1819
  var import_dotenv = require("dotenv");
1820
1820
  function getPackageRoot() {
1821
- try {
1822
- const currentDir = typeof __dirname !== "undefined" ? __dirname : process.cwd();
1823
- return (0, import_path7.join)(currentDir, "../../..");
1824
- } catch {
1825
- return (0, import_path7.join)(process.cwd(), "node_modules", "gmoonc");
1821
+ const possiblePaths = [
1822
+ // Strategy 1: From __dirname (when running from dist/cli/lib)
1823
+ (() => {
1824
+ try {
1825
+ if (typeof __dirname !== "undefined") {
1826
+ const distPath = (0, import_path7.join)(__dirname, "../..");
1827
+ if ((0, import_fs11.existsSync)((0, import_path7.join)(distPath, "package.json"))) {
1828
+ return distPath;
1829
+ }
1830
+ }
1831
+ } catch {
1832
+ }
1833
+ return null;
1834
+ })(),
1835
+ // Strategy 2: From node_modules (when installed)
1836
+ (0, import_path7.join)(process.cwd(), "node_modules", "gmoonc"),
1837
+ // Strategy 3: From packages (when in monorepo dev)
1838
+ (0, import_path7.join)(process.cwd(), "packages", "gmoonc"),
1839
+ // Strategy 4: Try to find by looking for package.json with name "gmoonc"
1840
+ (() => {
1841
+ let current = typeof __dirname !== "undefined" ? __dirname : process.cwd();
1842
+ for (let i = 0; i < 5; i++) {
1843
+ const pkgPath = (0, import_path7.join)(current, "package.json");
1844
+ if ((0, import_fs11.existsSync)(pkgPath)) {
1845
+ try {
1846
+ const pkg = JSON.parse((0, import_fs11.readFileSync)(pkgPath, "utf-8"));
1847
+ if (pkg.name === "gmoonc") {
1848
+ return current;
1849
+ }
1850
+ } catch {
1851
+ }
1852
+ }
1853
+ current = (0, import_path7.join)(current, "..");
1854
+ }
1855
+ return null;
1856
+ })()
1857
+ ];
1858
+ for (const path of possiblePaths) {
1859
+ if (path && (0, import_fs11.existsSync)((0, import_path7.join)(path, "package.json"))) {
1860
+ try {
1861
+ const pkg = JSON.parse((0, import_fs11.readFileSync)((0, import_path7.join)(path, "package.json"), "utf-8"));
1862
+ if (pkg.name === "gmoonc") {
1863
+ return path;
1864
+ }
1865
+ } catch {
1866
+ }
1867
+ }
1826
1868
  }
1869
+ return (0, import_path7.join)(process.cwd(), "node_modules", "gmoonc");
1827
1870
  }
1828
1871
  var PACKAGE_ROOT = getPackageRoot();
1829
1872
  async function seedSupabase(options) {
@@ -1874,6 +1917,20 @@ async function seedSupabase(options) {
1874
1917
  ];
1875
1918
  const projectSqlDir = (0, import_path7.join)(gmooncDir, "supabase", "sql");
1876
1919
  const packageSqlDir = (0, import_path7.join)(PACKAGE_ROOT, "assets", "supabase");
1920
+ const missingFiles = [];
1921
+ for (const sqlFile of sqlFiles) {
1922
+ const packagePath = (0, import_path7.join)(packageSqlDir, sqlFile.name);
1923
+ if (!(0, import_fs11.existsSync)(packagePath)) {
1924
+ missingFiles.push(sqlFile.name);
1925
+ }
1926
+ }
1927
+ if (missingFiles.length > 0) {
1928
+ logError(`SQL files not found in package at: ${packageSqlDir}`);
1929
+ logError(`Missing files: ${missingFiles.join(", ")}`);
1930
+ logError(`Package root resolved to: ${PACKAGE_ROOT}`);
1931
+ logError(`Please ensure SQL files are included in the npm package.`);
1932
+ return { success: false, message: "SQL files not found in package" };
1933
+ }
1877
1934
  if (!(0, import_fs11.existsSync)(projectSqlDir)) {
1878
1935
  ensureDirectoryExists((0, import_path7.join)(projectSqlDir, "dummy"));
1879
1936
  logInfo("\u{1F4CB} Copying SQL files to project...");
@@ -1884,6 +1941,9 @@ async function seedSupabase(options) {
1884
1941
  const content = (0, import_fs11.readFileSync)(packagePath, "utf-8");
1885
1942
  (0, import_fs11.writeFileSync)(projectPath, content, "utf-8");
1886
1943
  logSuccess(`Copied ${sqlFile.name} to src/gmoonc/supabase/sql/`);
1944
+ } else {
1945
+ logError(`Failed to copy ${sqlFile.name} - file not found at ${packagePath}`);
1946
+ return { success: false, message: `SQL file not found: ${sqlFile.name}` };
1887
1947
  }
1888
1948
  }
1889
1949
  }
@@ -1904,6 +1964,9 @@ async function seedSupabase(options) {
1904
1964
  }
1905
1965
  if (!(0, import_fs11.existsSync)(sqlPath)) {
1906
1966
  logError(`SQL file not found: ${sqlFile.name}`);
1967
+ logError(` Searched in project: ${(0, import_path7.join)(projectSqlDir, sqlFile.name)}`);
1968
+ logError(` Searched in package: ${(0, import_path7.join)(packageSqlDir, sqlFile.name)}`);
1969
+ logError(` Package root: ${PACKAGE_ROOT}`);
1907
1970
  await client.end();
1908
1971
  return { success: false, message: `SQL file not found: ${sqlFile.name}` };
1909
1972
  }
@@ -1978,7 +2041,7 @@ async function seedSupabase(options) {
1978
2041
 
1979
2042
  // src/cli/index.ts
1980
2043
  var program = new import_commander.Command();
1981
- program.name("gmoonc").description("Goalmoon Ctrl (gmoonc): Install complete dashboard into your React project").version("0.0.22").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) => {
2044
+ program.name("gmoonc").description("Goalmoon Ctrl (gmoonc): Install complete dashboard into your React project").version("0.0.23").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) => {
1982
2045
  try {
1983
2046
  logInfo("\u{1F680} Starting gmoonc installer...");
1984
2047
  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.22",
3
+ "version": "0.0.23",
4
4
  "description": "Goalmoon Ctrl (gmoonc): Complete dashboard installer for React projects",
5
5
  "license": "MIT",
6
6
  "homepage": "https://gmoonc.com",