create-feltkit 0.3.24 → 0.3.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-feltkit",
3
- "version": "0.3.24",
3
+ "version": "0.3.26",
4
4
  "description": "Create a FeltKit application: npm create feltkit@latest my-app (add -- --template managed for Managed FeltDB)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -37,6 +37,6 @@
37
37
  },
38
38
  "homepage": "https://www.npmjs.com/package/create-feltkit",
39
39
  "dependencies": {
40
- "@feltdb/feltkit": "0.3.24"
40
+ "@feltdb/feltkit": "0.3.26"
41
41
  }
42
42
  }
package/scaffold.d.ts CHANGED
@@ -24,3 +24,15 @@ export declare const TEMPLATES: Readonly<Record<TemplateName, { dir: string; des
24
24
  export declare function toAppName(input: string): string;
25
25
  export declare function templateDir(template?: TemplateName): string;
26
26
  export declare function scaffold(options: ScaffoldOptions): ScaffoldResult;
27
+ /** The scaffold provenance file written into every new project (`feltkit.scaffold.json`). */
28
+ export declare const SCAFFOLD_MANIFEST: "feltkit.scaffold.json";
29
+ export interface ScaffoldManifest {
30
+ schema: "feltkit.scaffold/1";
31
+ generator: "create-feltkit";
32
+ version: string;
33
+ template: TemplateName;
34
+ appName: string;
35
+ /** SHA-256 of each file as the scaffold wrote it, by POSIX path relative to the project. */
36
+ files: Record<string, string>;
37
+ }
38
+ export declare function scaffoldManifest(dir: string, options: { template: TemplateName; appName: string }): ScaffoldManifest;
package/scaffold.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Scaffold a FeltKit application from a starter template. No dependencies, so `npm create` is fast.
2
- import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
3
- import { basename, join } from "node:path";
2
+ import { createHash } from "node:crypto";
3
+ import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
4
+ import { basename, join, relative, sep } from "node:path";
4
5
  import { fileURLToPath } from "node:url";
5
6
 
6
7
  export const VERSION = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")).version;
@@ -94,5 +95,29 @@ export function scaffold({ target, name, sdkSpec, template = "tasks" }) {
94
95
  }
95
96
  const flyPath = join(target, "fly.toml");
96
97
  if (existsSync(flyPath)) writeFileSync(flyPath, readFileSync(flyPath, "utf8").replace(/^app = ".*"$/m, `app = ${JSON.stringify(appName)}`));
98
+ // What the starter wrote, byte for byte: `feltkit measure` tells an untouched starter file from
99
+ // one the developer changed by comparing against these digests (docs/MEASURE.md).
100
+ writeFileSync(join(target, SCAFFOLD_MANIFEST), `${JSON.stringify(scaffoldManifest(target, { template, appName }), null, 2)}\n`);
97
101
  return { dir: target, name: appName, sdkSpec: spec, template };
98
102
  }
103
+
104
+ /** The scaffold provenance file, committed with the application. */
105
+ export const SCAFFOLD_MANIFEST = "feltkit.scaffold.json";
106
+
107
+ /**
108
+ * The provenance of every file a scaffold wrote: generator, version, template, and the SHA-256 of each
109
+ * file as written (after the starter's name was replaced). Paths are POSIX, relative to the project.
110
+ */
111
+ export function scaffoldManifest(dir, { template, appName }) {
112
+ const files = {};
113
+ const walk = (d) => {
114
+ for (const name of readdirSync(d).sort()) {
115
+ if (name === ".git" || name === "node_modules" || name === SCAFFOLD_MANIFEST) continue;
116
+ const p = join(d, name);
117
+ if (statSync(p).isDirectory()) walk(p);
118
+ else files[relative(dir, p).split(sep).join("/")] = createHash("sha256").update(readFileSync(p)).digest("hex");
119
+ }
120
+ };
121
+ walk(dir);
122
+ return { schema: "feltkit.scaffold/1", generator: "create-feltkit", version: VERSION, template, appName, files };
123
+ }
@@ -13,7 +13,7 @@
13
13
  "typecheck": "tsc --noEmit"
14
14
  },
15
15
  "dependencies": {
16
- "@feltdb/feltkit": "0.3.24",
16
+ "@feltdb/feltkit": "0.3.26",
17
17
  "@feltdb/webllm": ">=0.21.0 <1.0.0",
18
18
  "@mlc-ai/web-llm": "^0.2.84",
19
19
  "react": "19.2.0",
@@ -20,7 +20,7 @@
20
20
  "deploy:fly": "node scripts/deploy-fly.mjs"
21
21
  },
22
22
  "dependencies": {
23
- "@feltdb/feltkit": "0.3.24"
23
+ "@feltdb/feltkit": "0.3.26"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@feltdb/core": ">=0.21.0 <1.0.0",