create-znode-plugin 0.1.4 → 0.1.5
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/README.md +6 -5
- package/index.mjs +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,7 +51,8 @@ and you are asked for it.
|
|
|
51
51
|
```
|
|
52
52
|
> npm create znode-plugin@latest my-theme
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Connect your Znode webstore (recommended: npm run dev needs it)
|
|
55
|
+
Webstore folder, the repo root that has tsconfig.base.json (e.g. D:\znode\webstore): D:\znode\my-store
|
|
55
56
|
Store: D:\znode\my-store
|
|
56
57
|
Plugin folder: D:\znode\runtime-plugins-store
|
|
57
58
|
Created My Theme in D:\themes\my-theme
|
|
@@ -68,8 +69,8 @@ Then enable the theme for your stores in the plugin folder's plugins.json, and o
|
|
|
68
69
|
| Step | What you see | What you do |
|
|
69
70
|
| --- | --- | --- |
|
|
70
71
|
| 1. Name | `Project name …` (only when you did not type one) | Type a name such as `my-theme` |
|
|
71
|
-
| 2. **
|
|
72
|
-
| 3. **Plugin folder** | `Plugin folder: …` printed for you, or the question `
|
|
72
|
+
| 2. **Webstore folder** | `Connect your Znode webstore (recommended …)` then `Webstore folder, the repo root that has tsconfig.base.json (e.g. …):` | Type or paste the **store repo folder** (the one with `tsconfig.base.json`), then Enter |
|
|
73
|
+
| 3. **Plugin folder** | `Plugin folder: …` printed for you, or the question `Plugin folder the webstore loads themes from (its RUNTIME_PLUGINS_DIR, the folder with plugins.json):` | Nothing when it is printed. When asked: the folder the store's `RUNTIME_PLUGINS_DIR` points to |
|
|
73
74
|
| 4. Files | `Created My Theme in …` | Nothing: the starter theme is copied and named |
|
|
74
75
|
| 5. Install | `Installing dependencies…` | Nothing: `npm install` runs (`znode-plugin`, React and Next.js types) |
|
|
75
76
|
| 6. Link | `linked … (69 store aliases)` | Nothing: the project now sees the store's real components and types |
|
|
@@ -81,9 +82,9 @@ Then enable the theme for your stores in the plugin folder's plugins.json, and o
|
|
|
81
82
|
the plugin folder.
|
|
82
83
|
- **Why:** the project gets the store's real types, so imports such as `@znode/base-components/...` are checked against
|
|
83
84
|
the store's own code while you write your theme.
|
|
84
|
-
- **A wrong folder** is not accepted: you see `… has no tsconfig.base.json
|
|
85
|
+
- **A wrong folder** is not accepted: you see `… has no tsconfig.base.json. Enter the webstore repo's root folder (or leave empty to skip).` and the question again.
|
|
85
86
|
- **A default answer:** set `ZNODE_STORE_DIR` in your environment and it is shown in `[ ]`; press Enter to take it.
|
|
86
|
-
- **Answer it (recommended).**
|
|
87
|
+
- **Answer it (recommended).** An empty answer skips it (you then see `Skipped: npm run dev cannot deploy until you connect it …`): the project is still created, but `npm run dev` cannot
|
|
87
88
|
deploy and store imports are not type-checked until you connect it (`npm run link-store -- <store repo>` and a
|
|
88
89
|
`znode.local.json`).
|
|
89
90
|
|
package/index.mjs
CHANGED
|
@@ -102,19 +102,21 @@ async function main() {
|
|
|
102
102
|
if (options.store && !isStoreRepo(options.store)) fail(`--store ${options.store}: no tsconfig.base.json there (pass the store repo's folder)`);
|
|
103
103
|
if (!options.store && interactive) {
|
|
104
104
|
const suggested = process.env.ZNODE_STORE_DIR || "";
|
|
105
|
+
console.log("Connect your Znode webstore (recommended: npm run dev needs it)");
|
|
105
106
|
for (;;) {
|
|
106
|
-
const answer = (await ask(`
|
|
107
|
+
const answer = (await ask(`Webstore folder, the repo root that has tsconfig.base.json${suggested ? ` [${suggested}]` : " (e.g. D:\\znode\\webstore)"}: `)) || suggested;
|
|
107
108
|
if (!answer) break;
|
|
108
109
|
if (isStoreRepo(answer)) {
|
|
109
110
|
options.store = answer;
|
|
110
111
|
break;
|
|
111
112
|
}
|
|
112
|
-
console.log(` ${path.resolve(answer)} has no tsconfig.base.json
|
|
113
|
+
console.log(` ${path.resolve(answer)} has no tsconfig.base.json. Enter the webstore repo's root folder (or leave empty to skip).`);
|
|
113
114
|
}
|
|
115
|
+
if (!options.store) console.log(" Skipped: npm run dev cannot deploy until you connect it (npm run link-store -- <webstore repo>).");
|
|
114
116
|
}
|
|
115
117
|
if (options.store && !options.pluginsDir) options.pluginsDir = storePluginsDir(options.store);
|
|
116
118
|
if (options.store && !options.pluginsDir && interactive) {
|
|
117
|
-
options.pluginsDir = (await ask("
|
|
119
|
+
options.pluginsDir = (await ask("Plugin folder the webstore loads themes from (its RUNTIME_PLUGINS_DIR, the folder with plugins.json): ")) || undefined;
|
|
118
120
|
}
|
|
119
121
|
prompt?.close();
|
|
120
122
|
if (options.store) console.log(`Store: ${path.resolve(options.store)}${options.pluginsDir ? `\nPlugin folder: ${path.resolve(options.pluginsDir)}` : ""}`);
|