@open-commune/web 0.1.5 → 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.
- package/README.md +13 -0
- package/nuxt.config.ts +27 -8
- package/package.json +2 -2
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 {
|
|
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
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@iconify/vue": "^5.0.1",
|
|
18
18
|
"@nuxt/kit": "^4.5.1",
|
|
19
19
|
"@nuxt/ui": "^4.3.0",
|
|
20
|
-
"@open-commune/core": "^0.1.
|
|
20
|
+
"@open-commune/core": "^0.1.5",
|
|
21
21
|
"@open-commune/editor": "^0.1.4",
|
|
22
22
|
"@pinia-orm/nuxt": "^2.0.0",
|
|
23
23
|
"@pinia/nuxt": "^1.0.1",
|
|
@@ -40,7 +40,7 @@
|
|
|
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.
|
|
43
|
+
"version": "0.1.6",
|
|
44
44
|
"type": "module",
|
|
45
45
|
"main": "./nuxt.config.ts",
|
|
46
46
|
"files": [
|