create-znode-plugin 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/README.md +24 -3
  2. package/package.json +5 -2
package/README.md CHANGED
@@ -3,6 +3,17 @@
3
3
  Creates a Znode runtime theme project, the way `create-next-app` creates a Next.js app. The project builds on its own
4
4
  and runs inside your Znode store: no fork of the store, no webstore rebuild.
5
5
 
6
+ **In short:** you write a theme in its own folder (its own git repo); `npm run dev` builds it and copies it into the store's
7
+ plugin folder; the running webstore loads it, and you see it with a preview link in your browser only. Examples (colors,
8
+ slots, widgets, settings, pages), versions and every command: [`znode-plugin`](https://www.npmjs.com/package/znode-plugin).
9
+
10
+ ```bash
11
+ npm init znode-plugin@latest my-theme # 1. create (answer the store question)
12
+ cd my-theme
13
+ npm run dev # 2. build + deploy, again on every save
14
+ # 3. open http://localhost:3000/api/extensions/preview?theme=my-theme (webstore running: npx nx dev webstore)
15
+ ```
16
+
6
17
  ## Before you start
7
18
 
8
19
  | You need | Where to find it |
@@ -72,8 +83,9 @@ Then enable the theme for your stores in the plugin folder's plugins.json, and o
72
83
  the store's own code while you write your theme.
73
84
  - **A wrong folder** is not accepted: you see `… has no tsconfig.base.json` and the question again.
74
85
  - **A default answer:** set `ZNODE_STORE_DIR` in your environment and it is shown in `[ ]`; press Enter to take it.
75
- - **Enter on an empty answer skips it.** The project is still created; connect it later with
76
- `npm run link-store -- <store repo>`.
86
+ - **Answer it (recommended).** Enter on an empty answer skips it: the project is still created, but `npm run dev` cannot
87
+ deploy and store imports are not type-checked until you connect it (`npm run link-store -- <store repo>` and a
88
+ `znode.local.json`).
77
89
 
78
90
  ### The plugin folder (step 3)
79
91
 
@@ -106,9 +118,17 @@ Then enable the theme for your stores in the plugin folder's plugins.json, and o
106
118
  http://localhost:3000/api/extensions/preview (back to the store's own theme)
107
119
  ```
108
120
 
109
- 4. To make it live for a store: in the plugin folder's `plugins.json`, set your theme's `"enabled": true` and add the
121
+ 4. Change a file under `src/`, save, wait for `installed theme my-theme@…` in the `npm run dev` window, and **reload the
122
+ page** (the store does not refresh an open page itself).
123
+
124
+ 5. To make it live for a store: in the plugin folder's `plugins.json`, set your theme's `"enabled": true` and add the
110
125
  store codes to `"stores"`.
111
126
 
127
+ **`npm run dev` or `npm run deploy`?** Both build and install. `dev` keeps watching and installs again on every save (use
128
+ it while you work); `deploy` installs once and exits (a fresh machine, after `git pull`, scripts and CI). You do not run
129
+ both. To release a new version, change `"version"` in `znode-package.json` first (see
130
+ [Versions](https://www.npmjs.com/package/znode-plugin#versions)).
131
+
112
132
  | Command | What it does |
113
133
  | --- | --- |
114
134
  | `npm run dev` | Build, deploy to the plugin folder, and again on every save |
@@ -165,4 +185,5 @@ npx create-znode-plugin@latest my-theme --store D:\znode\my-store --plugins-dir
165
185
  | `… exists and is not empty` | Choose another name, or empty that folder |
166
186
  | `needs the store's plugin folder` | Add `znode.local.json` with `{ "pluginsDir": "<the store's RUNTIME_PLUGINS_DIR>" }` |
167
187
  | Preview link returns 404 | The webstore is not in development mode, or the theme is not deployed yet (`npm run dev`) |
188
+ | `installed …` but no change in the store | The theme went to another plugin folder than the running webstore reads: compare `znode.local.json` with the webstore's `RUNTIME_PLUGINS_DIR` (`apps/webstore/.env.local` or `.env`), then reload |
168
189
  | `@znode/...` imports are red in the editor | Run `npm run link-store -- <store repo>` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-znode-plugin",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Create a Znode runtime theme project: npm create znode-plugin@latest <name>.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -21,5 +21,8 @@
21
21
  "theme",
22
22
  "create"
23
23
  ],
24
- "publishConfig": { "registry": "https://registry.npmjs.org/", "access": "public" }
24
+ "publishConfig": {
25
+ "registry": "https://registry.npmjs.org/",
26
+ "access": "public"
27
+ }
25
28
  }