create-foliwake 0.3.0 → 0.5.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 CHANGED
@@ -5,6 +5,53 @@ 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.5.0
9
+
10
+ ### Patch Changes
11
+
12
+ - fa06260: The `homepage` of every package is its page on the public SDK documentation site,
13
+ `https://sdk.foliwake.dev/reference/packages/<name>`. No API change.
14
+ - Updated dependencies [7a50995]
15
+ - Updated dependencies [fa06260]
16
+ - Updated dependencies [702085e]
17
+ - Updated dependencies [405f967]
18
+ - @foliwake/block-kit@0.5.0
19
+ - @foliwake/site-check@0.5.0
20
+
21
+ ## 0.4.0
22
+
23
+ ### Minor Changes
24
+
25
+ - 70af3e5: **BREAKING**: the old forms are removed; only the current ones remain.
26
+
27
+ - The kit's only specifier is `@foliwake/block-kit`. The import map of a code release no longer maps
28
+ `foliwake`; `LEGACY_KIT_SPECIFIER` and `KIT_SPECIFIERS` are removed from `@foliwake/blocks-contract/import-map`
29
+ (use `KIT_SPECIFIER`). `@foliwake/site-check` refuses a bare `foliwake` import, preload hints follow only
30
+ `@foliwake/block-kit`, and new projects map only `@foliwake/block-kit` (jsconfig, Storybook).
31
+ - `@foliwake/block-kit/block-kit-1.js` (the kit of blocks contract 1) is removed, with its `exports` entry;
32
+ `@foliwake/site-check` no longer treats `_foliwake/block-kit-1.js` as an engine file, and the Storybook
33
+ starter no longer aliases relative `_foliwake/` imports.
34
+ - An origin answer without `X-Code-Release` is an error (`FoliwakePageError` `invalid`), not a body shown
35
+ without blocks. `codeRelease` of `PageEnvelope` and `FoliwakePageData` is `CodeReleaseId` (never null),
36
+ and the client error code `NO_CODE_RELEASE` is removed.
37
+ - A `foliwake.remote.json` with any `version` other than 2 is refused with one "unsupported version" error.
38
+
39
+ Added (not breaking): `defineBlock(name, setup, { autoReady: false })` in `@foliwake/block-kit`. The kit then
40
+ sends `ready` only when the block sends it (`ctx.emit('ready', …)`), so a setup that cannot run leaves the root
41
+ without `ready`. The default (`autoReady: true`) is unchanged: after a setup that did not send `ready`, the kit
42
+ sends it.
43
+
44
+ ### Patch Changes
45
+
46
+ - 1cc3743: Documentation: the READMEs name the kit's specifier `@foliwake/block-kit` everywhere, link to sibling
47
+ packages instead of guides that are not public, and say which features need the Foliwake CLI, which is not
48
+ public yet. The `@foliwake/next` README shows how to write the cached read yourself. The starters' loader comment names HTML contract 2. No API change.
49
+ - Updated dependencies [2b0bb9f]
50
+ - Updated dependencies [1cc3743]
51
+ - Updated dependencies [70af3e5]
52
+ - @foliwake/block-kit@0.4.0
53
+ - @foliwake/site-check@0.4.0
54
+
8
55
  ## 0.3.0
9
56
 
10
57
  ### Minor Changes
package/README.md CHANGED
@@ -23,7 +23,7 @@ Storybook's packages, Git). Without a terminal, or with `--no-interactive`, it u
23
23
  | `--template minimal\|examples` | `minimal`: one page, one block; `examples`: two pages, three blocks, one with JavaScript |
24
24
  | `--site <id>` | the site id on your Foliwake server, if you know it (used in the README and local configuration) |
25
25
  | `--react` / `--no-react` | React and ReactDOM vendored in `scripts/vendor/` (shipped with this package; nothing is downloaded) and a React example block |
26
- | `--storybook` / `--no-storybook` | Storybook for the blocks; `npm run stories` needs the Foliwake CLI |
26
+ | `--storybook` / `--no-storybook` | Storybook for the blocks; `npm run stories` needs the Foliwake CLI, which is not public yet |
27
27
  | `--install` / `--no-install` | install the npm packages (only Storybook has any) with the package manager that ran create |
28
28
  | `--git` / `--no-git` | a Git repository (branch `main`) and a first commit with your own Git identity |
29
29
  | `--overwrite` \| `--keep-existing` | the folder is not empty: remove its files (`.git` is kept), or add the project next to them |
@@ -50,9 +50,13 @@ Exit status: `0` created; `1` a step failed (the project stays; what to do is pr
50
50
  Without anything installed: `npx @foliwake/site-check` checks the code (the "Frontend checks" workflow runs it,
51
51
  pinned to the version this package was released with), and `node --test "tests/*.test.mjs"` runs the quick
52
52
  tests. Push the repository to GitHub and connect it to your site in the Foliwake admin: every branch gets a
53
- preview. The Foliwake CLI adds a local preview (`foliwake dev --watch`) and the page checks. For editors, create
54
- writes the types of `foliwake` (from `@foliwake/block-kit`) and the JSON Schema of block definitions into
55
- `.foliwake/` (git-ignored); the types of each block come from the CLI. The project's `README.md` has the details.
53
+ preview. For editors, create writes the types of `@foliwake/block-kit` and the JSON Schema of block definitions
54
+ into `.foliwake/` (git-ignored). The project's `README.md` has the details.
55
+
56
+ The Foliwake CLI is not public yet. Without it you do not get a local preview (`foliwake dev`), the local block
57
+ catalog (`/_dev/blocks`), `npm run stories` (Storybook renders the block examples with the CLI), the page checks
58
+ (`foliwake page check`) or the types of each block's own fields (`.foliwake/types/blocks/`). The branch preview
59
+ on the platform shows pages and block examples instead.
56
60
 
57
61
  ## API
58
62
 
package/dist/create.js CHANGED
@@ -9,7 +9,7 @@
9
9
  // 4. @foliwake/site-check over the planned files (validate.ts);
10
10
  // 5. the files written as one transaction: on any failure nothing of this run stays, and with --overwrite the
11
11
  // original files are put back; then the files for editors (git-ignored: the JSON Schema of block
12
- // definitions, the types of `foliwake`);
12
+ // definitions, the types of `@foliwake/block-kit`);
13
13
  // 6. the npm packages installed, when the project has some (Storybook) and that was asked;
14
14
  // 7. `git init` and the first commit (when asked; never inside another repository, and not when that cannot
15
15
  // be determined).
@@ -2,5 +2,5 @@ export declare const LOCAL_SCHEMA_PATH = ".foliwake/schemas/block-1.schema.json"
2
2
  export declare const KIT_TYPES_PATH = ".foliwake/types/foliwake.d.ts";
3
3
  /** Writes (or refreshes) the JSON Schema of block definitions. */
4
4
  export declare function writeLocalSchema(projectRoot: string): Promise<string>;
5
- /** Writes (or refreshes) the types of the module `foliwake`. */
5
+ /** Writes (or refreshes) the types of the module `@foliwake/block-kit`. */
6
6
  export declare function writeKitTypes(projectRoot: string): Promise<string>;
@@ -1,8 +1,8 @@
1
1
  // Files for editors in a new project, git-ignored and never committed (`foliwake dev` refreshes them):
2
2
  // - `.foliwake/schemas/block-1.schema.json`, named by the `$schema` of each `components/<name>/<name>.json`,
3
3
  // written from @foliwake/site-check, so it is the checker's own rule set;
4
- // - `.foliwake/types/foliwake.d.ts`, the types of the module `foliwake` (jsconfig.json maps the specifier
5
- // there), from @foliwake/block-kit. The types of each block (`.foliwake/types/blocks/`) come from the CLI.
4
+ // - `.foliwake/types/foliwake.d.ts`, the types of the module `@foliwake/block-kit` (jsconfig.json maps the
5
+ // specifier there), from @foliwake/block-kit. The types of each block (`.foliwake/types/blocks/`) come from the CLI.
6
6
  // Nothing is written through a symbolic link.
7
7
  import { lstat, mkdir, readFile, writeFile } from 'node:fs/promises';
8
8
  import path from 'node:path';
@@ -32,7 +32,7 @@ async function writeEditorFile(projectRoot, relative, text) {
32
32
  export function writeLocalSchema(projectRoot) {
33
33
  return writeEditorFile(projectRoot, LOCAL_SCHEMA_PATH, blockSchemaText());
34
34
  }
35
- /** Writes (or refreshes) the types of the module `foliwake`. */
35
+ /** Writes (or refreshes) the types of the module `@foliwake/block-kit`. */
36
36
  export async function writeKitTypes(projectRoot) {
37
37
  const declaration = new URL(import.meta.resolve('@foliwake/block-kit/foliwake.d.ts'));
38
38
  return writeEditorFile(projectRoot, KIT_TYPES_PATH, await readFile(declaration, 'utf8'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-foliwake",
3
- "version": "0.3.0",
3
+ "version": "0.5.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",
@@ -13,7 +13,7 @@
13
13
  "url": "git+https://github.com/foliwake/foliwake-js.git",
14
14
  "directory": "packages/create-foliwake"
15
15
  },
16
- "homepage": "https://docs.foliwake.dev/reference/packages/create-foliwake",
16
+ "homepage": "https://sdk.foliwake.dev/reference/packages/create-foliwake",
17
17
  "bugs": {
18
18
  "url": "https://github.com/foliwake/foliwake-js/issues"
19
19
  },
@@ -52,8 +52,8 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@clack/prompts": "1.8.1",
55
- "@foliwake/block-kit": "0.3.0",
56
- "@foliwake/site-check": "0.3.0"
55
+ "@foliwake/block-kit": "0.5.0",
56
+ "@foliwake/site-check": "0.5.0"
57
57
  },
58
58
  "files": [
59
59
  "dist/",
@@ -24,7 +24,7 @@ A note needs only text; the title is optional.
24
24
  ### Publish a change
25
25
 
26
26
  - Edit a page or a block.
27
- - Check it locally with `foliwake dev`.
27
+ - Check it locally with `npx @foliwake/site-check`.
28
28
  - Push a branch: the branch preview shows it.
29
29
  - Merge into main: the preview is rebuilt, and you release it in the admin.
30
30
 
@@ -41,4 +41,4 @@ The box around this text is the block `note`. Its fields are defined in `compone
41
41
 
42
42
  ## When you're ready
43
43
 
44
- Check the code with `npx @foliwake/site-check`, push the repository to GitHub and connect it to your site in the Foliwake admin: every branch gets a preview. `README.md` has the rest, and the [Quickstart](https://docs.foliwake.dev/guide/quickstart) walks you through it.
44
+ Check the code with `npx @foliwake/site-check`, push the repository to GitHub and connect it to your site in the Foliwake admin: every branch gets a preview. `README.md` has the rest.
@@ -29,4 +29,4 @@ The box around this text is the block `note`. Its fields are defined in `compone
29
29
 
30
30
  ## When you're ready
31
31
 
32
- Check the code with `npx @foliwake/site-check`, push the repository to GitHub and connect it to your site in the Foliwake admin: every branch gets a preview. `README.md` has the rest, and the [Quickstart](https://docs.foliwake.dev/guide/quickstart) walks you through it.
32
+ Check the code with `npx @foliwake/site-check`, push the repository to GitHub and connect it to your site in the Foliwake admin: every branch gets a preview. `README.md` has the rest.
@@ -1,4 +1,4 @@
1
- // A React view for block-kit's ctx.mount (website/guide/write-a-block.md): `reactView(react, Component)`
1
+ // A React view for block-kit's ctx.mount: `reactView(react, Component)`
2
2
  // renders Component with the block's props into the element the kit gives it, with `react` being
3
3
  // {createElement, createRoot}: the shell's (host.react) or the vendored scripts/vendor/react.js.
4
4
  // A render error after the first commit (React 19 onUncaughtError) fails the view: the kit shows the
@@ -30,7 +30,7 @@ node --test "tests/*.test.mjs"
30
30
 
31
31
  ### With the Foliwake CLI
32
32
 
33
- The Foliwake CLI (with the Docker image or Foliwake Cloud) adds a local preview and the page checks:
33
+ The Foliwake CLI is not public yet. Where you have it, it adds a local preview and the page checks:
34
34
 
35
35
  ```bash
36
36
  foliwake dev --watch
@@ -7,8 +7,7 @@
7
7
  "checkJs": false,
8
8
  "noEmit": true,
9
9
  "paths": {
10
- "@foliwake/block-kit": ["./.foliwake/types/foliwake.d.ts"],
11
- "foliwake": ["./.foliwake/types/foliwake.d.ts"]
10
+ "@foliwake/block-kit": ["./.foliwake/types/foliwake.d.ts"]
12
11
  }
13
12
  },
14
13
  "include": ["components/**/*.js", "scripts/**/*.js", "templates/**/*.js", ".foliwake/types/**/*.d.ts"],
@@ -1,4 +1,4 @@
1
- // Component loader (content-components.md §8.3, HTML contract 1).
1
+ // Component loader (HTML contract 2, blocks contract foliwake-blocks/2).
2
2
  //
3
3
  // Finds every [data-component] root, loads only the assets that
4
4
  // components/components.json declares, calls each module's default
@@ -24,22 +24,25 @@ export default {
24
24
  // would shadow the block modules and stylesheets that the stories import.
25
25
  staticDirs: (dirs = [], { configType } = {}) => (configType === 'PRODUCTION' ? [...dirs, { from: '../components', to: '/components' }] : dirs),
26
26
  core: { disableTelemetry: true },
27
- // Blocks import block-kit as `@foliwake/block-kit` (or `foliwake`, its previous name; pages map both to their
28
- // code release's kit), blocks not yet moved to it
29
- // the previous kit as ../../_foliwake/block-kit-1.js; `foliwake blocks render` puts copies into the stories folder.
27
+ // Blocks import block-kit as `@foliwake/block-kit` (pages map it to their code release's kit);
28
+ // `foliwake blocks render` puts a copy of the kit into the stories folder.
30
29
  viteFinal: (config) => ({
31
30
  ...config,
32
31
  resolve: {
33
32
  ...config.resolve,
34
33
  alias: [
35
34
  ...aliases(config.resolve?.alias),
36
- { find: /^(?:@foliwake\/block-kit|foliwake)$/, replacement: fileURLToPath(new URL(`../${STORIES}/_foliwake/block-kit.js`, import.meta.url)) },
37
- { find: /^(?:\.\.\/)+_foliwake\//, replacement: fileURLToPath(new URL(`../${STORIES}/_foliwake/`, import.meta.url)) },
35
+ { find: /^@foliwake\/block-kit$/, replacement: kitCopy() },
38
36
  ],
39
37
  },
40
38
  }),
41
39
  };
42
40
 
41
+ /** The copy of the kit that `foliwake blocks render` puts into the stories folder. */
42
+ function kitCopy() {
43
+ return fileURLToPath(new URL(`../${STORIES}/_foliwake/block-kit.js`, import.meta.url));
44
+ }
45
+
43
46
  function aliases(alias) {
44
47
  if (!alias) return [];
45
48
  return Array.isArray(alias) ? alias : Object.entries(alias).map(([find, replacement]) => ({ find, replacement }));
@@ -6,7 +6,7 @@ const windows = process.platform === 'win32';
6
6
  const first = spawnSync('foliwake', ['blocks', 'render'], { stdio: 'inherit', shell: windows });
7
7
  if (first.error?.code === 'ENOENT') {
8
8
  // A shell alias is invisible here: the command must be on PATH.
9
- console.error('The `foliwake` command was not found on PATH. If it is a shell alias, replace it with `npm link`\nin your Foliwake checkout (see the Quickstart: https://docs.foliwake.dev/guide/quickstart).');
9
+ console.error('The `foliwake` command was not found on PATH. `npm run stories` renders the block examples with\nthe Foliwake CLI, which is not public yet. If you have it as a shell alias, put it on PATH instead (`npm link`).');
10
10
  process.exit(1);
11
11
  }
12
12
  // Status 1: an example has errors (shown above, left out); anything else stops here.