agor-live 0.6.6 → 0.6.7
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.
|
@@ -25,6 +25,9 @@ declare class Init extends Command {
|
|
|
25
25
|
private isCodespaces;
|
|
26
26
|
/**
|
|
27
27
|
* Detect if running in dev mode (from source) vs agor-live (npm package)
|
|
28
|
+
*
|
|
29
|
+
* Dev mode = running from agor monorepo source
|
|
30
|
+
* Agor-live mode = running from npm package (globally installed or in node_modules)
|
|
28
31
|
*/
|
|
29
32
|
private isDevMode;
|
|
30
33
|
run(): Promise<void>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/commands/init.ts
|
|
2
2
|
import { access, constants, mkdir, readdir, rm } from "fs/promises";
|
|
3
3
|
import { homedir } from "os";
|
|
4
|
-
import { join } from "path";
|
|
4
|
+
import { dirname, join } from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
5
6
|
import { isDaemonRunning } from "@agor/core/api";
|
|
6
7
|
import { loadConfig, setConfigValue } from "@agor/core/config";
|
|
7
8
|
import { createDatabase, createUser, runMigrations, seedInitialData } from "@agor/core/db";
|
|
@@ -84,10 +85,19 @@ var Init = class _Init extends Command {
|
|
|
84
85
|
}
|
|
85
86
|
/**
|
|
86
87
|
* Detect if running in dev mode (from source) vs agor-live (npm package)
|
|
88
|
+
*
|
|
89
|
+
* Dev mode = running from agor monorepo source
|
|
90
|
+
* Agor-live mode = running from npm package (globally installed or in node_modules)
|
|
87
91
|
*/
|
|
88
92
|
async isDevMode() {
|
|
93
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
94
|
+
const __dirname = dirname(__filename);
|
|
95
|
+
if (__dirname.includes("node_modules/agor-live") || __dirname.includes("node_modules\\agor-live")) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
89
98
|
const corePackagePath = join(process.cwd(), "packages", "core");
|
|
90
|
-
|
|
99
|
+
const isInMonorepo = await this.pathExists(corePackagePath);
|
|
100
|
+
return isInMonorepo;
|
|
91
101
|
}
|
|
92
102
|
async run() {
|
|
93
103
|
const { flags } = await this.parse(_Init);
|