@uniweb/templates 0.1.1 → 0.1.3
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
CHANGED
|
@@ -134,7 +134,7 @@ Binary files (images, fonts, etc.) are copied as-is.
|
|
|
134
134
|
|
|
135
135
|
### Critical: Package Dependencies
|
|
136
136
|
|
|
137
|
-
**The site package MUST include the foundation as a
|
|
137
|
+
**The site package MUST include the foundation as a local dependency:**
|
|
138
138
|
|
|
139
139
|
```json
|
|
140
140
|
// site/package.json.hbs
|
|
@@ -142,20 +142,54 @@ Binary files (images, fonts, etc.) are copied as-is.
|
|
|
142
142
|
"name": "site",
|
|
143
143
|
"dependencies": {
|
|
144
144
|
"@uniweb/runtime": "^0.1.0",
|
|
145
|
-
"foundation": "
|
|
145
|
+
"foundation": "file:../foundation"
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
This `"foundation": "
|
|
151
|
-
1. pnpm
|
|
150
|
+
This `"foundation": "file:../foundation"` entry is essential because:
|
|
151
|
+
1. Both npm and pnpm create a symlink at `site/node_modules/foundation` pointing to the sibling foundation
|
|
152
152
|
2. Vite's `#foundation` alias resolves to the `foundation` module
|
|
153
153
|
3. Without this, the site build will fail with "Could not load foundation"
|
|
154
154
|
|
|
155
|
+
**Important:** Use `file:` protocol, not `workspace:*`. The `workspace:*` protocol is pnpm-specific and will fail with npm.
|
|
156
|
+
|
|
155
157
|
**Use fixed package names:**
|
|
156
158
|
- Foundation: `"name": "foundation"` (not `{{projectName}}-foundation`)
|
|
157
159
|
- Site: `"name": "site"` (not `{{projectName}}-site`)
|
|
158
160
|
|
|
161
|
+
### Root package.json Requirements
|
|
162
|
+
|
|
163
|
+
The root `package.json.hbs` must include workspace configuration for both npm and pnpm:
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"name": "{{projectName}}",
|
|
168
|
+
"version": "0.1.0",
|
|
169
|
+
"private": true,
|
|
170
|
+
"type": "module",
|
|
171
|
+
"scripts": {
|
|
172
|
+
"dev": "pnpm --filter site dev",
|
|
173
|
+
"dev:runtime": "VITE_FOUNDATION_MODE=runtime pnpm --filter site dev",
|
|
174
|
+
"build": "pnpm -r build",
|
|
175
|
+
"preview": "pnpm --filter site preview"
|
|
176
|
+
},
|
|
177
|
+
"workspaces": [
|
|
178
|
+
"site",
|
|
179
|
+
"foundation",
|
|
180
|
+
"sites/*",
|
|
181
|
+
"foundations/*"
|
|
182
|
+
],
|
|
183
|
+
"pnpm": {
|
|
184
|
+
"onlyBuiltDependencies": ["esbuild", "sharp"]
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Required fields:**
|
|
190
|
+
- `workspaces` - Enables npm workspace linking (required for `file:` dependencies to work)
|
|
191
|
+
- `pnpm.onlyBuiltDependencies` - Prevents pnpm from rebuilding native modules on every install
|
|
192
|
+
|
|
159
193
|
This matches how the CLI's built-in templates work and ensures the workspace linking functions correctly.
|
|
160
194
|
|
|
161
195
|
### Workspace Configuration
|
|
@@ -234,10 +268,11 @@ Key testing points:
|
|
|
234
268
|
|
|
235
269
|
- [ ] Create `templates/<name>/template.json` with required `name` field
|
|
236
270
|
- [ ] Create `templates/<name>/template/` directory structure
|
|
271
|
+
- [ ] Include root `package.json.hbs` with `workspaces` array and `pnpm.onlyBuiltDependencies`
|
|
272
|
+
- [ ] Include `pnpm-workspace.yaml` with workspace packages
|
|
237
273
|
- [ ] Include both `foundation/` and `site/` packages
|
|
238
|
-
- [ ] Add `"foundation": "
|
|
274
|
+
- [ ] Add `"foundation": "file:../foundation"` to site's dependencies (not `workspace:*`)
|
|
239
275
|
- [ ] Use fixed names: `"name": "foundation"` and `"name": "site"`
|
|
240
|
-
- [ ] Include `pnpm-workspace.yaml` with workspace packages
|
|
241
276
|
- [ ] Add `.hbs` extension to files needing variable substitution
|
|
242
277
|
- [ ] Include sample content in `site/pages/`
|
|
243
278
|
- [ ] Create meaningful component metadata in `foundation/src/components/*/meta.js`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/templates",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Template processing engine and official templates for Uniweb",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -29,4 +29,4 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"handlebars": "^4.7.8"
|
|
31
31
|
}
|
|
32
|
-
}
|
|
32
|
+
}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "{{projectName}}",
|
|
3
|
+
"version": "0.1.0",
|
|
3
4
|
"private": true,
|
|
4
5
|
"type": "module",
|
|
5
6
|
"scripts": {
|
|
6
7
|
"dev": "pnpm --filter site dev",
|
|
7
|
-
"dev:runtime": "pnpm --filter site dev
|
|
8
|
-
"build": "pnpm
|
|
9
|
-
"build:foundation": "pnpm --filter foundation build",
|
|
10
|
-
"build:site": "pnpm --filter site build",
|
|
8
|
+
"dev:runtime": "VITE_FOUNDATION_MODE=runtime pnpm --filter site dev",
|
|
9
|
+
"build": "pnpm -r build",
|
|
11
10
|
"preview": "pnpm --filter site preview"
|
|
11
|
+
},
|
|
12
|
+
"workspaces": [
|
|
13
|
+
"site",
|
|
14
|
+
"foundation",
|
|
15
|
+
"sites/*",
|
|
16
|
+
"foundations/*"
|
|
17
|
+
],
|
|
18
|
+
"pnpm": {
|
|
19
|
+
"onlyBuiltDependencies": ["esbuild", "sharp"]
|
|
12
20
|
}
|
|
13
21
|
}
|