create-foliwake 0.8.0 → 0.10.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/CHANGELOG.md +31 -0
- package/dist/create.js +2 -2
- package/dist/files.js +6 -7
- package/package.json +3 -3
- package/starters/examples/content/blocks.md +1 -0
- package/starters/examples/content/index.md +1 -0
- package/starters/minimal/content/index.md +1 -0
- package/starters/shared/README.md +10 -8
- package/starters/shared/site.yaml +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,37 @@ with them. While the version is 0.x, a minor release may break; breaking changes
|
|
|
5
5
|
|
|
6
6
|
Entries are written from the changesets of each pull request (`.changeset/`, CONTRIBUTING.md), newest first.
|
|
7
7
|
|
|
8
|
+
## 0.10.0
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [339fb47]
|
|
13
|
+
- Updated dependencies [0bb04d6]
|
|
14
|
+
- @foliwake/site-check@0.10.0
|
|
15
|
+
- @foliwake/block-kit@0.10.0
|
|
16
|
+
|
|
17
|
+
## 0.9.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 5a7ffdf: A new project's `foliwake.config.json` is a minimal project file: the site id, `code.root` and the local `content/`
|
|
22
|
+
source, without `storage`, `stateDir` or hosts (the engine defaults them for a local project). It names no
|
|
23
|
+
address and no credential, so `foliwake config trust` is not needed for it.
|
|
24
|
+
|
|
25
|
+
The starter's `site.yaml` no longer sets `authoring: blocks-v3` as the site's default dialect: a site with a Drupal
|
|
26
|
+
or Google Docs source refuses that default (their pages cannot be written in blocks-v3), so every code preparation
|
|
27
|
+
failed once such a source was added. The starter's pages name `authoring: blocks-v3` in their front matter instead.
|
|
28
|
+
|
|
29
|
+
README: branch preview addresses with `--<org>` (`<branch>--<site>--<org>.<branch host domain>`), the open
|
|
30
|
+
`@foliwake/cli` for the server commands (the local preview still needs the engine), `account keys create` with its
|
|
31
|
+
required `--label`, and the repository step as `foliwake connect` / `site create --repository` (a public
|
|
32
|
+
repository needs no code token).
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- @foliwake/block-kit@0.9.0
|
|
37
|
+
- @foliwake/site-check@0.9.0
|
|
38
|
+
|
|
8
39
|
## 0.8.0
|
|
9
40
|
|
|
10
41
|
### Minor Changes
|
package/dist/create.js
CHANGED
|
@@ -217,9 +217,9 @@ export function nextSteps(result) {
|
|
|
217
217
|
const steps = ['Next:'];
|
|
218
218
|
if (result.shown !== '.')
|
|
219
219
|
steps.push(` cd ${shellWord(result.shown)}`);
|
|
220
|
-
steps.push(' npx @foliwake/site-check re-check after every change; the platform runs the same checks', ' Push the repository to GitHub and
|
|
220
|
+
steps.push(' npx @foliwake/site-check re-check after every change; the platform runs the same checks', ' Push the repository to GitHub and link this folder to your site with `foliwake connect` ' +
|
|
221
221
|
'(README.md, "Connect to Foliwake"):', " every branch gets a preview with the site's content; " +
|
|
222
|
-
"a merge to main goes to the site's preview, then Release in the admin.", ' Local preview and page checks need the Foliwake CLI (
|
|
222
|
+
"a merge to main goes to the site's preview, then Release in the admin.", ' Server commands (connect, keys, deploy): npm i -g @foliwake/cli', " Local preview and page checks need the Foliwake engine's CLI (not public yet): foliwake dev --watch");
|
|
223
223
|
if (result.answers?.storybook && !result.answers.install)
|
|
224
224
|
steps.push(' npm install (Storybook; `npm run stories` needs the Foliwake CLI)');
|
|
225
225
|
return steps;
|
package/dist/files.js
CHANGED
|
@@ -39,17 +39,16 @@ function placeholders(input, version, checker) {
|
|
|
39
39
|
function substitute(bytes, values) {
|
|
40
40
|
return Buffer.from(bytes.toString('utf8').replace(/\{\{(\w+)\}\}/g, (all, key) => values[key] ?? all));
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* A minimal project file: the site id, the code and the local content, nothing else. `foliwake dev` and `page check`
|
|
44
|
+
* need no more; the storage, the state folder and the hosts are a server's, and a file without them needs no
|
|
45
|
+
* `foliwake config trust` (it names no address and no credential).
|
|
46
|
+
*/
|
|
42
47
|
function localConfig(id) {
|
|
43
|
-
// `foliwake dev` and `page check` read only the local folders; the storage is named because the configuration
|
|
44
|
-
// format requires it (a local store, used only by `code prepare`).
|
|
45
48
|
const site = {
|
|
46
49
|
id,
|
|
47
|
-
code: { root: '.'
|
|
50
|
+
code: { root: '.' },
|
|
48
51
|
sources: [{ id: 'content', plugin: 'local-markdown', owns: ['/'], settings: { root: './content' } }],
|
|
49
|
-
storage: { endpoint: 'http://127.0.0.1:8333', bucket: `foliwake-${id}` },
|
|
50
|
-
stateDir: './.foliwake',
|
|
51
|
-
liveHosts: [`${id}.localhost`],
|
|
52
|
-
previewBaseHost: `preview.${id}.localhost`,
|
|
53
52
|
};
|
|
54
53
|
return `${JSON.stringify({ version: 1, sites: [site] }, null, 2)}\n`;
|
|
55
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-foliwake",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Create a Foliwake site frontend: npm create foliwake@latest. Blocks, styles, local sample pages, checks and GitHub workflows, checked with @foliwake/site-check before anything is written.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@clack/prompts": "1.8.1",
|
|
55
|
-
"@foliwake/block-kit": "0.
|
|
56
|
-
"@foliwake/site-check": "0.
|
|
55
|
+
"@foliwake/block-kit": "0.10.0",
|
|
56
|
+
"@foliwake/site-check": "0.10.0"
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
59
|
"dist/",
|
|
@@ -6,10 +6,10 @@ The frontend of a Foliwake site: blocks, styles and a few local pages to work wi
|
|
|
6
6
|
components/<name>/ one folder per block: <name>.json (its fields), <name>.css, optionally <name>.js and <name>.example.md
|
|
7
7
|
scripts/components.js the loader: loads each block's CSS and JS on the pages that use it
|
|
8
8
|
styles/styles.css styles of every page
|
|
9
|
-
site.yaml site settings for the engine (
|
|
9
|
+
site.yaml site settings for the engine (no default dialect: each page names its own)
|
|
10
10
|
content/ local Markdown pages to develop against (not published by this repository)
|
|
11
11
|
tests/ quick checks of the vendored scripts and workflows (node --test "tests/*.test.mjs")
|
|
12
|
-
foliwake.config.json
|
|
12
|
+
foliwake.config.json the project for `foliwake dev` and `page check`: the code and content/, nothing else
|
|
13
13
|
.github/ checks, branch previews and production (inert until connected)
|
|
14
14
|
```
|
|
15
15
|
|
|
@@ -30,7 +30,9 @@ node --test "tests/*.test.mjs"
|
|
|
30
30
|
|
|
31
31
|
### With the Foliwake CLI
|
|
32
32
|
|
|
33
|
-
The
|
|
33
|
+
The server commands of the Foliwake CLI are open: `npm i -g @foliwake/cli` (sign-in, sites, code, branches, keys).
|
|
34
|
+
The local preview and the page checks need the Foliwake engine's `foliwake` (the same command with the engine
|
|
35
|
+
added), which is not public yet. Where you have it:
|
|
34
36
|
|
|
35
37
|
```bash
|
|
36
38
|
foliwake dev --watch
|
|
@@ -38,7 +40,7 @@ foliwake dev --watch
|
|
|
38
40
|
|
|
39
41
|
Open http://127.0.0.1:3000/. Edit a page in `content/`, a block or a stylesheet and save: the browser reloads. `dev` uses only local files; no server, store or account is needed. Every block and its examples are on http://127.0.0.1:3000/_dev/blocks: each example rendered with your CSS and JavaScript, its HTML and its problems. Authors see the same examples as a block catalog at `/_foliwake/blocks` on the preview.{{storybookNote}}
|
|
40
42
|
|
|
41
|
-
`foliwake page check` checks every page and block example too. Run it in this folder: the CLI finds `foliwake.config.json` here by itself
|
|
43
|
+
`foliwake page check` checks every page and block example too. Run it in this folder: the CLI finds `foliwake.config.json` here by itself. The file names only the code and `content/`, so it needs no `foliwake config trust`; a file that names storage, credentials or remote addresses does (it decides where credentials are sent).
|
|
42
44
|
|
|
43
45
|
### Add a block
|
|
44
46
|
|
|
@@ -56,7 +58,7 @@ Open http://127.0.0.1:3000/. Edit a page in `content/`, a block or a stylesheet
|
|
|
56
58
|
|
|
57
59
|
Field types: `heading`, `text`, `list`, `choices`, `quote`, `image`.
|
|
58
60
|
2. Add `components/<name>/<name>.css` (and `<name>.js` if it needs JavaScript: its default export is `init(root, host, meta)`, best made with block-kit: `import { defineBlock, html } from '@foliwake/block-kit'` and `defineBlock('<name>', (fields, ctx) => …)`; the page maps that import to the kit of the code release, so nothing is installed. `jsconfig.json` gives your editor the kit's types (`.foliwake/types/foliwake.d.ts`, from `@foliwake/block-kit`, written by create) and, with the Foliwake CLI, of your blocks (`foliwake dev` writes them to `.foliwake/types/blocks/`)). With the Foliwake CLI, `foliwake blocks new <name> --js --example` writes all the files.
|
|
59
|
-
3. Use it in a page:
|
|
61
|
+
3. Use it in a page (a page with blocks names its dialect in its front matter: `authoring: blocks-v3`):
|
|
60
62
|
|
|
61
63
|
```md
|
|
62
64
|
:::tip
|
|
@@ -82,7 +84,7 @@ git add -A && git commit -m "Describe the change"
|
|
|
82
84
|
|
|
83
85
|
With the repository connected to your site (below):
|
|
84
86
|
|
|
85
|
-
- **Push a branch** → the branch preview `https://<branch>--<site>.<branch host domain>/` shows the site's pages with that branch's code. Deleting the branch removes its preview.
|
|
87
|
+
- **Push a branch** → the branch preview `https://<branch>--<site>--<org>.<branch host domain>/` shows the site's pages with that branch's code. Deleting the branch removes its preview.
|
|
86
88
|
- **Merge into `main`** → the checks run, the server prepares a code release from exactly that commit and rebuilds every page with it in the site's **preview**. Live does not change.
|
|
87
89
|
- **Release** → review the preview, then release it in the Foliwake admin: *Frontend → New code → Release*. A rollback is in the same place (or `foliwake release rollback`, by an admin of the site).
|
|
88
90
|
|
|
@@ -91,8 +93,8 @@ With the repository connected to your site (below):
|
|
|
91
93
|
The workflows in `.github/workflows/` do nothing until the repository is connected. The "Frontend checks" workflow runs on every push and pull request from the start; it needs no secrets.
|
|
92
94
|
|
|
93
95
|
1. Push this repository to GitHub.
|
|
94
|
-
2.
|
|
95
|
-
3. Create a CI key of the site: `foliwake account keys create --site <site id> --server <server address
|
|
96
|
+
2. Link this folder to your site: `foliwake connect` (or `foliwake site create <id> --repository <clone URL>`, by an admin of your organisation). The server fetches the commits CI names from the repository over HTTPS: a public one needs nothing more; a private one needs a read token stored on the server, `foliwake credential set <SITE>__CODE_TOKEN --from-stdin`. This gives you the **site id**{{siteIdNote}}.
|
|
97
|
+
3. Create a CI key of the site: `foliwake account keys create --site <site id> --label <pipeline> --server <server address>` (the label says where the key is used, e.g. `github-actions`). It can deploy code and update branch previews of this one site; it cannot publish pages or roll back.
|
|
96
98
|
4. In the GitHub repository settings:
|
|
97
99
|
- **Environments**: `branch-previews` and `production` (deployment branches: `main` only), each with the secret `FOLIWAKE_TOKEN` = the CI key.
|
|
98
100
|
- **Variables**: `FOLIWAKE_SERVER` = the server's address (e.g. `https://foliwake.example.com`); `FOLIWAKE_SITE_ID` = the site id; `BRANCH_PREVIEWS_ENABLED` = `true` to turn on branch previews; `FRONTEND_PRODUCTION_DEPLOY_ENABLED` = `true` to turn on main → preview → live (with the site setting `codeRelease: auto`, the default, a merge to main is released when every page builds without problems; with `manual` it waits for Release in the admin); optionally `FOLIWAKE_PREVIEW_URL` and `FOLIWAKE_PRODUCTION_URL` (shown as links in GitHub).
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
version: 1
|
|
2
|
-
authoring: blocks-v3
|
|
2
|
+
# No `authoring` default: each page names its dialect in its front matter (`authoring: blocks-v3`).
|
|
3
|
+
# A default here would apply to the pages of every content source of the site, and a site with a
|
|
4
|
+
# Drupal or Google Docs source refuses it: their pages cannot be written in blocks-v3.
|