- commit
- d67b71c4fda1db44ab1b574a43e1a4031c3961f1
- parent
- 57ddfa026f76467f7f2c8e845df03f7943b10f06
- author
- Dami <dami.etoile@gmail.com>
| M | apps/ | 25 | ++++++++++++------------- |
| M | apps/ | 3 | +-- |
| M | deno.json | 2 | +- |
| M | package/ | 10 | +++++----- |
| M | package/ | 21 | +++++++++++++++++---- |
| M | package/ | 2 | +- |
| M | package/ | 2 | +- |
| M | tools/ | 29 | ++++++++++++++++++++++++++++- |
@@ -2,18 +2,18 @@
22 "imports": {33 "@astrojs/check": "npm:@astrojs/check@0.9.9",44 "@astrojs/preact": "npm:@astrojs/preact@6.0.1",5- "@nzip/lofi": "jsr:@nzip/lofi@0.3.0",6- "@nzip/lofi/": "jsr:@nzip/lofi@0.3.0/",7- "@nzip/lofi/access": "jsr:@nzip/lofi@0.3.0/access",8- "@nzip/lofi/astro": "jsr:@nzip/lofi@0.3.0/astro",9- "@nzip/lofi/build": "jsr:@nzip/lofi@0.3.0/build",10- "@nzip/lofi/dev": "jsr:@nzip/lofi@0.3.0/dev",11- "@nzip/lofi/doctor": "jsr:@nzip/lofi@0.3.0/doctor",12- "@nzip/lofi/preview": "jsr:@nzip/lofi@0.3.0/preview",13- "@nzip/lofi/preact": "jsr:@nzip/lofi@0.3.0/preact",14- "@nzip/lofi/provision": "jsr:@nzip/lofi@0.3.0/provision",15- "@nzip/lofi/test": "jsr:@nzip/lofi@0.3.0/test",16- "@nzip/lofi/testing": "jsr:@nzip/lofi@0.3.0/testing",5+ "@nzip/lofi": "../../package/runtime/mod.ts",6+ "@nzip/lofi/": "../../package/",7+ "@nzip/lofi/access": "../../package/access/mod.ts",8+ "@nzip/lofi/astro": "../../package/astro/mod.ts",9+ "@nzip/lofi/build": "../../package/commands/build.ts",10+ "@nzip/lofi/dev": "../../package/commands/dev.ts",11+ "@nzip/lofi/doctor": "../../package/commands/doctor.ts",12+ "@nzip/lofi/preview": "../../package/commands/preview.ts",13+ "@nzip/lofi/preact": "../../package/preact/mod.ts",14+ "@nzip/lofi/provision": "../../package/commands/provision.ts",15+ "@nzip/lofi/test": "../../package/commands/run_tests.ts",16+ "@nzip/lofi/testing": "../../package/testing/mod.ts",1717 "astro": "npm:astro@7.0.9",1818 "astro/config": "npm:astro@7.0.9/config",1919 "jazz-tools": "npm:jazz-tools@2.0.0-alpha.53",@@ -28,7 +28,6 @@
2828 "typescript": "npm:typescript@6.0.3",2929 "vite": "npm:vite@8.0.1"3030 },31- "links": ["../.."],3231 "nodeModulesDir": "auto",3332 "compilerOptions": {3433 "lib": ["deno.ns", "dom", "dom.iterable", "esnext"],@@ -3102,7 +3102,6 @@
31023102 },31033103 "workspace": {31043104 "dependencies": [3105- "jsr:@nzip/lofi@0.3.0",31063105 "npm:@astrojs/check@0.9.9",31073106 "npm:@astrojs/preact@6.0.1",31083107 "npm:astro@7.0.9",@@ -3113,7 +3112,7 @@
31133112 "npm:vite@8.0.1"31143113 ],31153114 "links": {3116- "jsr:@nzip/lofi@0.3.0": {3115+ "jsr:@nzip/lofi@0.3.1": {31173116 "dependencies": [31183117 "npm:@astrojs/check@0.9.9",31193118 "npm:@astrojs/preact@6.0.1",@@ -98,9 +98,9 @@ Point them at any other static host by editing those two tasks.
9898 `;9999 }100100 101-// The `/lofi/*` import keys the template carries as local repo paths; a102-// generated project resolves the same keys through the published package (or a103-// file: override in clean-room tests). Everything else in the template deno.json101+// The `/lofi/*` import keys the template carries as explicit local repo102+// paths; a generated project resolves the same keys through the published103+// package (or a file: override in clean-room tests). Everything else in the template deno.json104104 // — npm imports, tasks (including schema/migration/deploy), fmt, lint — is copied105105 // verbatim, so the template is the single source of truth for project config.106106 const lofiImportTargets: Record<string, { subpath: string; localPath: string }> = {@@ -136,8 +136,8 @@ async function rewritePortableDenoConfig(root: string, packagePrefix: string): P
136136 ? `${packagePrefix}${subpath}`137137 : packagePrefix.slice(0, -1);138138 }139- // The reference app links the local @nzip/lofi package for its dev loop; a140- // generated project resolves the pinned JSR version directly.139+ // Never copy a Deno `links` override into a generated project. The reference140+ // app uses explicit relative imports for its local package development loop.141141 delete config.links;142142 await Deno.writeTextFile(path, `${JSON.stringify(config, null, 2)}\n`);143143 }@@ -99,9 +99,9 @@ Deno.test("createProject materializes the complete starter snapshot", async () =
9999 );100100 }101101 const config = JSON.parse(await Deno.readTextFile(join(result.destination, "deno.json")));102- assertEquals(config.imports["@nzip/lofi"], "jsr:@nzip/lofi@0.3.0");103- assertEquals(config.imports["@nzip/lofi/"], "jsr:@nzip/lofi@0.3.0/");104- assertEquals(config.imports["@nzip/lofi/testing"], "jsr:@nzip/lofi@0.3.0/testing");102+ assertEquals(config.imports["@nzip/lofi"], "jsr:@nzip/lofi@0.3.1");103+ assertEquals(config.imports["@nzip/lofi/"], "jsr:@nzip/lofi@0.3.1/");104+ assertEquals(config.imports["@nzip/lofi/testing"], "jsr:@nzip/lofi@0.3.1/testing");105105 const lofiSpecifiers = Object.entries(config.imports)106106 .filter(([name]) => name.startsWith("@nzip/lofi/"))107107 .map(([, specifier]) => String(specifier));@@ -110,7 +110,7 @@ Deno.test("createProject materializes the complete starter snapshot", async () =
110110 `expected one package prefix, access, two integrations, six commands, and testing, received ${lofiSpecifiers.length}`,111111 );112112 assert(113- lofiSpecifiers.every((specifier) => specifier.startsWith("jsr:@nzip/lofi@0.3.0/")),113+ lofiSpecifiers.every((specifier) => specifier.startsWith("jsr:@nzip/lofi@0.3.1/")),114114 "generated lofi commands do not resolve through one exact package version",115115 );116116 const pngSignature = [137, 80, 78, 71, 13, 10, 26, 10];@@ -157,6 +157,19 @@ Deno.test("package manifest and generated version stay coupled", () => {
157157 assertEquals(packageManifest.exports["./testing"], "./package/testing/mod.ts");158158 });159159 160+Deno.test("reference template uses portable explicit package paths", async () => {161+ const config = JSON.parse(162+ await Deno.readTextFile(new URL("../apps/reference/deno.json", import.meta.url)),163+ );164+ assert(!("links" in config), "reference template must not publish a Deno links override");165+ const lofiImports = Object.entries(config.imports as Record<string, string>)166+ .filter(([name]) => name === "@nzip/lofi" || name.startsWith("@nzip/lofi/"));167+ assert(168+ lofiImports.every(([, target]) => target.startsWith("../../package/")),169+ "reference template must resolve lofi through explicit local package paths",170+ );171+});172+160173 Deno.test("createProject refuses a non-empty destination without changing it", async () => {161174 const cwd = await makeTestRoot();162175 const destination = join(cwd, "taken");@@ -1,7 +1,7 @@
11 {22 ".env.example": "9b21194b6be854a0c3c14ce03e664a81d7102924c3bc3db00e51464df44a1c84",33 ".gitignore": "9b9fa4b95f8f728ce80e93fc224d430328786b620096b80f067a3190c410a00e",4- "deno.json": "b5cc4cdf6520d2596255d9f1333958171f73e3b9619e91719c4aa15a763179e1",4+ "deno.json": "af3dd08701c4840e47b3568ec763cf852cafc86aef07f29b23b41db38bec09f1",55 "public/apple-touch-icon.png": "be2b77066d9681709210388413ddcd94318906799ddd6645934b789a04bd4a61",66 "public/favicon.svg": "35b92ad48231c470b348eaebe6d6fe14acf2ec4a86e6726a03ccb130328a0d85",77 "public/icon-192.png": "6ee711f9ec990ec55f789d7943813c5193973bf2ca9199078ee85d285317e07c",@@ -1,5 +1,5 @@
11 /** The single source version for generated @nzip/lofi references. */2-export const LOFI_VERSION = "0.3.0";2+export const LOFI_VERSION = "0.3.1";33 44 /** The exact JSR package prefix emitted into generated projects. */55 export const LOFI_PACKAGE_PREFIX = `jsr:@nzip/lofi@${LOFI_VERSION}/`;@@ -293,7 +293,13 @@ async function generateProject(
293293 if (source === "registry") await waitForRegistryVersion(version);294294 const projectName = "golden-app";295295 const args = source === "registry"296- ? ["run", "-A", `jsr:@nzip/lofi@${version}/create`, projectName]296+ ? [297+ "run",298+ "-A",299+ "--minimum-dependency-age=0",300+ `jsr:@nzip/lofi@${version}/create`,301+ projectName,302+ ]297303 : ["run", "-A", join(repositoryRoot, "package", "create.ts"), projectName];298304 const environment: Record<string, string> = source === "local"299305 ? {@@ -330,6 +336,27 @@ async function generateProject(
330336 "generator overwrote a non-empty project",331337 );332338 await Deno.remove(marker);339+ if (source === "registry") {340+ const config = JSON.parse(await Deno.readTextFile(join(projectRoot, "deno.json"))) as {341+ imports: Record<string, string>;342+ };343+ const packageEntrypoints = [344+ ...new Set(345+ Object.entries(config.imports)346+ .filter(([name]) =>347+ name === "@nzip/lofi" || name.startsWith("@nzip/lofi/") &&348+ !name.endsWith("/")349+ )350+ .map(([, target]) => target),351+ ),352+ ];353+ await runCommand(354+ "registry-cache",355+ Deno.execPath(),356+ ["cache", "--minimum-dependency-age=0", ...packageEntrypoints],357+ projectRoot,358+ );359+ }333360 return projectRoot;334361 }335362