@rivil-solutions/site-kit 0.1.0 → 0.1.1
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 +21 -0
- package/README.md +45 -33
- package/bin/rivil.mjs +117 -117
- package/blocks/booking/block.json +1 -1
- package/blocks/careers/block.json +1 -1
- package/blocks/events/block.json +1 -1
- package/blocks/newsletter/block.json +1 -1
- package/blocks/reviews/block.json +1 -1
- package/blocks/stay/block.json +1 -1
- package/blocks/ui/block.json +1 -1
- package/package.json +8 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rivil
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @rivil-solutions/site-kit
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
The client for the Rivil site API (`/api/site/v1`), for Astro sites (or any Node server) built on top of Rivil ERP.
|
|
4
|
+
It runs on the server only: the site key never reaches the browser.
|
|
5
5
|
|
|
6
6
|
```ts
|
|
7
7
|
import { createContentApi, createSiteClient } from '@rivil-solutions/site-kit'
|
|
@@ -9,47 +9,55 @@ import { createContentApi, createSiteClient } from '@rivil-solutions/site-kit'
|
|
|
9
9
|
export const rivil = createSiteClient({ url: process.env.ERP_URL!, key: process.env.ERP_SITE_KEY! })
|
|
10
10
|
export const content = createContentApi(rivil)
|
|
11
11
|
|
|
12
|
-
const menus = await content.menus('
|
|
13
|
-
const page = await content.one('page', '
|
|
12
|
+
const menus = await content.menus('en')
|
|
13
|
+
const page = await content.one('page', 'about', 'en')
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
To start a new site, use the starter: [rivil-site-template](https://github.com/iorpaul3/rivil-site-template).
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
- `createContentApi`: modulul Site (setări, meniuri, redirecturi, termeni, intrări, căutare, formulare).
|
|
20
|
-
- `rivilWebhookHandler` / `verifyRivilSignature`: webhook-urile semnate (`X-Rivil-Signature`).
|
|
21
|
-
- `visitorIp` + antetul `X-Rivil-Client-IP`: limitele din ERP se aplică pe vizitator.
|
|
22
|
-
- `createI18n`: limba din prefixul adresei (`/en/...`), `t()`, `lp()`, segmente traduse, linkuri interne cu prefix.
|
|
23
|
-
- `imageAt`, `imageWidths` și `@rivil-solutions/site-kit/astro-image`: pozele din Galerie la lățimea potrivită, fără prelucrare pe server.
|
|
24
|
-
- `sitemapXml`, `robotsTxt`, `matchRedirect`: SEO și redirecturile din ERP.
|
|
25
|
-
- `consentScriptUrl`: bannerul Rivil Consent.
|
|
26
|
-
- `createShopApi`: magazinul (catalog, coș, livrare, checkout, cont de client, carduri cadou, retururi), cu limba în adresă și `purgeChanged` pentru webhook-ul `shop.changed`.
|
|
27
|
-
- `accountProxy` + `AUTH_ROUTES`: contul de client (portal) prin site, cu sesiunea în cookie httpOnly și doar rutele permise.
|
|
18
|
+
## What's inside
|
|
28
19
|
|
|
29
|
-
- `
|
|
30
|
-
- `
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
20
|
+
- `createSiteClient`: requests with the site key. Reads (`get`) are cached in memory (fresh for 60 s, then served stale and refreshed in the background), identical requests are merged, and `purge()` refreshes everything after a webhook. ERP errors come as `RivilApiError` (`status`, `code`, `message`).
|
|
21
|
+
- `createContentApi`: the Site module (settings, menus, redirects, terms, entries, search, forms).
|
|
22
|
+
- `createModulesApi`: public reads of the modules (booking, careers, reviews, events) for server-rendered pages.
|
|
23
|
+
- `siteProxy` + `MODULE_ROUTES`: the browser calls `/api/rivil/<module>/...` on the site, and the site calls the ERP with the key. Only visitor actions get through.
|
|
24
|
+
- `@rivil-solutions/site-kit/web`: what also runs in the browser (`rivilFetch`, `SiteError`, money, days, consents, `bookingPlan`).
|
|
25
|
+
- `@rivil-solutions/site-kit/react`: the logic of the module forms, with no styling (`useBooking`, `useStay`, `useApplication`, `useReview`, `useEventCheckout`).
|
|
26
|
+
- `rivilWebhookHandler` / `verifyRivilSignature`: signed webhooks (`X-Rivil-Signature`).
|
|
27
|
+
- `visitorIp` + the `X-Rivil-Client-IP` header: ERP rate limits apply per visitor, not per site.
|
|
28
|
+
- `createI18n`: the language from the URL prefix (`/en/...`), `t()`, `lp()`, translated segments, prefixed internal links.
|
|
29
|
+
- `imageAt`, `imageWidths` and `@rivil-solutions/site-kit/astro-image`: Gallery images at the right width, with no processing on the server.
|
|
30
|
+
- `sitemapXml`, `robotsTxt`, `matchRedirect`: SEO and the redirects set in the ERP.
|
|
31
|
+
- `consentScriptUrl`: the Rivil Consent banner.
|
|
32
|
+
- `createShopApi`: the shop (catalog, cart, shipping, checkout, customer account, gift cards, returns), with the language in the URL and `purgeChanged` for the `shop.changed` webhook.
|
|
33
|
+
- `accountProxy` + `AUTH_ROUTES`: the customer account (portal) through the site, with the session in an httpOnly cookie and only the allowed routes.
|
|
34
|
+
- The `rivil` CLI: copies module pages and starting themes into a site (see below).
|
|
34
35
|
|
|
35
|
-
##
|
|
36
|
+
## Modules on a site
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
npx rivil list
|
|
40
|
+
npx rivil add booking events
|
|
41
|
+
npx rivil theme cabana
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`rivil add` copies the module's pages and styled components into the site. From then on they belong to the site and can be changed freely. The logic (free slots, holds, validation, submitting) stays in this package and is updated with it. The command also prints the scopes the site key needs and the English URL segments to add to `site.config.ts`.
|
|
45
|
+
|
|
46
|
+
Modules: `booking`, `stay`, `careers`, `reviews`, `events`, `newsletter`. Themes: `aer`, `cabana`, `curte`, `lumen`, `miez`, `solvar`.
|
|
47
|
+
|
|
48
|
+
The components call the site, never the ERP directly, through this route:
|
|
36
49
|
|
|
37
50
|
```ts
|
|
38
51
|
// src/pages/api/rivil/[...path].ts
|
|
39
52
|
import { siteProxy } from '@rivil-solutions/site-kit'
|
|
40
53
|
import { client, siteUrl } from '../../../lib/rivil'
|
|
41
54
|
|
|
42
|
-
// origins:
|
|
55
|
+
// origins: behind a reverse proxy, Astro sees the request on localhost
|
|
43
56
|
const proxy = siteProxy({ client, origins: [siteUrl()] })
|
|
44
57
|
export const ALL = (c) => proxy({ request: c.request, path: c.params.path, clientAddress: c.clientAddress })
|
|
45
58
|
```
|
|
46
59
|
|
|
47
|
-
|
|
48
|
-
npx rivil add booking events
|
|
49
|
-
npx rivil theme cabana
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Magazin
|
|
60
|
+
## Shop
|
|
53
61
|
|
|
54
62
|
```ts
|
|
55
63
|
import { createShopApi, createSiteClient } from '@rivil-solutions/site-kit'
|
|
@@ -57,10 +65,10 @@ import { createShopApi, createSiteClient } from '@rivil-solutions/site-kit'
|
|
|
57
65
|
const client = createSiteClient({ url: process.env.ERP_URL!, key: process.env.SHOP_CHANNEL_KEY!, visitorIp: () => ipStore.getStore() })
|
|
58
66
|
export const shop = createShopApi(client, { lang: () => i18n.lang() })
|
|
59
67
|
|
|
60
|
-
//
|
|
68
|
+
// shop.changed webhook: shop.purgeChanged(event.data.object)
|
|
61
69
|
```
|
|
62
70
|
|
|
63
|
-
##
|
|
71
|
+
## Customer account
|
|
64
72
|
|
|
65
73
|
```ts
|
|
66
74
|
// src/pages/api/account/[...path].ts
|
|
@@ -86,13 +94,17 @@ export const POST = ({ request }) => rivilWebhookHandler(process.env.ERP_WEBHOOK
|
|
|
86
94
|
})(request)
|
|
87
95
|
```
|
|
88
96
|
|
|
89
|
-
##
|
|
97
|
+
## Images in Astro
|
|
90
98
|
|
|
91
99
|
```js
|
|
92
100
|
// astro.config.mjs
|
|
93
101
|
export default defineConfig({ image: { service: { entrypoint: '@rivil-solutions/site-kit/astro-image' } } })
|
|
94
102
|
```
|
|
95
103
|
|
|
96
|
-
##
|
|
104
|
+
## Development
|
|
105
|
+
|
|
106
|
+
`pnpm test`, `pnpm check`, `pnpm build`. Publishing runs the checks first (`prepublishOnly`).
|
|
107
|
+
|
|
108
|
+
## License
|
|
97
109
|
|
|
98
|
-
|
|
110
|
+
MIT
|
package/bin/rivil.mjs
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* `rivil add <
|
|
4
|
-
* `rivil theme <
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'
|
|
8
|
-
import { dirname, join, relative, sep } from 'node:path'
|
|
9
|
-
import { fileURLToPath } from 'node:url'
|
|
10
|
-
|
|
11
|
-
const KIT = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
12
|
-
const BLOCKS = join(KIT, 'blocks')
|
|
13
|
-
const THEMES = join(KIT, 'themes')
|
|
14
|
-
const cwd = process.cwd()
|
|
15
|
-
const args = process.argv.slice(2)
|
|
16
|
-
const flags = new Set(args.filter((a) => a.startsWith('--')))
|
|
17
|
-
const [cmd, ...names] = args.filter((a) => !a.startsWith('--'))
|
|
18
|
-
const force = flags.has('--force')
|
|
19
|
-
const dry = flags.has('--dry-run')
|
|
20
|
-
|
|
21
|
-
const say = (s = '') => process.stdout.write(`${s}\n`)
|
|
22
|
-
const die = (s) => {
|
|
23
|
-
process.stderr.write(`${s}\n`)
|
|
24
|
-
process.exit(1)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const blockNames = () => readdirSync(BLOCKS).filter((n) => existsSync(join(BLOCKS, n, 'block.json'))).sort()
|
|
28
|
-
const meta = (name) => JSON.parse(readFileSync(join(BLOCKS, name, 'block.json'), 'utf8'))
|
|
29
|
-
|
|
30
|
-
function walk(dir) {
|
|
31
|
-
return readdirSync(dir).flatMap((n) => {
|
|
32
|
-
const p = join(dir, n)
|
|
33
|
-
return statSync(p).isDirectory() ? walk(p) : [p]
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
function withRequires(list) {
|
|
39
|
-
const out = []
|
|
40
|
-
const visit = (n) => {
|
|
41
|
-
if (out.includes(n)) return
|
|
42
|
-
if (!blockNames().includes(n)) die(`
|
|
43
|
-
for (const r of meta(n).requires ?? []) visit(r)
|
|
44
|
-
out.push(n)
|
|
45
|
-
}
|
|
46
|
-
list.forEach(visit)
|
|
47
|
-
return out
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function copy(from, to, overwrite = force) {
|
|
51
|
-
const rel = relative(cwd, to).split(sep).join('/')
|
|
52
|
-
const had = existsSync(to)
|
|
53
|
-
if (had && !overwrite) return { rel, state: 'skipped' }
|
|
54
|
-
if (!dry) {
|
|
55
|
-
mkdirSync(dirname(to), { recursive: true })
|
|
56
|
-
writeFileSync(to, readFileSync(from))
|
|
57
|
-
}
|
|
58
|
-
return { rel, state: had ? 'replaced' : 'added' }
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function needProject() {
|
|
62
|
-
if (!existsSync(join(cwd, 'package.json')) || !existsSync(join(cwd, 'src'))) die('
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (!cmd || cmd === 'help' || flags.has('--help')) {
|
|
66
|
-
say(
|
|
67
|
-
say('rivil theme <
|
|
68
|
-
say('rivil list
|
|
69
|
-
process.exit(0)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (cmd === 'list') {
|
|
73
|
-
say('
|
|
74
|
-
for (const n of blockNames()) if (!meta(n).hidden) say(` ${n.padEnd(12)} ${meta(n).title}`)
|
|
75
|
-
say('
|
|
76
|
-
for (const f of readdirSync(THEMES).filter((f) => f.endsWith('.css'))) say(` ${f.replace(/\.css$/, '')}`)
|
|
77
|
-
process.exit(0)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (cmd === 'add') {
|
|
81
|
-
needProject()
|
|
82
|
-
if (!names.length) die('
|
|
83
|
-
const all = withRequires(names)
|
|
84
|
-
const scopes = new Set()
|
|
85
|
-
const pages = []
|
|
86
|
-
const segments = {}
|
|
87
|
-
for (const n of all) {
|
|
88
|
-
const m = meta(n)
|
|
89
|
-
const files = walk(join(BLOCKS, n, 'files'))
|
|
90
|
-
for (const f of files) {
|
|
91
|
-
const r = copy(f, join(cwd, relative(join(BLOCKS, n, 'files'), f)))
|
|
92
|
-
say(`${r.state === 'skipped' ? '
|
|
93
|
-
}
|
|
94
|
-
if (m.scope) scopes.add(m.scope)
|
|
95
|
-
pages.push(...(m.pages ?? []))
|
|
96
|
-
for (const [l, map] of Object.entries(m.segments ?? {})) Object.assign((segments[l] ??= {}), map)
|
|
97
|
-
}
|
|
98
|
-
say()
|
|
99
|
-
if (dry) say('(
|
|
100
|
-
if (scopes.size) say(`
|
|
101
|
-
if (pages.length) say(`
|
|
102
|
-
if (Object.keys(segments).length) say(`
|
|
103
|
-
process.exit(0)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (cmd === 'theme') {
|
|
107
|
-
needProject()
|
|
108
|
-
const name = names[0]
|
|
109
|
-
const file = join(THEMES, `${name}.css`)
|
|
110
|
-
if (!name || !existsSync(file)) die(`
|
|
111
|
-
const to = join(cwd, 'src', 'styles', 'theme.css')
|
|
112
|
-
const blank = existsSync(to) && !readFileSync(to, 'utf8').replace(/\/\*[\s\S]*?\*\//g, '').trim()
|
|
113
|
-
const r = copy(file, to, blank)
|
|
114
|
-
say(r.state === 'skipped' ? 'src/styles/theme.css
|
|
115
|
-
process.exit(0)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
die(`
|
|
2
|
+
/**
|
|
3
|
+
* `rivil add <block...>`: copies a module's pages and components into the site (booking, stay, careers...).
|
|
4
|
+
* `rivil theme <name>`: puts a starting theme in `src/styles/theme.css`.
|
|
5
|
+
* Copied files belong to the site and can be changed freely. An existing file is not overwritten without `--force`.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'
|
|
8
|
+
import { dirname, join, relative, sep } from 'node:path'
|
|
9
|
+
import { fileURLToPath } from 'node:url'
|
|
10
|
+
|
|
11
|
+
const KIT = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
12
|
+
const BLOCKS = join(KIT, 'blocks')
|
|
13
|
+
const THEMES = join(KIT, 'themes')
|
|
14
|
+
const cwd = process.cwd()
|
|
15
|
+
const args = process.argv.slice(2)
|
|
16
|
+
const flags = new Set(args.filter((a) => a.startsWith('--')))
|
|
17
|
+
const [cmd, ...names] = args.filter((a) => !a.startsWith('--'))
|
|
18
|
+
const force = flags.has('--force')
|
|
19
|
+
const dry = flags.has('--dry-run')
|
|
20
|
+
|
|
21
|
+
const say = (s = '') => process.stdout.write(`${s}\n`)
|
|
22
|
+
const die = (s) => {
|
|
23
|
+
process.stderr.write(`${s}\n`)
|
|
24
|
+
process.exit(1)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const blockNames = () => readdirSync(BLOCKS).filter((n) => existsSync(join(BLOCKS, n, 'block.json'))).sort()
|
|
28
|
+
const meta = (name) => JSON.parse(readFileSync(join(BLOCKS, name, 'block.json'), 'utf8'))
|
|
29
|
+
|
|
30
|
+
function walk(dir) {
|
|
31
|
+
return readdirSync(dir).flatMap((n) => {
|
|
32
|
+
const p = join(dir, n)
|
|
33
|
+
return statSync(p).isDirectory() ? walk(p) : [p]
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The requested blocks plus their dependencies, each once, dependencies first. */
|
|
38
|
+
function withRequires(list) {
|
|
39
|
+
const out = []
|
|
40
|
+
const visit = (n) => {
|
|
41
|
+
if (out.includes(n)) return
|
|
42
|
+
if (!blockNames().includes(n)) die(`No block named "${n}". Blocks: ${blockNames().filter((x) => !meta(x).hidden).join(', ')}.`)
|
|
43
|
+
for (const r of meta(n).requires ?? []) visit(r)
|
|
44
|
+
out.push(n)
|
|
45
|
+
}
|
|
46
|
+
list.forEach(visit)
|
|
47
|
+
return out
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function copy(from, to, overwrite = force) {
|
|
51
|
+
const rel = relative(cwd, to).split(sep).join('/')
|
|
52
|
+
const had = existsSync(to)
|
|
53
|
+
if (had && !overwrite) return { rel, state: 'skipped' }
|
|
54
|
+
if (!dry) {
|
|
55
|
+
mkdirSync(dirname(to), { recursive: true })
|
|
56
|
+
writeFileSync(to, readFileSync(from))
|
|
57
|
+
}
|
|
58
|
+
return { rel, state: had ? 'replaced' : 'added' }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function needProject() {
|
|
62
|
+
if (!existsSync(join(cwd, 'package.json')) || !existsSync(join(cwd, 'src'))) die('Run the command in the site folder (the one with package.json and src/).')
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!cmd || cmd === 'help' || flags.has('--help')) {
|
|
66
|
+
say("rivil add <block...> [--force] [--dry-run] adds a module's pages")
|
|
67
|
+
say('rivil theme <name> [--force] puts a starting theme')
|
|
68
|
+
say('rivil list blocks and themes')
|
|
69
|
+
process.exit(0)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (cmd === 'list') {
|
|
73
|
+
say('Blocks:')
|
|
74
|
+
for (const n of blockNames()) if (!meta(n).hidden) say(` ${n.padEnd(12)} ${meta(n).title}`)
|
|
75
|
+
say('Themes:')
|
|
76
|
+
for (const f of readdirSync(THEMES).filter((f) => f.endsWith('.css'))) say(` ${f.replace(/\.css$/, '')}`)
|
|
77
|
+
process.exit(0)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (cmd === 'add') {
|
|
81
|
+
needProject()
|
|
82
|
+
if (!names.length) die('Name a block: rivil add booking. The list: rivil list.')
|
|
83
|
+
const all = withRequires(names)
|
|
84
|
+
const scopes = new Set()
|
|
85
|
+
const pages = []
|
|
86
|
+
const segments = {}
|
|
87
|
+
for (const n of all) {
|
|
88
|
+
const m = meta(n)
|
|
89
|
+
const files = walk(join(BLOCKS, n, 'files'))
|
|
90
|
+
for (const f of files) {
|
|
91
|
+
const r = copy(f, join(cwd, relative(join(BLOCKS, n, 'files'), f)))
|
|
92
|
+
say(`${r.state === 'skipped' ? 'exists ' : r.state === 'replaced' ? 'replaced' : 'added '} ${r.rel}`)
|
|
93
|
+
}
|
|
94
|
+
if (m.scope) scopes.add(m.scope)
|
|
95
|
+
pages.push(...(m.pages ?? []))
|
|
96
|
+
for (const [l, map] of Object.entries(m.segments ?? {})) Object.assign((segments[l] ??= {}), map)
|
|
97
|
+
}
|
|
98
|
+
say()
|
|
99
|
+
if (dry) say('(nothing written: --dry-run)')
|
|
100
|
+
if (scopes.size) say(`The site key needs: ${[...scopes].join(', ')} (ERP, Site, the site's page, Keys).`)
|
|
101
|
+
if (pages.length) say(`New pages: ${pages.join(', ')}. Add them to a menu in ERP, Site, Menus.`)
|
|
102
|
+
if (Object.keys(segments).length) say(`URLs in other languages, in src/site.config.ts under segments: ${JSON.stringify(segments)}`)
|
|
103
|
+
process.exit(0)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (cmd === 'theme') {
|
|
107
|
+
needProject()
|
|
108
|
+
const name = names[0]
|
|
109
|
+
const file = join(THEMES, `${name}.css`)
|
|
110
|
+
if (!name || !existsSync(file)) die(`Themes: ${readdirSync(THEMES).map((f) => f.replace(/\.css$/, '')).join(', ')}.`)
|
|
111
|
+
const to = join(cwd, 'src', 'styles', 'theme.css')
|
|
112
|
+
const blank = existsSync(to) && !readFileSync(to, 'utf8').replace(/\/\*[\s\S]*?\*\//g, '').trim()
|
|
113
|
+
const r = copy(file, to, blank)
|
|
114
|
+
say(r.state === 'skipped' ? 'src/styles/theme.css already exists: --force replaces it.' : `${r.state} ${r.rel}`)
|
|
115
|
+
process.exit(0)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
die(`Unknown command: ${cmd}. See: rivil help`)
|
package/blocks/events/block.json
CHANGED
package/blocks/stay/block.json
CHANGED
package/blocks/ui/block.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "title": "
|
|
1
|
+
{ "title": "Shared form components", "hidden": true }
|
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivil-solutions/site-kit",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Client
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Client for the Rivil site API (/api/site/v1): content, modules, cache cleared by webhook, images, languages, sitemap, blocks for the starter.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/iorpaul3/rivil-site-kit.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/iorpaul3/rivil-site-kit#readme",
|
|
12
|
+
"bugs": "https://github.com/iorpaul3/rivil-site-kit/issues",
|
|
7
13
|
"sideEffects": false,
|
|
8
14
|
"files": [
|
|
9
15
|
"dist",
|