create-subur-app 0.0.0-stage → 0.1.0
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/LICENSE +22 -0
- package/README.md +62 -2
- package/bin/create-subur-app.js +10 -0
- package/dist/args.js +70 -0
- package/dist/bootstrap.js +22 -0
- package/dist/cli.js +52 -0
- package/dist/create.js +173 -0
- package/dist/render.js +10 -0
- package/dist/update.js +17 -0
- package/package.json +35 -3
- package/scaffold/DESIGN.md +17 -0
- package/scaffold/PRODUCT.md +21 -0
- package/scaffold/README.md +48 -0
- package/scaffold/docs/client/README.md +1 -0
- package/scaffold/next.config.ts +4 -0
- package/scaffold/public/site/hero/film-m.mp4 +0 -0
- package/scaffold/public/site/hero/film.mp4 +0 -0
- package/scaffold/public/site/hero/poster-1.webp +0 -0
- package/scaffold/public/site/hero/poster-2.webp +0 -0
- package/scaffold/public/site/hero/poster-3.webp +0 -0
- package/scaffold/public/site/hero/poster-4.webp +0 -0
- package/scaffold/public/site/logo-lockup.webp +0 -0
- package/scaffold/public/site/logo-mark.svg +1 -0
- package/scaffold/public/site/og-default.webp +0 -0
- package/scaffold/src/app/(subur)/custom.scss +1 -0
- package/scaffold/src/site/fonts.ts +6 -0
- package/scaffold/src/site/seed/content/ca.ts +132 -0
- package/scaffold/src/site/seed/content/en.ts +134 -0
- package/scaffold/src/site/seed/content/es.ts +134 -0
- package/scaffold/src/site/seed/content/index.ts +10 -0
- package/scaffold/src/site/seed/media/hero-bath.webp +0 -0
- package/scaffold/src/site/seed/media/hero-done.webp +0 -0
- package/scaffold/src/site/seed/media/hero-kitchen.webp +0 -0
- package/scaffold/src/site/seed/media/hero-workshop.webp +0 -0
- package/scaffold/src/site/seed/media/page-contact.webp +0 -0
- package/scaffold/src/site/seed/media/page-services.webp +0 -0
- package/scaffold/src/site/seed/media/service-bath.webp +0 -0
- package/scaffold/src/site/seed/media/service-kitchen.webp +0 -0
- package/scaffold/src/site/seed/media/service-repairs.webp +0 -0
- package/scaffold/src/site/seed/media.ts +23 -0
- package/scaffold/src/site/site.config.ts +28 -0
- package/scaffold/src/site/theme.css +74 -0
- package/scaffold/vendor/README.md +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Subur
|
|
4
|
+
Copyright (c) 2018-2025 Payload CMS, Inc. <info@payloadcms.com>
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# create-subur-app
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Crea el repositori d'un client de Subur sobre [`@suburlabs/core`](https://www.npmjs.com/package/@suburlabs/core). Es publica
|
|
4
|
+
amb llicència MIT (vegeu `LICENSE`); el codi viu a [suburlabs/subur-core](https://github.com/suburlabs/subur-core). Cal Node 24,
|
|
5
|
+
`pnpm` i `git` al `PATH` (i, amb `--repo`, `gh` amb una sessió activa: `gh auth login`).
|
|
6
|
+
|
|
7
|
+
## Crear
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx create-subur-app <dir> --slug <id> --domain <domini> --locale ca|es --name "<nom>"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Pas a pas, dins de `<dir>` (buit o inexistent):
|
|
14
|
+
|
|
15
|
+
1. `git init` (el directori és l'arrel del seu repositori).
|
|
16
|
+
2. Instal·la `@suburlabs/core` a la mateixa versió que la CLI (o el *tarball* de `--core-tarball`, copiat a `vendor/`).
|
|
17
|
+
3. Escriu les plantilles del nucli instal·lat i la bastida de la web: `src/site/` (configuració, tema, fonts i contingut de
|
|
18
|
+
mostra), `public/site/`, `next.config.ts`, `README.md`, `DESIGN.md`, `PRODUCT.md` i `docs/client/`. Només la configuració
|
|
19
|
+
i els tres `.md` porten el nom, el domini, l'idioma i l'identificador; la resta es copia tal qual.
|
|
20
|
+
4. Amb `--business <camí>`, escriu `.subur/` des de subur-business (`subur client project`).
|
|
21
|
+
5. `subur sync`, `subur check` i, llevat de `--no-build`, `pnpm build`.
|
|
22
|
+
6. El primer commit. Amb `--repo`, amb l'adreça `noreply` de GitHub de la sessió de `gh` (`<id>+<usuari>@users.noreply.github.com`,
|
|
23
|
+
desada també a la configuració del repositori nou); sense, amb la identitat que git té configurada (si no n'hi ha, o només
|
|
24
|
+
la dona un `includeIf` per al directori nou, que la comprovació no veu, s'atura abans d'escriure res: usa `--repo` o
|
|
25
|
+
`git config --global`).
|
|
26
|
+
7. Amb `--repo suburlabs/<id> --site-url https://<domini>`: crea el repositori privat a GitHub, hi posa les variables
|
|
27
|
+
`SITE_URL` (i, amb `--umami-website-id` i `--umami-script-url`, les d'Umami) abans del primer push, i hi fa el push.
|
|
28
|
+
|
|
29
|
+
Al final llista el que queda a mà:
|
|
30
|
+
|
|
31
|
+
- `.subur/`, si no s'ha passat `--business`: des de subur-business, `subur client project <id> --repo <dir>`.
|
|
32
|
+
- El repositori de GitHub, si no s'ha passat `--repo`: `gh repo create suburlabs/<id> --private` i la variable `SITE_URL`
|
|
33
|
+
(`gh variable set`) abans del primer push.
|
|
34
|
+
- Les variables `UMAMI_WEBSITE_ID` i `UMAMI_SCRIPT_URL` del repositori, si no s'han passat (totes dues o cap).
|
|
35
|
+
- L'alta a la plataforma (`ops alta --repo <dir>`, des de subur-ops).
|
|
36
|
+
- La plantilla del client a subur-business: `subur client set <id> --template subur-core@<versió>`.
|
|
37
|
+
|
|
38
|
+
El CI del client és el seu `.github/workflows/image.yml`, que crida el workflow reutilitzable `client-image.yml` del nucli
|
|
39
|
+
fixat a la mateixa versió que `@suburlabs/core`: Renovate els mou junts i `subur check` exigeix que coincideixin.
|
|
40
|
+
|
|
41
|
+
Opcions:
|
|
42
|
+
|
|
43
|
+
| Opció | |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `--slug <id>` | L'identificador del client: minúscules, xifres i `_`. |
|
|
46
|
+
| `--domain <domini>` | Sense `https://` ni barres. |
|
|
47
|
+
| `--locale ca\|es` | L'idioma del client (i el per defecte de la web). |
|
|
48
|
+
| `--name "<nom>"` | El nom de la web; sense cometes dobles ni barres invertides. |
|
|
49
|
+
| `--repo <propietari/nom>` | El repositori de GitHub; necessita `--site-url`. |
|
|
50
|
+
| `--site-url <https://…>` | La URL pública, sense barra final. |
|
|
51
|
+
| `--umami-website-id`, `--umami-script-url` | Totes dues o cap. |
|
|
52
|
+
| `--business <camí>` | El directori de subur-business, per escriure `.subur/`. |
|
|
53
|
+
| `--core-tarball <fitxer>` | Un `suburlabs-core-x.y.z.tgz` en lloc de la versió del registre. |
|
|
54
|
+
| `--no-build` | Sense el `pnpm build` final. |
|
|
55
|
+
|
|
56
|
+
## Actualitzar
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
npx create-subur-app update [<dir>]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Corre `subur update` del nucli instal·lat al client (per defecte, el directori actual): torna a escriure les plantilles
|
|
63
|
+
del nucli amb la versió instal·lada i en mostra el `diff`, per revisar-lo abans del commit.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const target = new URL('../dist/cli.js', import.meta.url)
|
|
3
|
+
try {
|
|
4
|
+
await import(target.href)
|
|
5
|
+
} catch (error) {
|
|
6
|
+
// Només si el que falta és dist/ mateix: un paquet absent dins de dist també dona ERR_MODULE_NOT_FOUND, sense url.
|
|
7
|
+
if (error?.code !== 'ERR_MODULE_NOT_FOUND' || error.url !== target.href) throw error
|
|
8
|
+
console.error('create-subur-app: falta dist/; construeix el paquet (pnpm build)')
|
|
9
|
+
process.exit(1)
|
|
10
|
+
}
|
package/dist/args.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// core/packages/create-subur-app/src/args.ts — les opcions (spec §4.1)
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { parseArgs } from 'node:util';
|
|
5
|
+
export class CliError extends Error {
|
|
6
|
+
exitCode = 2;
|
|
7
|
+
}
|
|
8
|
+
export const USAGE = `ús:
|
|
9
|
+
create-subur-app <dir> --slug <id> --domain <domini> --locale ca|es --name "<nom>"
|
|
10
|
+
[--repo suburlabs/<id> --site-url <https://…>] [--business <camí a subur-business>]
|
|
11
|
+
[--umami-website-id <id> --umami-script-url <url>] [--core-tarball <suburlabs-core-x.y.z.tgz>] [--no-build]
|
|
12
|
+
create-subur-app update [<dir>]`;
|
|
13
|
+
// Les mateixes regles que `collectFacts` del nucli (src/subur/facts.ts): el client no passaria `subur facts` amb altres valors.
|
|
14
|
+
const SLUG = /^[a-z0-9_]+$/;
|
|
15
|
+
const DOMAIN = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/;
|
|
16
|
+
const REPO = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
|
|
17
|
+
const TARBALL = /^suburlabs-core-(\d+\.\d+\.\d+)\.tgz$/;
|
|
18
|
+
export function parseCreate(argv, ownVersion) {
|
|
19
|
+
const { positionals, values } = parseArgs({
|
|
20
|
+
allowPositionals: true,
|
|
21
|
+
args: argv,
|
|
22
|
+
options: {
|
|
23
|
+
business: { type: 'string' }, 'core-tarball': { type: 'string' }, domain: { type: 'string' }, locale: { type: 'string' }, name: { type: 'string' },
|
|
24
|
+
'no-build': { default: false, type: 'boolean' }, repo: { type: 'string' }, 'site-url': { type: 'string' }, slug: { type: 'string' },
|
|
25
|
+
'umami-script-url': { type: 'string' }, 'umami-website-id': { type: 'string' },
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
if (positionals.length !== 1)
|
|
29
|
+
throw new CliError(USAGE);
|
|
30
|
+
const need = (key) => { const v = values[key]; if (!v)
|
|
31
|
+
throw new CliError(`falta --${key}\n${USAGE}`); return v; };
|
|
32
|
+
const slug = need('slug');
|
|
33
|
+
if (!SLUG.test(slug))
|
|
34
|
+
throw new CliError(`--slug «${slug}»: minúscules, xifres i _`);
|
|
35
|
+
const domain = need('domain');
|
|
36
|
+
if (!DOMAIN.test(domain))
|
|
37
|
+
throw new CliError(`--domain «${domain}»: sense https:// ni barres`);
|
|
38
|
+
const locale = need('locale');
|
|
39
|
+
if (locale !== 'ca' && locale !== 'es')
|
|
40
|
+
throw new CliError('--locale ha de ser ca o es');
|
|
41
|
+
const name = need('name');
|
|
42
|
+
if (/["\\]/.test(name) || [...name].some((c) => c.charCodeAt(0) < 0x20 || c.charCodeAt(0) === 0x7f))
|
|
43
|
+
throw new CliError('--name no pot dur cometes dobles, barres invertides ni caràcters de control');
|
|
44
|
+
const repo = values.repo;
|
|
45
|
+
if (repo !== undefined && !REPO.test(repo))
|
|
46
|
+
throw new CliError(`--repo «${repo}»: propietari/nom`);
|
|
47
|
+
const siteUrl = values['site-url'];
|
|
48
|
+
if (siteUrl !== undefined && !/^https:\/\/[^/\s]+$/.test(siteUrl))
|
|
49
|
+
throw new CliError('--site-url ha de ser https://<domini>, sense barra final');
|
|
50
|
+
if (repo && !siteUrl)
|
|
51
|
+
throw new CliError('--repo necessita --site-url (la variable SITE_URL va abans del primer push)');
|
|
52
|
+
const umamiWebsiteId = values['umami-website-id'];
|
|
53
|
+
const umamiScriptUrl = values['umami-script-url'];
|
|
54
|
+
if ((umamiWebsiteId === undefined) !== (umamiScriptUrl === undefined))
|
|
55
|
+
throw new CliError('--umami-website-id i --umami-script-url, tots dos o cap');
|
|
56
|
+
let coreVersion = ownVersion;
|
|
57
|
+
const coreTarball = values['core-tarball'] === undefined ? undefined : path.resolve(values['core-tarball']);
|
|
58
|
+
if (coreTarball !== undefined) {
|
|
59
|
+
const m = TARBALL.exec(path.basename(coreTarball));
|
|
60
|
+
if (!m)
|
|
61
|
+
throw new CliError(`--core-tarball ha de ser un suburlabs-core-x.y.z.tgz: ${path.basename(coreTarball)}`);
|
|
62
|
+
if (!existsSync(coreTarball))
|
|
63
|
+
throw new CliError(`--core-tarball no existeix: ${coreTarball}`);
|
|
64
|
+
coreVersion = m[1];
|
|
65
|
+
}
|
|
66
|
+
const business = values.business === undefined ? undefined : path.resolve(values.business);
|
|
67
|
+
if (business !== undefined && !existsSync(business))
|
|
68
|
+
throw new CliError(`--business no existeix: ${business}`);
|
|
69
|
+
return { business, coreTarball, coreVersion, dir: path.resolve(positionals[0]), domain, locale, name, noBuild: values['no-build'], repo, siteUrl, slug, umamiScriptUrl, umamiWebsiteId };
|
|
70
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// core/packages/create-subur-app/src/bootstrap.ts — el mínim per instal·lar el nucli abans de tenir les seves plantilles (R2).
|
|
2
|
+
// Els dos fitxers són, byte a byte, templates/client/_npmrc i pnpm-workspace.yaml del nucli (tests/int/parity.int.spec.ts).
|
|
3
|
+
export const NPMRC = `strict-peer-dependencies=false
|
|
4
|
+
enable-pre-post-scripts=true
|
|
5
|
+
# El motor, Next, React, Tailwind, eslint-config-next i graphql són dependències exactes de @suburlabs/core: el client no
|
|
6
|
+
# els declara i aquests patrons els fan resolubles des de l'arrel (bins inclosos). \`subur check\` ho comprova.
|
|
7
|
+
public-hoist-pattern[]=next
|
|
8
|
+
public-hoist-pattern[]=react
|
|
9
|
+
public-hoist-pattern[]=react-dom
|
|
10
|
+
public-hoist-pattern[]=payload
|
|
11
|
+
public-hoist-pattern[]=@payloadcms/*
|
|
12
|
+
public-hoist-pattern[]=tailwindcss
|
|
13
|
+
public-hoist-pattern[]=@tailwindcss/*
|
|
14
|
+
public-hoist-pattern[]=eslint-config-next
|
|
15
|
+
public-hoist-pattern[]=graphql
|
|
16
|
+
`;
|
|
17
|
+
export const WORKSPACE_YAML = `allowBuilds:
|
|
18
|
+
esbuild: true
|
|
19
|
+
sharp: true
|
|
20
|
+
unrs-resolver: true
|
|
21
|
+
`;
|
|
22
|
+
export const bootstrapPackageJson = (slug, coreSpec) => `${JSON.stringify({ name: `subur-${slug}`, private: true, type: 'module', packageManager: 'pnpm@10.33.0', engines: { node: '>=24' }, dependencies: { '@suburlabs/core': coreSpec } }, null, 2)}\n`;
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// core/packages/create-subur-app/src/cli.ts — el punt d'entrada: `create-subur-app <dir> …` i `create-subur-app update [<dir>]`
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { CliError, parseCreate, USAGE } from './args.js';
|
|
6
|
+
import { create, CreateFailed, recoveryHint } from './create.js';
|
|
7
|
+
import { update } from './update.js';
|
|
8
|
+
const PKG = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
9
|
+
const version = JSON.parse(readFileSync(path.join(PKG, 'package.json'), 'utf8')).version;
|
|
10
|
+
const argv = process.argv.slice(2);
|
|
11
|
+
const [first, ...rest] = argv;
|
|
12
|
+
/** Els errors de `parseArgs` (opció desconeguda, valor absent…) són errors d'ús: la línia d'ús, mai una traça. */
|
|
13
|
+
const isParseArgsError = (error) => error instanceof TypeError && /^ERR_PARSE_ARGS_/.test(error.code ?? '');
|
|
14
|
+
try {
|
|
15
|
+
if (first === undefined) {
|
|
16
|
+
console.error(USAGE);
|
|
17
|
+
process.exit(2);
|
|
18
|
+
}
|
|
19
|
+
else if (first === '--help' || first === '-h') {
|
|
20
|
+
console.log(USAGE);
|
|
21
|
+
}
|
|
22
|
+
else if (first === 'update') {
|
|
23
|
+
if (rest[0] === '--help' || rest[0] === '-h')
|
|
24
|
+
console.log(USAGE);
|
|
25
|
+
else if (rest.length > 1)
|
|
26
|
+
throw new CliError(USAGE);
|
|
27
|
+
else
|
|
28
|
+
update(path.resolve(rest[0] ?? '.'));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const created = create(parseCreate(argv, version), console.log);
|
|
32
|
+
console.log(`Fet: ${created.dir} (@suburlabs/core ${created.coreVersion})`);
|
|
33
|
+
console.log('Queda a mà:');
|
|
34
|
+
for (const item of created.pending)
|
|
35
|
+
console.log(` - ${item}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
// A mitges (el directori ja té coses, o el repositori de GitHub ja existeix): el motiu i com sortir-ne; sempre codi 1.
|
|
40
|
+
if (error instanceof CreateFailed) {
|
|
41
|
+
console.error(error.message);
|
|
42
|
+
console.error(recoveryHint(error.stage, error.dir, error.repo));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
if (isParseArgsError(error)) {
|
|
46
|
+
console.error(`${error.message}\n${USAGE}`);
|
|
47
|
+
process.exit(2);
|
|
48
|
+
}
|
|
49
|
+
// CliError: 2 (ús) o el codi que porti; la resta, 1.
|
|
50
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
51
|
+
process.exit(error.exitCode ?? 1);
|
|
52
|
+
}
|
package/dist/create.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// core/packages/create-subur-app/src/create.ts — l'ordre de l'spec §4.1, pas a pas
|
|
2
|
+
import { execFileSync, spawnSync } from 'node:child_process';
|
|
3
|
+
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { CliError } from './args.js';
|
|
8
|
+
import { bootstrapPackageJson, NPMRC, WORKSPACE_YAML } from './bootstrap.js';
|
|
9
|
+
import { clientPathOf, render, RENDERED } from './render.js';
|
|
10
|
+
const SCAFFOLD = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../scaffold');
|
|
11
|
+
const walk = (dir, base = dir) => readdirSync(dir).filter((e) => e !== '.DS_Store').sort().flatMap((e) => (statSync(path.join(dir, e)).isDirectory() ? walk(path.join(dir, e), base) : [path.relative(base, path.join(dir, e))]));
|
|
12
|
+
const run = (cmd, args, cwd, env = process.env) => execFileSync(cmd, args, { cwd, env, stdio: 'inherit' });
|
|
13
|
+
const write = (file, text) => { mkdirSync(path.dirname(file), { recursive: true }); writeFileSync(file, text); };
|
|
14
|
+
const has = (cmd) => spawnSync(cmd, ['--version'], { stdio: 'ignore' }).status === 0;
|
|
15
|
+
// La identitat del commit sense --repo: la configurada, mai endevinada del nom de la màquina (`useConfigOnly`).
|
|
16
|
+
const CONFIG_ONLY = ['-c', 'user.useConfigOnly=true'];
|
|
17
|
+
/** `Nom <correu>` de l'autor i del committer tal com els resoldrà el commit a `cwd`; null si git no en té cap de configurada. */
|
|
18
|
+
function gitIdentity(cwd) {
|
|
19
|
+
const [author, committer] = ['GIT_AUTHOR_IDENT', 'GIT_COMMITTER_IDENT'].map((v) => spawnSync('git', [...CONFIG_ONLY, 'var', v], { cwd, encoding: 'utf8' }));
|
|
20
|
+
if (author.status !== 0 || committer.status !== 0)
|
|
21
|
+
return null;
|
|
22
|
+
const [a, c] = [author, committer].map((r) => r.stdout.trim().replace(/ \d+ [+-]\d{4}$/, ''));
|
|
23
|
+
return a === c ? a : `${a} (committer ${c})`;
|
|
24
|
+
}
|
|
25
|
+
/** La identitat de la sessió de `gh`: l'adreça `noreply` de GitHub (<id>+<login>@users.noreply.github.com), mai el correu del compte. */
|
|
26
|
+
function ghIdentity() {
|
|
27
|
+
const r = spawnSync('gh', ['api', 'user', '--jq', '{id, login, name}'], { encoding: 'utf8' });
|
|
28
|
+
if (r.status !== 0)
|
|
29
|
+
return null;
|
|
30
|
+
try {
|
|
31
|
+
const u = JSON.parse(r.stdout);
|
|
32
|
+
if (typeof u.id !== 'number' || !Number.isInteger(u.id) || u.id <= 0 || typeof u.login !== 'string' || !/^[A-Za-z0-9-]+$/.test(u.login))
|
|
33
|
+
return null;
|
|
34
|
+
const name = typeof u.name === 'string' && u.name.trim() ? u.name.trim() : u.login;
|
|
35
|
+
return { email: `${u.id}+${u.login}@users.noreply.github.com`, name };
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Un error de `create` després d'haver escrit alguna cosa: porta l'etapa perquè la CLI en doni la pista de recuperació. */
|
|
42
|
+
export class CreateFailed extends Error {
|
|
43
|
+
stage;
|
|
44
|
+
dir;
|
|
45
|
+
repo;
|
|
46
|
+
constructor(stage, dir, repo, cause) {
|
|
47
|
+
super(cause instanceof Error ? cause.message : String(cause), { cause });
|
|
48
|
+
this.stage = stage;
|
|
49
|
+
this.dir = dir;
|
|
50
|
+
this.repo = repo;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** La línia que diu com sortir d'una creació a mitges, segons l'etapa. */
|
|
54
|
+
export function recoveryHint(stage, dir, repo) {
|
|
55
|
+
if (stage === 'local')
|
|
56
|
+
return `pista: ${dir} ha quedat a mitges; esborra ${dir} i torna-ho a provar`;
|
|
57
|
+
return `pista: el repositori ${repo} ja existeix a GitHub (no el tornis a crear); posa-hi les variables que faltin (gh variable set … -R ${repo}) i acaba amb git -C ${dir} push -u origin main`;
|
|
58
|
+
}
|
|
59
|
+
export function create(o, log) {
|
|
60
|
+
const progress = { stage: 'preflight' };
|
|
61
|
+
try {
|
|
62
|
+
return steps(o, log, progress);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (progress.stage === 'preflight')
|
|
66
|
+
throw error;
|
|
67
|
+
throw new CreateFailed(progress.stage, o.dir, o.repo, error);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function steps(o, log, progress) {
|
|
71
|
+
const { dir } = o;
|
|
72
|
+
for (const cmd of ['pnpm', 'git', ...(o.repo ? ['gh'] : [])])
|
|
73
|
+
if (!has(cmd))
|
|
74
|
+
throw new CliError(`cal ${cmd} al PATH`);
|
|
75
|
+
// `gh --version` no diu si hi ha sessió: sense aquesta comprovació, la creació fallaria al final, amb tot ja escrit.
|
|
76
|
+
if (o.repo && spawnSync('gh', ['auth', 'status'], { stdio: 'ignore' }).status !== 0)
|
|
77
|
+
throw Object.assign(new CliError('gh no té cap sessió activa (gh auth login): cal per a --repo; no s\'ha escrit res'), { exitCode: 1 });
|
|
78
|
+
// La identitat del commit inicial, abans d'escriure res: amb --repo, la `noreply` de la sessió de `gh` (GitHub rebutja
|
|
79
|
+
// el push d'un commit amb el correu privat del compte, GH007); sense, la que git té configurada (fora de cap repositori).
|
|
80
|
+
const gh = o.repo ? ghIdentity() : null;
|
|
81
|
+
if (o.repo && !gh)
|
|
82
|
+
throw Object.assign(new CliError('no s\'ha pogut llegir la identitat de la sessió de gh (gh api user): cal per al commit inicial amb --repo; no s\'ha escrit res'), { exitCode: 1 });
|
|
83
|
+
if (!o.repo && !gitIdentity(os.tmpdir()))
|
|
84
|
+
throw Object.assign(new CliError('git no té cap identitat configurada (git config --global user.name "…" i user.email "…"; una identitat que només dona un includeIf per al directori nou, la comprovació no la veu: usa --repo o git config --global): cal per al commit inicial; no s\'ha escrit res'), { exitCode: 1 });
|
|
85
|
+
if (existsSync(dir) && (!statSync(dir).isDirectory() || readdirSync(dir).length > 0))
|
|
86
|
+
throw new CliError(`${dir} existeix i no és buit`);
|
|
87
|
+
const vars = { coreVersion: o.coreVersion, domain: o.domain, locale: o.locale, name: o.name, slug: o.slug };
|
|
88
|
+
log(`create-subur-app: ${o.name} (${o.slug}, ${o.domain}, ${o.locale}) a ${dir}`);
|
|
89
|
+
// 1. El repositori, primer: `subur check` exigeix git i el directori ha de ser la SEVA arrel (no la d'un repositori de fora).
|
|
90
|
+
progress.stage = 'local';
|
|
91
|
+
mkdirSync(dir, { recursive: true });
|
|
92
|
+
run('git', ['init', '-q', '-b', 'main'], dir);
|
|
93
|
+
// Amb --repo, la identitat queda a la configuració del clon: els commits següents de qui hi treballi també són `noreply`.
|
|
94
|
+
if (gh)
|
|
95
|
+
for (const [key, value] of [['user.name', gh.name], ['user.email', gh.email]])
|
|
96
|
+
run('git', ['config', key, value], dir);
|
|
97
|
+
const identity = gh ? `${gh.name} <${gh.email}>` : gitIdentity(dir);
|
|
98
|
+
if (!identity)
|
|
99
|
+
throw new Error('git no té cap identitat configurada per a aquest directori: cal per al commit inicial');
|
|
100
|
+
log(`commit inicial amb ${identity}`);
|
|
101
|
+
// 2. El mínim per instal·lar el nucli (R2): package.json, .npmrc (hoisting), pnpm-workspace.yaml (allowBuilds) i, si cal, el tarball.
|
|
102
|
+
let coreSpec = o.coreVersion;
|
|
103
|
+
if (o.coreTarball) {
|
|
104
|
+
mkdirSync(path.join(dir, 'vendor'), { recursive: true });
|
|
105
|
+
copyFileSync(o.coreTarball, path.join(dir, 'vendor', path.basename(o.coreTarball)));
|
|
106
|
+
coreSpec = `file:./vendor/${path.basename(o.coreTarball)}`;
|
|
107
|
+
}
|
|
108
|
+
write(path.join(dir, 'package.json'), bootstrapPackageJson(o.slug, coreSpec));
|
|
109
|
+
write(path.join(dir, '.npmrc'), NPMRC);
|
|
110
|
+
write(path.join(dir, 'pnpm-workspace.yaml'), WORKSPACE_YAML);
|
|
111
|
+
// Mai congelat: amb CI=true pnpm congelaria el lock i la segona instal·lació fallaria (ronda 1, O2).
|
|
112
|
+
run('pnpm', ['install', '--no-frozen-lockfile'], dir);
|
|
113
|
+
// 3. Les plantilles del nucli instal·lat (la font única), renderitzades; en mode tarball, la dependència continua apuntant al tarball.
|
|
114
|
+
const core = path.join(dir, 'node_modules/@suburlabs/core');
|
|
115
|
+
const installed = JSON.parse(readFileSync(path.join(core, 'package.json'), 'utf8')).version;
|
|
116
|
+
if (installed !== o.coreVersion)
|
|
117
|
+
throw new CliError(`s'ha instal·lat @suburlabs/core ${installed}, no ${o.coreVersion}`);
|
|
118
|
+
const templates = path.join(core, 'templates/client');
|
|
119
|
+
for (const rel of walk(templates)) {
|
|
120
|
+
let text = render(readFileSync(path.join(templates, rel), 'utf8'), vars);
|
|
121
|
+
if (rel === 'package.json' && o.coreTarball)
|
|
122
|
+
text = text.replace(`"@suburlabs/core": "${o.coreVersion}"`, `"@suburlabs/core": "${coreSpec}"`);
|
|
123
|
+
write(path.join(dir, clientPathOf(rel)), text);
|
|
124
|
+
}
|
|
125
|
+
// 4. La bastida de la CLI: el contingut que el client fa seu (R2). Només RENDERED es renderitza; la resta, byte a byte (R24).
|
|
126
|
+
for (const rel of walk(SCAFFOLD)) {
|
|
127
|
+
const from = path.join(SCAFFOLD, rel);
|
|
128
|
+
const to = path.join(dir, rel);
|
|
129
|
+
if (RENDERED.includes(rel))
|
|
130
|
+
write(to, render(readFileSync(from, 'utf8'), vars));
|
|
131
|
+
else {
|
|
132
|
+
mkdirSync(path.dirname(to), { recursive: true });
|
|
133
|
+
copyFileSync(from, to);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
run('pnpm', ['install', '--no-frozen-lockfile'], dir); // les devDependencies de la plantilla i el lock definitiu
|
|
137
|
+
// 5. `.subur/` des del registre (spec §4.1 pas 3; R19)
|
|
138
|
+
const pending = [];
|
|
139
|
+
if (o.business)
|
|
140
|
+
run('pnpm', ['-C', o.business, '-s', 'subur', 'client', 'project', o.slug, '--repo', dir], dir);
|
|
141
|
+
else
|
|
142
|
+
pending.push(`.subur/: des de subur-business, pnpm -s subur client project ${o.slug} --repo ${dir}`);
|
|
143
|
+
// 6. Els fitxers del nucli, la comprovació i, si no es demana el contrari, el build en sec (spec §4.1 pas 4)
|
|
144
|
+
run('pnpm', ['-s', 'exec', 'subur', 'sync'], dir);
|
|
145
|
+
run('pnpm', ['-s', 'exec', 'subur', 'check'], dir);
|
|
146
|
+
if (!o.noBuild)
|
|
147
|
+
run('pnpm', ['build'], dir, { ...process.env, DATABASE_URL: 'postgres://build-only:x@127.0.0.1:1/build_only', NEXT_TELEMETRY_DISABLED: '1', SUBUR_SECRET: 'build-only' });
|
|
148
|
+
// 7. El primer commit (spec §4.1 pas 5), amb la identitat de la comprovació prèvia. Amb --repo, per l'entorn: les variables
|
|
149
|
+
// GIT_AUTHOR_*/GIT_COMMITTER_* guanyen a tota configuració (user.*, i també author.*/committer.*, que guanyarien a un
|
|
150
|
+
// `-c user.email`), també a les de l'entorn de qui la crida. Sense --repo, la de git, mai endevinada.
|
|
151
|
+
const commitEnv = gh ? { ...process.env, GIT_AUTHOR_EMAIL: gh.email, GIT_AUTHOR_NAME: gh.name, GIT_COMMITTER_EMAIL: gh.email, GIT_COMMITTER_NAME: gh.name } : process.env;
|
|
152
|
+
run('git', ['add', '-A'], dir);
|
|
153
|
+
run('git', [...(gh ? [] : CONFIG_ONLY), 'commit', '-q', '-m', `feat: web de ${o.name}, creada amb create-subur-app ${o.coreVersion}`], dir, commitEnv);
|
|
154
|
+
// 8. GitHub (spec §4.1 pas 6): el repositori privat, les variables ABANS del primer push, i el push
|
|
155
|
+
if (o.repo) {
|
|
156
|
+
run('gh', ['repo', 'create', o.repo, '--private'], dir);
|
|
157
|
+
progress.stage = 'remote';
|
|
158
|
+
run('git', ['remote', 'add', 'origin', `https://github.com/${o.repo}.git`], dir);
|
|
159
|
+
run('gh', ['variable', 'set', 'SITE_URL', '-R', o.repo, '-b', o.siteUrl], dir);
|
|
160
|
+
if (o.umamiWebsiteId && o.umamiScriptUrl) {
|
|
161
|
+
run('gh', ['variable', 'set', 'UMAMI_WEBSITE_ID', '-R', o.repo, '-b', o.umamiWebsiteId], dir);
|
|
162
|
+
run('gh', ['variable', 'set', 'UMAMI_SCRIPT_URL', '-R', o.repo, '-b', o.umamiScriptUrl], dir);
|
|
163
|
+
}
|
|
164
|
+
run('git', ['push', '-q', '-u', 'origin', 'main'], dir);
|
|
165
|
+
}
|
|
166
|
+
else
|
|
167
|
+
pending.push('repositori a GitHub (gh repo create suburlabs/<id> --private; gh variable set SITE_URL abans del primer push)');
|
|
168
|
+
if (!(o.umamiWebsiteId && o.umamiScriptUrl))
|
|
169
|
+
pending.push('variables UMAMI_WEBSITE_ID i UMAMI_SCRIPT_URL al repositori (totes dues o cap)');
|
|
170
|
+
pending.push('alta a la plataforma: ops alta --repo <aquest directori> des de subur-ops');
|
|
171
|
+
pending.push(`client.template a subur-business: subur client set ${o.slug} --template subur-core@${o.coreVersion}`);
|
|
172
|
+
return { coreVersion: o.coreVersion, dir, pending };
|
|
173
|
+
}
|
package/dist/render.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Les mateixes claus que TEMPLATE_KEYS del nucli (parity.int.spec ho afirma llegint render.ts del nucli com a text). */
|
|
2
|
+
export const KEYS = ['coreVersion', 'domain', 'locale', 'name', 'slug'];
|
|
3
|
+
const VAR = /\{\{([a-zA-Z]+)\}\}/g;
|
|
4
|
+
export function render(text, vars) {
|
|
5
|
+
return text.replace(VAR, (_, key) => { if (!KEYS.includes(key))
|
|
6
|
+
throw new Error(`plantilla: variable desconeguda {{${key}}}`); return vars[key]; });
|
|
7
|
+
}
|
|
8
|
+
export const clientPathOf = (p) => p.split('/').map((s) => (s.startsWith('_') ? `.${s.slice(1)}` : s)).join('/');
|
|
9
|
+
/** Els únics fitxers de la bastida que es renderitzen (ronda 1, C1; el contingut del seed porta `{{nom}}`/`{{email}}` del formulari i NO s'ha de tocar). */
|
|
10
|
+
export const RENDERED = ['src/site/site.config.ts', 'README.md', 'DESIGN.md', 'PRODUCT.md'];
|
package/dist/update.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// core/packages/create-subur-app/src/update.ts — `create-subur-app update [<dir>]`: el `subur update` del nucli instal·lat al client
|
|
2
|
+
import { execFileSync } from 'node:child_process';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { CliError } from './args.js';
|
|
6
|
+
export function update(dir) {
|
|
7
|
+
if (!existsSync(path.join(dir, 'node_modules/@suburlabs/core/bin/subur.js')))
|
|
8
|
+
throw new CliError(`${dir}: no hi ha @suburlabs/core instal·lat (pnpm install)`);
|
|
9
|
+
try {
|
|
10
|
+
execFileSync('pnpm', ['-s', 'exec', 'subur', 'update'], { cwd: dir, stdio: 'inherit' });
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
// El motiu ja és a stderr (stdio heretat): només en queda el codi. Un error d'ús del nucli (2) continua sent-ho.
|
|
14
|
+
const status = error.status;
|
|
15
|
+
throw Object.assign(new Error(`subur update ha fallat (codi ${status ?? '?'})`), { exitCode: status === 2 ? 2 : 1 });
|
|
16
|
+
}
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-subur-app",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Crea el repositori d'un client de Subur sobre @suburlabs/core",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/suburlabs/subur-core.git",
|
|
10
|
+
"directory": "packages/create-subur-app"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=24"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"create-subur-app": "./bin/create-subur-app.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"bin",
|
|
20
|
+
"dist",
|
|
21
|
+
"scaffold",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "22.19.9",
|
|
30
|
+
"typescript": "5.7.3",
|
|
31
|
+
"vitest": "4.0.18"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc -p tsconfig.build.json",
|
|
35
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
36
|
+
"test:int": "pnpm build && vitest run --config ./vitest.config.mts"
|
|
37
|
+
}
|
|
6
38
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Producte — {{name}}
|
|
2
|
+
|
|
3
|
+
## Platform
|
|
4
|
+
|
|
5
|
+
## Users
|
|
6
|
+
|
|
7
|
+
## Product Purpose
|
|
8
|
+
|
|
9
|
+
## Positioning
|
|
10
|
+
|
|
11
|
+
## Operating Context
|
|
12
|
+
|
|
13
|
+
## Capabilities and Constraints
|
|
14
|
+
|
|
15
|
+
## Brand Commitments
|
|
16
|
+
|
|
17
|
+
## Evidence on Hand
|
|
18
|
+
|
|
19
|
+
## Product Principles
|
|
20
|
+
|
|
21
|
+
## Accessibility & Inclusion
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
La web de {{name}} ({{domain}}), feta amb Subur sobre `@suburlabs/core`. Aquest repositori conté només el que és propi
|
|
4
|
+
d'aquesta web; la resta (el panell, les rutes, els blocs, la base de dades) ve del nucli.
|
|
5
|
+
|
|
6
|
+
## Posar-la en marxa
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
cp .env.example .env
|
|
10
|
+
docker compose -f docker-compose.dev.yml up -d
|
|
11
|
+
pnpm install
|
|
12
|
+
pnpm exec subur migrate
|
|
13
|
+
pnpm seed
|
|
14
|
+
pnpm dev
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Què és de la web i què és del nucli
|
|
18
|
+
|
|
19
|
+
De la web (s'editen aquí i es versionen):
|
|
20
|
+
|
|
21
|
+
- `src/site/`: la configuració (`site.config.ts`), el tema (`theme.css`), les fonts i el contingut de mostra (`seed/`).
|
|
22
|
+
- `public/site/`: el logo, el film de la portada i les imatges.
|
|
23
|
+
- `DESIGN.md` i `PRODUCT.md`: el disseny i el producte d'aquesta web.
|
|
24
|
+
- `docs/client/`: guies, textos i decisions.
|
|
25
|
+
- `next.config.ts` i `src/app/(subur)/custom.scss`.
|
|
26
|
+
|
|
27
|
+
Del nucli:
|
|
28
|
+
|
|
29
|
+
- Els fitxers que el `.gitignore` llista sota «Propietat del nucli»: es tornen a generar a cada `pnpm dev` i `pnpm build`
|
|
30
|
+
(`subur sync`) i no es versionen.
|
|
31
|
+
- La resta de fitxers de configuració (`Dockerfile`, `tsconfig.json`, `.npmrc`, `eslint.config.mjs`…) són plantilles
|
|
32
|
+
del nucli: no s'editen a mà.
|
|
33
|
+
|
|
34
|
+
`AGENTS.md` i `CLAUDE.md` els escriu `next dev` i es versionen.
|
|
35
|
+
|
|
36
|
+
## Comprovar
|
|
37
|
+
|
|
38
|
+
`pnpm check` comprova que el repositori segueix el contracte amb el nucli (plantilles, generats, dependències, tema).
|
|
39
|
+
|
|
40
|
+
## Actualitzar
|
|
41
|
+
|
|
42
|
+
Renovate obre les actualitzacions de `@suburlabs/core`. En un salt de versió trencador:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
pnpm install && pnpm exec subur update
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`subur update` reescriu les plantilles del nucli amb la versió instal·lada; revisa el diff abans del commit.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Documents del client: guies, textos, decisions.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="8" fill="#1f5a3d"/><path d="M14 46 L32 18 L50 46 Z" fill="#f4f3ef"/></svg>
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Estils propis del panell d'administració (opcional).
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Source_Sans_3, Source_Serif_4 } from 'next/font/google'
|
|
2
|
+
|
|
3
|
+
const display = Source_Serif_4({ display: 'swap', subsets: ['latin', 'latin-ext'], variable: '--font-display-face' })
|
|
4
|
+
const text = Source_Sans_3({ display: 'swap', subsets: ['latin', 'latin-ext'], variable: '--font-text-face' })
|
|
5
|
+
|
|
6
|
+
export const fontVariables = `${display.variable} ${text.variable}`
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { heading, pageLink, paragraph, richText, type SeedBuild, type SeedLocaleContent, urlLink } from '@suburlabs/core/seed'
|
|
2
|
+
|
|
3
|
+
import type { MediaKey } from '../media'
|
|
4
|
+
import type { PageSlug } from './index'
|
|
5
|
+
|
|
6
|
+
const PHONE = '+34 600 000 000'
|
|
7
|
+
const EMAIL = 'hola@demo.example'
|
|
8
|
+
|
|
9
|
+
export const ca: SeedLocaleContent<PageSlug, MediaKey> = {
|
|
10
|
+
form: {
|
|
11
|
+
confirmationMessage: richText(paragraph('Gràcies. Hem rebut el missatge i us respondrem aviat.')),
|
|
12
|
+
confirmationType: 'message',
|
|
13
|
+
emails: [{ emailTo: EMAIL, message: richText(paragraph('Missatge nou de {{nom}} ({{email}}):'), paragraph('{{missatge}}')), replyTo: '{{email}}', subject: 'Missatge nou des de la web' }],
|
|
14
|
+
fields: [
|
|
15
|
+
{ blockType: 'text', label: 'Nom', name: 'nom', required: true, width: 50 },
|
|
16
|
+
{ blockType: 'email', label: 'Correu', name: 'email', required: true, width: 50 },
|
|
17
|
+
{ blockType: 'textarea', label: 'Missatge', name: 'missatge', required: true, width: 100 },
|
|
18
|
+
{ blockType: 'checkbox', defaultValue: false, label: 'He llegit i accepto la política de privacitat', name: 'privacitat', required: true, width: 100 },
|
|
19
|
+
],
|
|
20
|
+
submitButtonLabel: 'Envia',
|
|
21
|
+
title: 'Contacte',
|
|
22
|
+
},
|
|
23
|
+
build: ({ formId, media, pages }): SeedBuild<PageSlug> => ({
|
|
24
|
+
footer: {
|
|
25
|
+
columns: [{ links: [{ link: pageLink(pages.serveis, 'Serveis') }, { link: pageLink(pages.contacte, 'Contacte') }], title: 'Reformes Exemple' }],
|
|
26
|
+
legalLinks: [{ link: pageLink(pages['avis-legal'], 'Avís legal') }, { link: pageLink(pages.privacitat, 'Privacitat') }, { link: pageLink(pages.cookies, 'Galetes') }],
|
|
27
|
+
tagline: 'Reformes petites i manteniment de la llar. Web de mostra.',
|
|
28
|
+
},
|
|
29
|
+
header: { navItems: [{ link: pageLink(pages.serveis, 'Serveis') }, { link: pageLink(pages.contacte, 'Contacte') }] },
|
|
30
|
+
siteSettings: {
|
|
31
|
+
address: 'Carrer Exemple 1\n00000 Vila Exemple',
|
|
32
|
+
email: EMAIL,
|
|
33
|
+
googleBusinessProfile: null,
|
|
34
|
+
hours: 'De dilluns a divendres, de 9 h a 18 h',
|
|
35
|
+
location: { addressCountry: 'ES', addressLocality: 'Vila Exemple', addressRegion: 'Exemple', areaServed: [{ name: 'Vila Exemple' }, { name: 'Poble Exemple' }], geo: { latitude: 40.0, longitude: 0.0 }, postalCode: '00000', streetAddress: 'Carrer Exemple 1' },
|
|
36
|
+
phone: PHONE,
|
|
37
|
+
// El WhatsApp es deriva del telèfon de la demo (regla de contingut: cap xarxa inventada).
|
|
38
|
+
socials: [{ platform: 'whatsapp', url: 'https://wa.me/34600000000' }],
|
|
39
|
+
},
|
|
40
|
+
pages: {
|
|
41
|
+
home: {
|
|
42
|
+
layout: [
|
|
43
|
+
{
|
|
44
|
+
ariaLabel: 'Animació: quatre composicions abstractes que es transformen.',
|
|
45
|
+
beats: [
|
|
46
|
+
{ body: 'Una web de mostra del nucli de Subur.', heading: 'Reformes petites, ben fetes', image: media.heroWorkshop, label: 'Taller' },
|
|
47
|
+
{ body: 'Cuines, banys i reparacions.', heading: 'Un sol equip per a tota la casa', image: media.heroKitchen, label: 'Cuina' },
|
|
48
|
+
{ body: 'Pressupost tancat abans de començar.', heading: 'Sense sorpreses', image: media.heroBath, label: 'Bany' },
|
|
49
|
+
{ body: 'I la casa neta quan marxem.', heading: 'Feina acabada', image: media.heroDone, label: 'Acabat' },
|
|
50
|
+
],
|
|
51
|
+
blockType: 'scrollHero',
|
|
52
|
+
primaryCta: pageLink(pages.contacte, 'Escriviu-nos'),
|
|
53
|
+
secondaryCta: urlLink('tel:+34600000000', 'Truqueu-nos'),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
blockType: 'servicesGrid',
|
|
57
|
+
heading: 'Serveis',
|
|
58
|
+
items: [
|
|
59
|
+
{ image: media.serviceKitchen, page: pages.serveis, summary: 'Canvi de taulells, aixetes i mobles.', tagline: 'Cuines', title: 'Cuina' },
|
|
60
|
+
{ image: media.serviceBath, page: pages.serveis, summary: 'Plats de dutxa, mampares i rajoles.', tagline: 'Banys', title: 'Bany' },
|
|
61
|
+
{ image: media.serviceRepairs, page: pages.serveis, summary: 'Petites reparacions de la llar.', tagline: 'Manteniment', title: 'Reparacions' },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
{ blockType: 'note', text: 'Tots els serveis es poden contractar per separat.', title: 'Serveis a mida' },
|
|
65
|
+
{
|
|
66
|
+
blockType: 'featureList',
|
|
67
|
+
columns: '4',
|
|
68
|
+
heading: 'Com treballem',
|
|
69
|
+
items: [
|
|
70
|
+
{ icon: 'clipboard-check', moment: 'before', text: 'Visitem la casa i fem un pressupost tancat.', title: 'Visita' },
|
|
71
|
+
{ icon: 'search-check', moment: 'ongoing', text: 'Revisem cada pas abans de continuar.', title: 'Seguiment' },
|
|
72
|
+
{ icon: 'house', moment: 'after', text: 'Deixem la casa neta en acabar.', title: 'Neteja' },
|
|
73
|
+
{ icon: 'package-search', moment: 'during', text: 'Portem el material i el recollim cada dia.', title: 'Material' },
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
{ blockType: 'testimonials', heading: 'Què en diuen', items: [{ author: 'Marta R.', quote: 'Van venir quan van dir i ho van deixar tot net i endreçat.' }, { author: 'Jordi P.', quote: 'El pressupost tancat va ser exactament el que vam acabar pagant.' }, { author: 'Núria S.', quote: 'Ens van canviar el plat de dutxa en dos dies, sense cap sorpresa.' }] },
|
|
77
|
+
{ blockType: 'ctaBand', heading: 'Teniu una reforma pendent?', text: 'Expliqueu-nos-la i us direm què costa.' },
|
|
78
|
+
],
|
|
79
|
+
meta: { description: 'Reformes petites i manteniment de la llar. Web de mostra del nucli de Subur.', title: 'Reformes Exemple' },
|
|
80
|
+
slug: 'home',
|
|
81
|
+
title: 'Inici',
|
|
82
|
+
},
|
|
83
|
+
serveis: {
|
|
84
|
+
layout: [
|
|
85
|
+
{ blockType: 'pageHero', heading: 'Serveis', image: media.pageServices, lead: 'Tot el que fem, amb pressupost tancat.' },
|
|
86
|
+
{ blockType: 'statement', image: media.heroDone, text: 'Feina ben feta, a la primera.', variant: 'quote' },
|
|
87
|
+
{ blockType: 'featureList', columns: '2', items: [{ icon: 'sofa', text: 'Muntatge i reparació de mobles.', title: 'Mobles' }, { icon: 'droplets', text: 'Aixetes, desguassos i silicones.', title: 'Fontaneria' }] },
|
|
88
|
+
{
|
|
89
|
+
blockType: 'taskCatalog',
|
|
90
|
+
groups: [
|
|
91
|
+
{ icon: 'sofa', tasks: [{ text: 'Muntatge de mobles' }, { text: 'Penjar quadres i prestatges' }], title: 'Mobles' },
|
|
92
|
+
{ icon: 'droplets', tasks: [{ text: 'Canvi d’aixetes' }, { text: 'Desembussos sense maquinària' }], title: 'Fontaneria' },
|
|
93
|
+
{ icon: 'door-open', tasks: [{ text: 'Ajust de portes' }, { text: 'Canvi de panys' }], title: 'Portes' },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{ blockType: 'faq', heading: 'Preguntes freqüents', intro: 'El que més ens pregunten.', items: [{ answer: 'Sí, el pressupost és tancat.', question: 'El pressupost pot canviar?' }, { answer: 'Normalment en una setmana.', question: 'Quan podeu venir?' }] },
|
|
97
|
+
{ blockType: 'note', text: 'Assegurança de responsabilitat civil inclosa.', title: 'Assegurança' },
|
|
98
|
+
],
|
|
99
|
+
meta: { description: 'Serveis de Reformes Exemple.', title: 'Serveis | Reformes Exemple' },
|
|
100
|
+
slug: 'serveis',
|
|
101
|
+
title: 'Serveis',
|
|
102
|
+
},
|
|
103
|
+
contacte: {
|
|
104
|
+
layout: [
|
|
105
|
+
{ blockType: 'pageHero', heading: 'Parlem', image: media.pageContact, lead: 'Ompliu el formulari o truqueu-nos.' },
|
|
106
|
+
{ blockType: 'contact', form: formId, heading: 'Envieu-nos un missatge', text: 'De dilluns a divendres, de 9 h a 18 h.' },
|
|
107
|
+
],
|
|
108
|
+
meta: { description: 'Contacte de Reformes Exemple.', title: 'Contacte | Reformes Exemple' },
|
|
109
|
+
slug: 'contacte',
|
|
110
|
+
title: 'Contacte',
|
|
111
|
+
},
|
|
112
|
+
'avis-legal': {
|
|
113
|
+
layout: [{ blockType: 'pageHero', heading: 'Avís legal' }, { blockType: 'richTextSection', content: richText(paragraph('Web de mostra sense titular real.'), heading('h2', 'Contacte'), paragraph(`${EMAIL} · ${PHONE}`)) }],
|
|
114
|
+
meta: { title: 'Avís legal | Reformes Exemple' },
|
|
115
|
+
slug: 'avis-legal',
|
|
116
|
+
title: 'Avís legal',
|
|
117
|
+
},
|
|
118
|
+
privacitat: {
|
|
119
|
+
layout: [{ blockType: 'pageHero', heading: 'Política de privacitat' }, { blockType: 'richTextSection', content: richText(paragraph('Aquesta web de mostra no tracta dades de ningú.')) }],
|
|
120
|
+
meta: { title: 'Privacitat | Reformes Exemple' },
|
|
121
|
+
slug: 'privacitat',
|
|
122
|
+
title: 'Privacitat',
|
|
123
|
+
},
|
|
124
|
+
cookies: {
|
|
125
|
+
layout: [{ blockType: 'pageHero', heading: 'Política de galetes' }, { blockType: 'richTextSection', content: richText(paragraph('Només les galetes tècniques i, amb consentiment, les d’analítica.')) }],
|
|
126
|
+
meta: { title: 'Galetes | Reformes Exemple' },
|
|
127
|
+
slug: 'cookies',
|
|
128
|
+
title: 'Galetes',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
}),
|
|
132
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { heading, pageLink, paragraph, richText, type SeedBuild, type SeedLocaleContent, urlLink } from '@suburlabs/core/seed'
|
|
2
|
+
|
|
3
|
+
import type { MediaKey } from '../media'
|
|
4
|
+
import type { PageSlug } from './index'
|
|
5
|
+
|
|
6
|
+
const PHONE = '+34 600 000 000'
|
|
7
|
+
const EMAIL = 'hola@demo.example'
|
|
8
|
+
|
|
9
|
+
// Mateixa estructura que ca.ts (claus, blocs i slugs); només canvien els textos.
|
|
10
|
+
// Els `name` dels camps del formulari són claus de dades, no text: no es tradueixen.
|
|
11
|
+
export const en: SeedLocaleContent<PageSlug, MediaKey> = {
|
|
12
|
+
form: {
|
|
13
|
+
confirmationMessage: richText(paragraph('Thank you. We have received your message and will reply soon.')),
|
|
14
|
+
confirmationType: 'message',
|
|
15
|
+
emails: [{ emailTo: EMAIL, message: richText(paragraph('New message from {{nom}} ({{email}}):'), paragraph('{{missatge}}')), replyTo: '{{email}}', subject: 'New message from the website' }],
|
|
16
|
+
fields: [
|
|
17
|
+
{ blockType: 'text', label: 'Name', name: 'nom', required: true, width: 50 },
|
|
18
|
+
{ blockType: 'email', label: 'Email', name: 'email', required: true, width: 50 },
|
|
19
|
+
{ blockType: 'textarea', label: 'Message', name: 'missatge', required: true, width: 100 },
|
|
20
|
+
{ blockType: 'checkbox', defaultValue: false, label: 'I have read and accept the privacy policy', name: 'privacitat', required: true, width: 100 },
|
|
21
|
+
],
|
|
22
|
+
submitButtonLabel: 'Send',
|
|
23
|
+
title: 'Contact',
|
|
24
|
+
},
|
|
25
|
+
build: ({ formId, media, pages }): SeedBuild<PageSlug> => ({
|
|
26
|
+
footer: {
|
|
27
|
+
columns: [{ links: [{ link: pageLink(pages.serveis, 'Services') }, { link: pageLink(pages.contacte, 'Contact') }], title: 'Reformes Exemple' }],
|
|
28
|
+
legalLinks: [{ link: pageLink(pages['avis-legal'], 'Legal notice') }, { link: pageLink(pages.privacitat, 'Privacy') }, { link: pageLink(pages.cookies, 'Cookies') }],
|
|
29
|
+
tagline: 'Small renovations and home maintenance. A sample website.',
|
|
30
|
+
},
|
|
31
|
+
header: { navItems: [{ link: pageLink(pages.serveis, 'Services') }, { link: pageLink(pages.contacte, 'Contact') }] },
|
|
32
|
+
siteSettings: {
|
|
33
|
+
address: 'Carrer Exemple 1\n00000 Vila Exemple',
|
|
34
|
+
email: EMAIL,
|
|
35
|
+
googleBusinessProfile: null,
|
|
36
|
+
hours: 'Monday to Friday, 9 am to 6 pm',
|
|
37
|
+
location: { addressCountry: 'ES', addressLocality: 'Vila Exemple', addressRegion: 'Exemple', areaServed: [{ name: 'Vila Exemple' }, { name: 'Poble Exemple' }], geo: { latitude: 40.0, longitude: 0.0 }, postalCode: '00000', streetAddress: 'Carrer Exemple 1' },
|
|
38
|
+
phone: PHONE,
|
|
39
|
+
// El WhatsApp es deriva del telèfon de la demo (regla de contingut: cap xarxa inventada).
|
|
40
|
+
socials: [{ platform: 'whatsapp', url: 'https://wa.me/34600000000' }],
|
|
41
|
+
},
|
|
42
|
+
pages: {
|
|
43
|
+
home: {
|
|
44
|
+
layout: [
|
|
45
|
+
{
|
|
46
|
+
ariaLabel: 'Animation: four abstract compositions that transform into one another.',
|
|
47
|
+
beats: [
|
|
48
|
+
{ body: 'A sample website for the Subur core.', heading: 'Small renovations, done well', image: media.heroWorkshop, label: 'Workshop' },
|
|
49
|
+
{ body: 'Kitchens, bathrooms and repairs.', heading: 'One team for the whole house', image: media.heroKitchen, label: 'Kitchen' },
|
|
50
|
+
{ body: 'A fixed quote before we start.', heading: 'No surprises', image: media.heroBath, label: 'Bathroom' },
|
|
51
|
+
{ body: 'And a clean house when we leave.', heading: 'Job done', image: media.heroDone, label: 'Done' },
|
|
52
|
+
],
|
|
53
|
+
blockType: 'scrollHero',
|
|
54
|
+
primaryCta: pageLink(pages.contacte, 'Write to us'),
|
|
55
|
+
secondaryCta: urlLink('tel:+34600000000', 'Call us'),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
blockType: 'servicesGrid',
|
|
59
|
+
heading: 'Services',
|
|
60
|
+
items: [
|
|
61
|
+
{ image: media.serviceKitchen, page: pages.serveis, summary: 'New worktops, taps and cabinets.', tagline: 'Kitchens', title: 'Kitchen' },
|
|
62
|
+
{ image: media.serviceBath, page: pages.serveis, summary: 'Shower trays, screens and tiles.', tagline: 'Bathrooms', title: 'Bathroom' },
|
|
63
|
+
{ image: media.serviceRepairs, page: pages.serveis, summary: 'Small repairs around the home.', tagline: 'Maintenance', title: 'Repairs' },
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{ blockType: 'note', text: 'Every service can be booked on its own.', title: 'Tailored services' },
|
|
67
|
+
{
|
|
68
|
+
blockType: 'featureList',
|
|
69
|
+
columns: '4',
|
|
70
|
+
heading: 'How we work',
|
|
71
|
+
items: [
|
|
72
|
+
{ icon: 'clipboard-check', moment: 'before', text: 'We visit the house and give you a fixed quote.', title: 'Visit' },
|
|
73
|
+
{ icon: 'search-check', moment: 'ongoing', text: 'We check every step before moving on.', title: 'Follow-up' },
|
|
74
|
+
{ icon: 'house', moment: 'after', text: 'We leave the house clean when we finish.', title: 'Cleaning' },
|
|
75
|
+
{ icon: 'package-search', moment: 'during', text: 'We bring the materials and clear them away every day.', title: 'Materials' },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{ blockType: 'testimonials', heading: 'What clients say', items: [{ author: 'Marta R.', quote: 'They came when they said and left everything clean and tidy.' }, { author: 'Jordi P.', quote: 'The fixed quote was exactly what we ended up paying in the end.' }, { author: 'Núria S.', quote: 'They replaced our shower tray in two days, with no surprises.' }] },
|
|
79
|
+
{ blockType: 'ctaBand', heading: 'Got a renovation on hold?', text: 'Tell us about it and we will tell you what it costs.' },
|
|
80
|
+
],
|
|
81
|
+
meta: { description: 'Small renovations and home maintenance. A sample website for the Subur core.', title: 'Reformes Exemple' },
|
|
82
|
+
slug: 'home',
|
|
83
|
+
title: 'Home',
|
|
84
|
+
},
|
|
85
|
+
serveis: {
|
|
86
|
+
layout: [
|
|
87
|
+
{ blockType: 'pageHero', heading: 'Services', image: media.pageServices, lead: 'Everything we do, with a fixed quote.' },
|
|
88
|
+
{ blockType: 'statement', image: media.heroDone, text: 'Work done well, first time.', variant: 'quote' },
|
|
89
|
+
{ blockType: 'featureList', columns: '2', items: [{ icon: 'sofa', text: 'Furniture assembly and repair.', title: 'Furniture' }, { icon: 'droplets', text: 'Taps, drains and sealant.', title: 'Plumbing' }] },
|
|
90
|
+
{
|
|
91
|
+
blockType: 'taskCatalog',
|
|
92
|
+
groups: [
|
|
93
|
+
{ icon: 'sofa', tasks: [{ text: 'Furniture assembly' }, { text: 'Hanging pictures and shelves' }], title: 'Furniture' },
|
|
94
|
+
{ icon: 'droplets', tasks: [{ text: 'Replacing taps' }, { text: 'Unblocking drains without machinery' }], title: 'Plumbing' },
|
|
95
|
+
{ icon: 'door-open', tasks: [{ text: 'Adjusting doors' }, { text: 'Replacing locks' }], title: 'Doors' },
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{ blockType: 'faq', heading: 'Frequently asked questions', intro: 'What we are asked most often.', items: [{ answer: 'Yes, the quote is fixed.', question: 'Can the quote change?' }, { answer: 'Usually within a week.', question: 'When can you come?' }] },
|
|
99
|
+
{ blockType: 'note', text: 'Public liability insurance included.', title: 'Insurance' },
|
|
100
|
+
],
|
|
101
|
+
meta: { description: 'Services of Reformes Exemple.', title: 'Services | Reformes Exemple' },
|
|
102
|
+
slug: 'serveis',
|
|
103
|
+
title: 'Services',
|
|
104
|
+
},
|
|
105
|
+
contacte: {
|
|
106
|
+
layout: [
|
|
107
|
+
{ blockType: 'pageHero', heading: 'Let’s talk', image: media.pageContact, lead: 'Fill in the form or give us a call.' },
|
|
108
|
+
{ blockType: 'contact', form: formId, heading: 'Send us a message', text: 'Monday to Friday, 9 am to 6 pm.' },
|
|
109
|
+
],
|
|
110
|
+
meta: { description: 'Contact Reformes Exemple.', title: 'Contact | Reformes Exemple' },
|
|
111
|
+
slug: 'contacte',
|
|
112
|
+
title: 'Contact',
|
|
113
|
+
},
|
|
114
|
+
'avis-legal': {
|
|
115
|
+
layout: [{ blockType: 'pageHero', heading: 'Legal notice' }, { blockType: 'richTextSection', content: richText(paragraph('A sample website with no real owner.'), heading('h2', 'Contact'), paragraph(`${EMAIL} · ${PHONE}`)) }],
|
|
116
|
+
meta: { title: 'Legal notice | Reformes Exemple' },
|
|
117
|
+
slug: 'avis-legal',
|
|
118
|
+
title: 'Legal notice',
|
|
119
|
+
},
|
|
120
|
+
privacitat: {
|
|
121
|
+
layout: [{ blockType: 'pageHero', heading: 'Privacy policy' }, { blockType: 'richTextSection', content: richText(paragraph('This sample website processes nobody’s data.')) }],
|
|
122
|
+
meta: { title: 'Privacy | Reformes Exemple' },
|
|
123
|
+
slug: 'privacitat',
|
|
124
|
+
title: 'Privacy',
|
|
125
|
+
},
|
|
126
|
+
cookies: {
|
|
127
|
+
layout: [{ blockType: 'pageHero', heading: 'Cookie policy' }, { blockType: 'richTextSection', content: richText(paragraph('Only technical cookies and, with consent, analytics cookies.')) }],
|
|
128
|
+
meta: { title: 'Cookies | Reformes Exemple' },
|
|
129
|
+
slug: 'cookies',
|
|
130
|
+
title: 'Cookies',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
}),
|
|
134
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { heading, pageLink, paragraph, richText, type SeedBuild, type SeedLocaleContent, urlLink } from '@suburlabs/core/seed'
|
|
2
|
+
|
|
3
|
+
import type { MediaKey } from '../media'
|
|
4
|
+
import type { PageSlug } from './index'
|
|
5
|
+
|
|
6
|
+
const PHONE = '+34 600 000 000'
|
|
7
|
+
const EMAIL = 'hola@demo.example'
|
|
8
|
+
|
|
9
|
+
// Mateixa estructura que ca.ts (claus, blocs i slugs); només canvien els textos.
|
|
10
|
+
// Els `name` dels camps del formulari són claus de dades, no text: no es tradueixen.
|
|
11
|
+
export const es: SeedLocaleContent<PageSlug, MediaKey> = {
|
|
12
|
+
form: {
|
|
13
|
+
confirmationMessage: richText(paragraph('Gracias. Hemos recibido su mensaje y le responderemos pronto.')),
|
|
14
|
+
confirmationType: 'message',
|
|
15
|
+
emails: [{ emailTo: EMAIL, message: richText(paragraph('Nuevo mensaje de {{nom}} ({{email}}):'), paragraph('{{missatge}}')), replyTo: '{{email}}', subject: 'Nuevo mensaje desde la web' }],
|
|
16
|
+
fields: [
|
|
17
|
+
{ blockType: 'text', label: 'Nombre', name: 'nom', required: true, width: 50 },
|
|
18
|
+
{ blockType: 'email', label: 'Correo', name: 'email', required: true, width: 50 },
|
|
19
|
+
{ blockType: 'textarea', label: 'Mensaje', name: 'missatge', required: true, width: 100 },
|
|
20
|
+
{ blockType: 'checkbox', defaultValue: false, label: 'He leído y acepto la política de privacidad', name: 'privacitat', required: true, width: 100 },
|
|
21
|
+
],
|
|
22
|
+
submitButtonLabel: 'Enviar',
|
|
23
|
+
title: 'Contacto',
|
|
24
|
+
},
|
|
25
|
+
build: ({ formId, media, pages }): SeedBuild<PageSlug> => ({
|
|
26
|
+
footer: {
|
|
27
|
+
columns: [{ links: [{ link: pageLink(pages.serveis, 'Servicios') }, { link: pageLink(pages.contacte, 'Contacto') }], title: 'Reformes Exemple' }],
|
|
28
|
+
legalLinks: [{ link: pageLink(pages['avis-legal'], 'Aviso legal') }, { link: pageLink(pages.privacitat, 'Privacidad') }, { link: pageLink(pages.cookies, 'Cookies') }],
|
|
29
|
+
tagline: 'Pequeñas reformas y mantenimiento del hogar. Web de muestra.',
|
|
30
|
+
},
|
|
31
|
+
header: { navItems: [{ link: pageLink(pages.serveis, 'Servicios') }, { link: pageLink(pages.contacte, 'Contacto') }] },
|
|
32
|
+
siteSettings: {
|
|
33
|
+
address: 'Carrer Exemple 1\n00000 Vila Exemple',
|
|
34
|
+
email: EMAIL,
|
|
35
|
+
googleBusinessProfile: null,
|
|
36
|
+
hours: 'De lunes a viernes, de 9 h a 18 h',
|
|
37
|
+
location: { addressCountry: 'ES', addressLocality: 'Vila Exemple', addressRegion: 'Exemple', areaServed: [{ name: 'Vila Exemple' }, { name: 'Poble Exemple' }], geo: { latitude: 40.0, longitude: 0.0 }, postalCode: '00000', streetAddress: 'Carrer Exemple 1' },
|
|
38
|
+
phone: PHONE,
|
|
39
|
+
// El WhatsApp es deriva del telèfon de la demo (regla de contingut: cap xarxa inventada).
|
|
40
|
+
socials: [{ platform: 'whatsapp', url: 'https://wa.me/34600000000' }],
|
|
41
|
+
},
|
|
42
|
+
pages: {
|
|
43
|
+
home: {
|
|
44
|
+
layout: [
|
|
45
|
+
{
|
|
46
|
+
ariaLabel: 'Animación: cuatro composiciones abstractas que se transforman.',
|
|
47
|
+
beats: [
|
|
48
|
+
{ body: 'Una web de muestra del núcleo de Subur.', heading: 'Pequeñas reformas, bien hechas', image: media.heroWorkshop, label: 'Taller' },
|
|
49
|
+
{ body: 'Cocinas, baños y reparaciones.', heading: 'Un solo equipo para toda la casa', image: media.heroKitchen, label: 'Cocina' },
|
|
50
|
+
{ body: 'Presupuesto cerrado antes de empezar.', heading: 'Sin sorpresas', image: media.heroBath, label: 'Baño' },
|
|
51
|
+
{ body: 'Y la casa limpia cuando nos vamos.', heading: 'Trabajo terminado', image: media.heroDone, label: 'Terminado' },
|
|
52
|
+
],
|
|
53
|
+
blockType: 'scrollHero',
|
|
54
|
+
primaryCta: pageLink(pages.contacte, 'Escríbanos'),
|
|
55
|
+
secondaryCta: urlLink('tel:+34600000000', 'Llámenos'),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
blockType: 'servicesGrid',
|
|
59
|
+
heading: 'Servicios',
|
|
60
|
+
items: [
|
|
61
|
+
{ image: media.serviceKitchen, page: pages.serveis, summary: 'Cambio de encimeras, grifos y muebles.', tagline: 'Cocinas', title: 'Cocina' },
|
|
62
|
+
{ image: media.serviceBath, page: pages.serveis, summary: 'Platos de ducha, mamparas y azulejos.', tagline: 'Baños', title: 'Baño' },
|
|
63
|
+
{ image: media.serviceRepairs, page: pages.serveis, summary: 'Pequeñas reparaciones del hogar.', tagline: 'Mantenimiento', title: 'Reparaciones' },
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{ blockType: 'note', text: 'Todos los servicios se pueden contratar por separado.', title: 'Servicios a medida' },
|
|
67
|
+
{
|
|
68
|
+
blockType: 'featureList',
|
|
69
|
+
columns: '4',
|
|
70
|
+
heading: 'Cómo trabajamos',
|
|
71
|
+
items: [
|
|
72
|
+
{ icon: 'clipboard-check', moment: 'before', text: 'Visitamos la casa y hacemos un presupuesto cerrado.', title: 'Visita' },
|
|
73
|
+
{ icon: 'search-check', moment: 'ongoing', text: 'Revisamos cada paso antes de continuar.', title: 'Seguimiento' },
|
|
74
|
+
{ icon: 'house', moment: 'after', text: 'Dejamos la casa limpia al terminar.', title: 'Limpieza' },
|
|
75
|
+
{ icon: 'package-search', moment: 'during', text: 'Traemos el material y lo recogemos cada día.', title: 'Material' },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{ blockType: 'testimonials', heading: 'Qué dicen', items: [{ author: 'Marta R.', quote: 'Vinieron cuando dijeron y lo dejaron todo limpio y ordenado.' }, { author: 'Jordi P.', quote: 'El presupuesto cerrado fue exactamente lo que acabamos pagando.' }, { author: 'Núria S.', quote: 'Nos cambiaron el plato de ducha en dos días, sin ninguna sorpresa.' }] },
|
|
79
|
+
{ blockType: 'ctaBand', heading: '¿Tiene una reforma pendiente?', text: 'Cuéntenosla y le diremos cuánto cuesta.' },
|
|
80
|
+
],
|
|
81
|
+
meta: { description: 'Pequeñas reformas y mantenimiento del hogar. Web de muestra del núcleo de Subur.', title: 'Reformes Exemple' },
|
|
82
|
+
slug: 'home',
|
|
83
|
+
title: 'Inicio',
|
|
84
|
+
},
|
|
85
|
+
serveis: {
|
|
86
|
+
layout: [
|
|
87
|
+
{ blockType: 'pageHero', heading: 'Servicios', image: media.pageServices, lead: 'Todo lo que hacemos, con presupuesto cerrado.' },
|
|
88
|
+
{ blockType: 'statement', image: media.heroDone, text: 'Trabajo bien hecho, a la primera.', variant: 'quote' },
|
|
89
|
+
{ blockType: 'featureList', columns: '2', items: [{ icon: 'sofa', text: 'Montaje y reparación de muebles.', title: 'Muebles' }, { icon: 'droplets', text: 'Grifos, desagües y siliconas.', title: 'Fontanería' }] },
|
|
90
|
+
{
|
|
91
|
+
blockType: 'taskCatalog',
|
|
92
|
+
groups: [
|
|
93
|
+
{ icon: 'sofa', tasks: [{ text: 'Montaje de muebles' }, { text: 'Colgar cuadros y estantes' }], title: 'Muebles' },
|
|
94
|
+
{ icon: 'droplets', tasks: [{ text: 'Cambio de grifos' }, { text: 'Desatascos sin maquinaria' }], title: 'Fontanería' },
|
|
95
|
+
{ icon: 'door-open', tasks: [{ text: 'Ajuste de puertas' }, { text: 'Cambio de cerraduras' }], title: 'Puertas' },
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{ blockType: 'faq', heading: 'Preguntas frecuentes', intro: 'Lo que más nos preguntan.', items: [{ answer: 'Sí, el presupuesto es cerrado.', question: '¿El presupuesto puede cambiar?' }, { answer: 'Normalmente en una semana.', question: '¿Cuándo pueden venir?' }] },
|
|
99
|
+
{ blockType: 'note', text: 'Seguro de responsabilidad civil incluido.', title: 'Seguro' },
|
|
100
|
+
],
|
|
101
|
+
meta: { description: 'Servicios de Reformes Exemple.', title: 'Servicios | Reformes Exemple' },
|
|
102
|
+
slug: 'serveis',
|
|
103
|
+
title: 'Servicios',
|
|
104
|
+
},
|
|
105
|
+
contacte: {
|
|
106
|
+
layout: [
|
|
107
|
+
{ blockType: 'pageHero', heading: 'Hablemos', image: media.pageContact, lead: 'Rellene el formulario o llámenos.' },
|
|
108
|
+
{ blockType: 'contact', form: formId, heading: 'Envíenos un mensaje', text: 'De lunes a viernes, de 9 h a 18 h.' },
|
|
109
|
+
],
|
|
110
|
+
meta: { description: 'Contacto de Reformes Exemple.', title: 'Contacto | Reformes Exemple' },
|
|
111
|
+
slug: 'contacte',
|
|
112
|
+
title: 'Contacto',
|
|
113
|
+
},
|
|
114
|
+
'avis-legal': {
|
|
115
|
+
layout: [{ blockType: 'pageHero', heading: 'Aviso legal' }, { blockType: 'richTextSection', content: richText(paragraph('Web de muestra sin titular real.'), heading('h2', 'Contacto'), paragraph(`${EMAIL} · ${PHONE}`)) }],
|
|
116
|
+
meta: { title: 'Aviso legal | Reformes Exemple' },
|
|
117
|
+
slug: 'avis-legal',
|
|
118
|
+
title: 'Aviso legal',
|
|
119
|
+
},
|
|
120
|
+
privacitat: {
|
|
121
|
+
layout: [{ blockType: 'pageHero', heading: 'Política de privacidad' }, { blockType: 'richTextSection', content: richText(paragraph('Esta web de muestra no trata datos de nadie.')) }],
|
|
122
|
+
meta: { title: 'Privacidad | Reformes Exemple' },
|
|
123
|
+
slug: 'privacitat',
|
|
124
|
+
title: 'Privacidad',
|
|
125
|
+
},
|
|
126
|
+
cookies: {
|
|
127
|
+
layout: [{ blockType: 'pageHero', heading: 'Política de cookies' }, { blockType: 'richTextSection', content: richText(paragraph('Solo las cookies técnicas y, con consentimiento, las de analítica.')) }],
|
|
128
|
+
meta: { title: 'Cookies | Reformes Exemple' },
|
|
129
|
+
slug: 'cookies',
|
|
130
|
+
title: 'Cookies',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
}),
|
|
134
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SeedContent } from '@suburlabs/core/seed'
|
|
2
|
+
|
|
3
|
+
import type { MediaKey } from '../media'
|
|
4
|
+
import { ca } from './ca'
|
|
5
|
+
import { en } from './en'
|
|
6
|
+
import { es } from './es'
|
|
7
|
+
|
|
8
|
+
export const pageSlugs = ['home', 'serveis', 'contacte', 'avis-legal', 'privacitat', 'cookies'] as const
|
|
9
|
+
export type PageSlug = (typeof pageSlugs)[number]
|
|
10
|
+
export const content: SeedContent<PageSlug, MediaKey> = { byLocale: { ca, en, es }, pageSlugs }
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
|
|
4
|
+
import type { SeedMedia } from '@suburlabs/core/seed'
|
|
5
|
+
|
|
6
|
+
export const mediaKeys = ['heroWorkshop', 'heroKitchen', 'heroBath', 'heroDone', 'serviceKitchen', 'serviceBath', 'serviceRepairs', 'pageServices', 'pageContact'] as const
|
|
7
|
+
export type MediaKey = (typeof mediaKeys)[number]
|
|
8
|
+
|
|
9
|
+
const alt = (ca: string, es: string, en: string) => ({ ca, en, es })
|
|
10
|
+
export const media: SeedMedia<MediaKey> = {
|
|
11
|
+
dir: path.join(path.dirname(fileURLToPath(import.meta.url)), 'media'),
|
|
12
|
+
items: {
|
|
13
|
+
heroBath: { alt: alt('Composició abstracta en tons verds', 'Composición abstracta en tonos verdes', 'Abstract composition in green tones'), file: 'hero-bath.webp' },
|
|
14
|
+
heroDone: { alt: alt('Composició abstracta en tons clars', 'Composición abstracta en tonos claros', 'Abstract composition in light tones'), file: 'hero-done.webp' },
|
|
15
|
+
heroKitchen: { alt: alt('Composició abstracta en tons càlids', 'Composición abstracta en tonos cálidos', 'Abstract composition in warm tones'), file: 'hero-kitchen.webp' },
|
|
16
|
+
heroWorkshop: { alt: alt('Composició abstracta en tons foscos', 'Composición abstracta en tonos oscuros', 'Abstract composition in dark tones'), file: 'hero-workshop.webp' },
|
|
17
|
+
pageContact: { alt: alt('Formes geomètriques sobre fons clar', 'Formas geométricas sobre fondo claro', 'Geometric shapes on a light background'), file: 'page-contact.webp' },
|
|
18
|
+
pageServices: { alt: alt('Formes geomètriques sobre fons verd', 'Formas geométricas sobre fondo verde', 'Geometric shapes on a green background'), file: 'page-services.webp' },
|
|
19
|
+
serviceBath: { alt: alt('Rectangle i cercle superposats en blau', 'Rectángulo y círculo superpuestos en azul', 'Overlapping rectangle and circle in blue'), file: 'service-bath.webp' },
|
|
20
|
+
serviceKitchen: { alt: alt('Rectangle i cercle superposats en ocre', 'Rectángulo y círculo superpuestos en ocre', 'Overlapping rectangle and circle in ochre'), file: 'service-kitchen.webp' },
|
|
21
|
+
serviceRepairs: { alt: alt('Rectangle i cercle superposats en gris', 'Rectángulo y círculo superpuestos en gris', 'Overlapping rectangle and circle in grey'), file: 'service-repairs.webp' },
|
|
22
|
+
},
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineSiteConfig } from '@suburlabs/core/site'
|
|
2
|
+
|
|
3
|
+
export const siteConfig = defineSiteConfig({
|
|
4
|
+
assets: {
|
|
5
|
+
favicon: '/site/logo-mark.svg',
|
|
6
|
+
heroFilm: {
|
|
7
|
+
// La durada real del film (194 fotogrames a 24 fps): l'escenari hi mapeja l'scroll. Canvia-la amb el film.
|
|
8
|
+
duration: 8.083333,
|
|
9
|
+
posters: [1, 2, 3, 4].map((n) => ({ height: 720, src: `/site/hero/poster-${n}.webp`, width: 1280 })),
|
|
10
|
+
src: '/site/hero/film.mp4',
|
|
11
|
+
srcMobile: '/site/hero/film-m.mp4',
|
|
12
|
+
},
|
|
13
|
+
logo: '/site/logo-lockup.webp',
|
|
14
|
+
logoMark: '/site/logo-mark.svg',
|
|
15
|
+
logoSize: { height: 160, width: 640 },
|
|
16
|
+
},
|
|
17
|
+
clientLocale: '{{locale}}',
|
|
18
|
+
defaultLocale: '{{locale}}',
|
|
19
|
+
domain: '{{domain}}',
|
|
20
|
+
id: '{{slug}}',
|
|
21
|
+
// Els slugs de les pàgines legals són els del contingut de mostra (src/site/seed/content/index.ts) i no són localitzats:
|
|
22
|
+
// si els canvies, canvia'ls als dos llocs.
|
|
23
|
+
legalSlugs: { cookies: 'cookies', legalNotice: 'avis-legal', privacy: 'privacitat' },
|
|
24
|
+
name: "{{name}}",
|
|
25
|
+
optionalBlocks: { scrollHero: true, taskCatalog: true },
|
|
26
|
+
seo: { schemaType: 'HomeAndConstructionBusiness' },
|
|
27
|
+
themeColor: { dark: '#121a16', light: '#f4f3ef' },
|
|
28
|
+
})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* Tema de la demo: neutre, sense cap color de cap client ni de la marca de Subur. */
|
|
2
|
+
:root {
|
|
3
|
+
--background: #f4f3ef;
|
|
4
|
+
--foreground: #16201b;
|
|
5
|
+
--card: #ffffff;
|
|
6
|
+
--card-foreground: #16201b;
|
|
7
|
+
--popover: #ffffff;
|
|
8
|
+
--popover-foreground: #16201b;
|
|
9
|
+
--primary: #1f5a3d;
|
|
10
|
+
--primary-foreground: #f4f3ef;
|
|
11
|
+
--secondary: #e3e7e1;
|
|
12
|
+
--secondary-foreground: #16201b;
|
|
13
|
+
--muted: #e3e7e1;
|
|
14
|
+
--muted-foreground: #2c4a3a;
|
|
15
|
+
--accent: #e3e7e1;
|
|
16
|
+
--accent-foreground: #2c4a3a;
|
|
17
|
+
--destructive: #b3261e;
|
|
18
|
+
--destructive-foreground: #ffffff;
|
|
19
|
+
--border: #1f5a3d;
|
|
20
|
+
--input: #1f5a3d;
|
|
21
|
+
--ring: #16201b;
|
|
22
|
+
--radius: 0.25rem;
|
|
23
|
+
--brand-strong: #17452f;
|
|
24
|
+
--brand-open: #3f8f68;
|
|
25
|
+
--surface-shade: #e3e7e1;
|
|
26
|
+
--shutter: #1f5a3d;
|
|
27
|
+
--shutter-strong: #17452f;
|
|
28
|
+
--shutter-foreground: #f4f3ef;
|
|
29
|
+
--tile: #ffffff;
|
|
30
|
+
--tile-foreground: #1f5a3d;
|
|
31
|
+
--tile-muted-foreground: #17452f;
|
|
32
|
+
--tile-shade: #e3e7e1;
|
|
33
|
+
--grain: 0.086 0.125 0.106;
|
|
34
|
+
--grain-opacity: 0.04;
|
|
35
|
+
--font-display-stack: var(--font-display-face), Georgia, serif;
|
|
36
|
+
--font-text-stack: var(--font-text-face), ui-sans-serif, system-ui, sans-serif;
|
|
37
|
+
--header-h: 4.5rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dark {
|
|
41
|
+
--background: #121a16;
|
|
42
|
+
--foreground: #eef1ec;
|
|
43
|
+
--card: #1a251f;
|
|
44
|
+
--card-foreground: #eef1ec;
|
|
45
|
+
--popover: #1a251f;
|
|
46
|
+
--popover-foreground: #eef1ec;
|
|
47
|
+
--primary: #8fcfaa;
|
|
48
|
+
--primary-foreground: #121a16;
|
|
49
|
+
--secondary: #24332b;
|
|
50
|
+
--secondary-foreground: #eef1ec;
|
|
51
|
+
--muted: #24332b;
|
|
52
|
+
--muted-foreground: #b5cbbd;
|
|
53
|
+
--accent: #24332b;
|
|
54
|
+
--accent-foreground: #eef1ec;
|
|
55
|
+
--destructive: #f2a19a;
|
|
56
|
+
--destructive-foreground: #121a16;
|
|
57
|
+
--border: #6fae8b;
|
|
58
|
+
--input: #6fae8b;
|
|
59
|
+
--ring: #eef1ec;
|
|
60
|
+
--brand-strong: #b5e0c6;
|
|
61
|
+
--surface-shade: #24332b;
|
|
62
|
+
--shutter: #17452f;
|
|
63
|
+
--shutter-strong: #0f3020;
|
|
64
|
+
--shutter-foreground: #e3ece6;
|
|
65
|
+
--tile: #e9ece7;
|
|
66
|
+
--grain: 0.933 0.945 0.925;
|
|
67
|
+
--grain-opacity: 0.04;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (width >= 64rem) {
|
|
71
|
+
:root {
|
|
72
|
+
--header-h: 5.5rem;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Tarballs locals del nucli (`file:./vendor/*.tgz`): només per a proves fora de npm. Normalment només hi ha aquest fitxer.
|