lucynui 0.1.0 → 0.1.1

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/cli/create.ts +31 -2
  2. package/package.json +1 -1
package/cli/create.ts CHANGED
@@ -122,6 +122,8 @@ export async function scaffoldInto(dir: string) {
122
122
  if (!(await Bun.file(manifest).exists())) {
123
123
  await cp(join(source, "package.json"), manifest);
124
124
  }
125
+
126
+ await patchManifest(manifest);
125
127
  } finally {
126
128
  await rm(source, { recursive: true, force: true });
127
129
  }
@@ -129,7 +131,8 @@ export async function scaffoldInto(dir: string) {
129
131
 
130
132
  /** Points the app at this CLI's own version, so template drift can never bite. */
131
133
  async function pinFramework(dir: string) {
132
- const manifest = Bun.file(join(dir, "package.json"));
134
+ const manifestPath = join(dir, "package.json");
135
+ const manifest = Bun.file(manifestPath);
133
136
  if (!(await manifest.exists())) return;
134
137
 
135
138
  // Running from a checkout rather than an install? Point the app at this copy
@@ -141,6 +144,32 @@ async function pinFramework(dir: string) {
141
144
  const pkg = await manifest.json();
142
145
  pkg.dependencies = { ...(pkg.dependencies ?? {}), lucynui: spec };
143
146
  await Bun.write(manifest, JSON.stringify(pkg, null, 2) + "\n");
147
+
148
+ await patchManifest(manifestPath);
149
+ }
150
+
151
+ /**
152
+ * Ensures the scaffolded package.json has the scripts and trustedDependencies
153
+ * that users expect — the template repo ships a minimal manifest intentionally,
154
+ * so we inject these here rather than keeping them in sync in two repos.
155
+ */
156
+ async function patchManifest(manifestPath: string) {
157
+ const file = Bun.file(manifestPath);
158
+ if (!(await file.exists())) return;
159
+
160
+ const pkg = await file.json();
161
+
162
+ pkg.scripts = {
163
+ dev: "lucyn dev",
164
+ build: "lucyn build",
165
+ ...(pkg.scripts ?? {}),
166
+ };
167
+
168
+ const trusted: string[] = pkg.trustedDependencies ?? [];
169
+ if (!trusted.includes("lucynui")) trusted.push("lucynui");
170
+ pkg.trustedDependencies = trusted;
171
+
172
+ await Bun.write(file, JSON.stringify(pkg, null, 2) + "\n");
144
173
  }
145
174
 
146
175
  async function fetchTemplate() {
@@ -220,4 +249,4 @@ export async function devDetached(dir: string, logPath: string): Promise<number
220
249
  child.unref();
221
250
  closeSync(fd);
222
251
  }
223
- }
252
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucynui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Desktop apps from plain HTML, CSS and JS. No React, no Rust, no Electron.",
5
5
  "license": "MIT",
6
6
  "type": "module",