@open-commune/web 0.1.4 → 0.1.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 (3) hide show
  1. package/README.md +13 -0
  2. package/nuxt.config.ts +27 -8
  3. package/package.json +14 -11
package/README.md CHANGED
@@ -36,6 +36,19 @@ Run it with Bun: the database layer uses `bun:sqlite`, so `bun --bun nuxt dev`,
36
36
 
37
37
  Environment is validated at startup by `@open-commune/core`; see `.env.example` in the repository for the full list.
38
38
 
39
+ One variable matters when you deploy a build rather than run it in place. Nitro
40
+ inlines the core into its chunks, but the Drizzle migrations are files: the
41
+ build drops them next to the server output, and the deployment points at them.
42
+
43
+ ```
44
+ COMMUN_MIGRATIONS_DIR=/path/to/.output/drizzle
45
+ ```
46
+
47
+ Leave it unset in development — the layer resolves the folder from the
48
+ installed `@open-commune/core`. Unset in a deployment where `node_modules` is
49
+ gone, migrations are silently skipped and the first query fails on a missing
50
+ table.
51
+
39
52
  ## Licence
40
53
 
41
54
  AGPL-3.0-or-later.
package/nuxt.config.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { globSync } from 'node:fs';
2
- import { dirname, join, resolve } from 'node:path';
2
+ import { cp } from 'node:fs/promises';
3
+ import { dirname, join } from 'node:path';
4
+ import { createRequire } from 'node:module';
3
5
  import { fileURLToPath } from 'node:url';
4
6
 
5
7
  // Under Bun's isolated store, the ESM build of @vue/devtools-api only exists
@@ -32,13 +34,21 @@ const devtoolsApiEsm = findDevtoolsApiEsm();
32
34
  // found.
33
35
  const layerDir = dirname(fileURLToPath(import.meta.url));
34
36
 
35
- // Le worker de dev empaquette les sources du core, donc le dossier de
36
- // migrations Drizzle n'y est pas resolvable relativement — on l'epingle ici,
37
- // ou le chemin est connu. (Repris de l'ancien apps/api/nitro.config.ts.)
38
- process.env.COMMUN_MIGRATIONS_DIR ??= resolve(
39
- fileURLToPath(new URL('.', import.meta.url)),
40
- '../../packages/core/drizzle',
41
- );
37
+ // Le worker de dev empaquette les sources du core : le dossier de migrations
38
+ // Drizzle n'y est plus resolvable relativement, on l'epingle ici. Par
39
+ // resolution de module et NON par chemin relatif — « ../../packages/core »
40
+ // n'est vrai que dans le monorepo, jamais chez qui installe la couche.
41
+ function coreDrizzleDir(): string | undefined {
42
+ try {
43
+ const pkg = createRequire(import.meta.url).resolve('@open-commune/core/package.json');
44
+ return join(dirname(pkg), 'drizzle');
45
+ } catch {
46
+ return undefined;
47
+ }
48
+ }
49
+
50
+ const drizzleDir = coreDrizzleDir();
51
+ if (drizzleDir) process.env.COMMUN_MIGRATIONS_DIR ??= drizzleDir;
42
52
 
43
53
  // https://nuxt.com/docs/api/configuration/nuxt-config
44
54
  export default defineNuxtConfig({
@@ -75,6 +85,15 @@ export default defineNuxtConfig({
75
85
  scheduledTasks: {
76
86
  '30 0 * * *': ['deploy'],
77
87
  },
88
+ hooks: {
89
+ // Nitro inline le core dans ses chunks : le dossier de migrations, lui,
90
+ // ne suit pas. On le depose a cote du build pour qu'il voyage avec, et
91
+ // le deploiement pointe COMMUN_MIGRATIONS_DIR dessus (l'image le fait).
92
+ async compiled(nitro) {
93
+ if (!drizzleDir) return;
94
+ await cp(drizzleDir, join(nitro.options.output.dir, 'drizzle'), { recursive: true });
95
+ },
96
+ },
78
97
  },
79
98
  css: [join(layerDir, 'assets/css/main.css')],
80
99
  // Scan nested composables (composables/core/domains/*).
package/package.json CHANGED
@@ -9,26 +9,25 @@
9
9
  "typecheck": "tsc --noEmit -p .nuxt/tsconfig.server.json"
10
10
  },
11
11
  "devDependencies": {
12
- "@iconify/vue": "^5.0.1",
13
- "@nuxt/kit": "^4.5.1",
14
- "@nuxt/ui": "^4.3.0",
15
- "@tiptap/pm": "^3.27.3",
16
- "@tiptap/vue-3": "^3.27.3",
17
12
  "@types/node": "^18",
18
- "@vueuse/core": "^14.4.0",
19
- "@vueuse/nuxt": "^14.4.0",
20
- "nuxt": "^4.5.2",
21
- "tailwindcss": "^4.3.2"
13
+ "nuxt": "^4.5.2"
22
14
  },
23
15
  "dependencies": {
24
16
  "@casl/ability": "^7.0.1",
25
- "@open-commune/core": "^0.1.4",
17
+ "@iconify/vue": "^5.0.1",
18
+ "@nuxt/kit": "^4.5.1",
19
+ "@nuxt/ui": "^4.3.0",
20
+ "@open-commune/core": "^0.1.5",
26
21
  "@open-commune/editor": "^0.1.4",
27
22
  "@pinia-orm/nuxt": "^2.0.0",
28
23
  "@pinia/nuxt": "^1.0.1",
29
24
  "@tanstack/vue-query": "^5.101.4",
25
+ "@tiptap/pm": "^3.27.3",
26
+ "@tiptap/vue-3": "^3.27.3",
30
27
  "@trpc/client": "^11.17.0",
31
28
  "@trpc/server": "^11.17.0",
29
+ "@vueuse/core": "^14.4.0",
30
+ "@vueuse/nuxt": "^14.4.0",
32
31
  "axios": "^1.6.7",
33
32
  "consola": "^3.4.2",
34
33
  "h3": "^1.15.11",
@@ -36,11 +35,12 @@
36
35
  "mapbox-gl": "^3.2.0",
37
36
  "ofetch": "^1.3.3",
38
37
  "pinia-orm": "^2.0.0",
38
+ "tailwindcss": "^4.3.2",
39
39
  "zod": "^4.4.3"
40
40
  },
41
41
  "description": "The Open Commune application: the admin interface and the server, on a single origin.",
42
42
  "license": "AGPL-3.0-or-later",
43
- "version": "0.1.4",
43
+ "version": "0.1.6",
44
44
  "type": "module",
45
45
  "main": "./nuxt.config.ts",
46
46
  "files": [
@@ -67,5 +67,8 @@
67
67
  "type": "git",
68
68
  "url": "git+https://github.com/open-commune/open-commune.git",
69
69
  "directory": "apps/web"
70
+ },
71
+ "peerDependencies": {
72
+ "nuxt": "^4.5.2"
70
73
  }
71
74
  }