@oondemand/oon-core-back 0.3.45 → 0.3.46
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 +10 -1
- package/package.json +1 -1
- package/src/delivery/buildImage.js +19 -0
package/README.md
CHANGED
|
@@ -21,6 +21,15 @@ Compatibilidade temporária: `CENTRAL_ATIVACAO_BACKEND_URL` e `MEUS_APPS_BACKEND
|
|
|
21
21
|
|
|
22
22
|
Campos adicionais podem ser declarados em `activation.fields`; `password` e `secret` são sanitizados na configuração retornada ao frontend. Hooks opcionais: `validate`, `beforeComplete`, `afterComplete`.
|
|
23
23
|
|
|
24
|
+
## Imagem de entrega
|
|
25
|
+
|
|
26
|
+
O comando de delivery preserva `central.app.json` em dois pontos da imagem:
|
|
27
|
+
|
|
28
|
+
- `/src/central.app.json` durante o build do frontend declarativo;
|
|
29
|
+
- `/app/central.app.json` para descoberta pelo backend em runtime.
|
|
30
|
+
|
|
31
|
+
Centrais legadas sem o manifesto continuam suportadas. O empacotador cria uma pasta intermediária vazia, evitando tornar `central.app.json` obrigatório para aplicações que ainda usam somente `central.config.js`.
|
|
32
|
+
|
|
24
33
|
## Rótulos de campos relacionados
|
|
25
34
|
|
|
26
35
|
Por padrão, campos declarados com `fields.ref(...)` continuam sendo devolvidos pelo CRUD como `ObjectId`. Uma model pode optar pela população segura das referências usadas em grids e cards:
|
|
@@ -38,4 +47,4 @@ defineModel({
|
|
|
38
47
|
});
|
|
39
48
|
```
|
|
40
49
|
|
|
41
|
-
Use `populateRefs: true` para todas as referências da model ou informe uma lista explícita. O CRUD devolve somente `_id` e campos usuais de identificação, como nome, razão social, descrição, código, e-mail e campos pesquisáveis da model referenciada. Exportações mantêm os identificadores originais.
|
|
50
|
+
Use `populateRefs: true` para todas as referências da model ou informe uma lista explícita. O CRUD devolve somente `_id` e campos usuais de identificação, como nome, razão social, descrição, código, e-mail e campos pesquisáveis da model referenciada. Exportações mantêm os identificadores originais.
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ WORKDIR /src/frontend
|
|
|
10
10
|
COPY frontend/package*.json ./
|
|
11
11
|
RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
|
|
12
12
|
COPY frontend/ ./
|
|
13
|
+
COPY .oon-delivery/app-manifest/ /src/
|
|
13
14
|
ARG VITE_API_URL=/api
|
|
14
15
|
ENV VITE_API_URL=$VITE_API_URL
|
|
15
16
|
RUN npm run build
|
|
@@ -25,6 +26,7 @@ RUN apk add --no-cache nginx curl
|
|
|
25
26
|
WORKDIR /app
|
|
26
27
|
ENV NODE_ENV=production
|
|
27
28
|
COPY --from=backend /app/backend /app/backend
|
|
29
|
+
COPY .oon-delivery/app-manifest/ /app/
|
|
28
30
|
COPY --from=frontend /src/frontend/dist /usr/share/nginx/html
|
|
29
31
|
COPY .oon-delivery/nginx.conf /etc/nginx/http.d/default.conf
|
|
30
32
|
COPY .oon-delivery/entrypoint.sh /entrypoint.sh
|
|
@@ -60,9 +62,25 @@ trap 'kill $backend_pid 2>/dev/null || true' TERM INT EXIT
|
|
|
60
62
|
exec nginx -g 'daemon off;'
|
|
61
63
|
`;
|
|
62
64
|
|
|
65
|
+
function prepareAppManifest(workspace, deliveryDirectory) {
|
|
66
|
+
const manifestDirectory = path.join(deliveryDirectory, "app-manifest");
|
|
67
|
+
const manifestSource = path.join(workspace, "central.app.json");
|
|
68
|
+
const manifestTarget = path.join(manifestDirectory, "central.app.json");
|
|
69
|
+
|
|
70
|
+
fs.rmSync(manifestDirectory, { recursive: true, force: true });
|
|
71
|
+
fs.mkdirSync(manifestDirectory, { recursive: true });
|
|
72
|
+
|
|
73
|
+
if (fs.existsSync(manifestSource)) {
|
|
74
|
+
fs.copyFileSync(manifestSource, manifestTarget);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return manifestTarget;
|
|
78
|
+
}
|
|
79
|
+
|
|
63
80
|
function prepareDeliveryFiles(workspace) {
|
|
64
81
|
const target = path.join(workspace, ".oon-delivery");
|
|
65
82
|
fs.mkdirSync(target, { recursive: true });
|
|
83
|
+
prepareAppManifest(workspace, target);
|
|
66
84
|
fs.writeFileSync(path.join(target, "Dockerfile"), DOCKERFILE);
|
|
67
85
|
fs.writeFileSync(path.join(target, "nginx.conf"), NGINX);
|
|
68
86
|
fs.writeFileSync(path.join(target, "entrypoint.sh"), ENTRYPOINT, {
|
|
@@ -82,6 +100,7 @@ module.exports = {
|
|
|
82
100
|
DOCKERFILE,
|
|
83
101
|
NGINX,
|
|
84
102
|
ENTRYPOINT,
|
|
103
|
+
prepareAppManifest,
|
|
85
104
|
prepareDeliveryFiles,
|
|
86
105
|
buildImage,
|
|
87
106
|
};
|