@cavulsqa/create 0.1.0 → 0.1.2
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 +28 -0
- package/lib/templateFingerprint.mjs +29 -0
- package/package.json +4 -2
- package/templates/f7-app/vite.config.ts +1 -3
package/README.md
CHANGED
|
@@ -9,6 +9,19 @@ pnpm create @cavulsqa
|
|
|
9
9
|
`npm create @cavulsqa`, `bun create @cavulsqa` and `vp create @cavulsqa` all work the same way. With
|
|
10
10
|
a terminal it asks four questions; with `--name` it asks none, which is what CI wants.
|
|
11
11
|
|
|
12
|
+
**On PowerShell, quote the scope** — or use `npx`:
|
|
13
|
+
|
|
14
|
+
```powershell
|
|
15
|
+
pnpm create '@cavulsqa'
|
|
16
|
+
npx @cavulsqa/create --name myapp
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Unquoted, `@cavulsqa` is PowerShell's splatting operator: it expands an undefined variable to
|
|
20
|
+
nothing, pnpm never sees a package name, and you get a 404 for something like `create---name`. The
|
|
21
|
+
`npx` form has no leading `@` on a bare token, so it is immune.
|
|
22
|
+
|
|
23
|
+
There is no unscoped `create-cavulsqa`, so `pnpm create cavulsqa` is a 404 as well.
|
|
24
|
+
|
|
12
25
|
```bash
|
|
13
26
|
pnpm create @cavulsqa --name caputa --app-id com.sig.caputa --yes
|
|
14
27
|
```
|
|
@@ -61,3 +74,18 @@ pnpm build && npx cap sync android && npx cap run android
|
|
|
61
74
|
|
|
62
75
|
Android builds need **JDK 21**. An older one fails with `invalid source release: 21` from inside
|
|
63
76
|
`capacitor-android`, which reads like a Capacitor bug and is not one.
|
|
77
|
+
|
|
78
|
+
## Changing a template
|
|
79
|
+
|
|
80
|
+
The templates are bundled when this package is packed, so a template fix reaches nobody until a new
|
|
81
|
+
version of `@cavulsqa/create` is published. Nothing in a template commit hints at that, so it is
|
|
82
|
+
enforced rather than remembered: a test fingerprints `templates/` and fails when the recorded
|
|
83
|
+
fingerprint is stale.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pnpm --filter @cavulsqa/create run stamp # patch
|
|
87
|
+
pnpm --filter @cavulsqa/create run stamp minor # new capability in a template
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
That records the fingerprint and bumps the version in one step; publish as usual afterwards. It is
|
|
91
|
+
a no-op when the templates have not moved, so running it out of habit costs nothing.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A content hash of every tracked file under `templates/`, used to prove that `@cavulsqa/create`
|
|
6
|
+
* was republished after the templates changed.
|
|
7
|
+
*
|
|
8
|
+
* The creator bundles the templates at pack time, so a template fix reaches nobody until a new
|
|
9
|
+
* version of the creator goes out. Nothing about that is visible in a diff, which is exactly the
|
|
10
|
+
* kind of coupling that gets forgotten - so it is checked rather than remembered.
|
|
11
|
+
*
|
|
12
|
+
* It asks git rather than walking the directory. Walking gave two different answers on a Windows
|
|
13
|
+
* working copy and on a CI checkout, because the disk holds whatever each machine happens to have:
|
|
14
|
+
* ignored files, build leftovers, and CRLF where the runner has LF. `git ls-files -s` reports the
|
|
15
|
+
* blob hash recorded in the index, which is normalised, platform-independent, and - the point -
|
|
16
|
+
* describes exactly what a `git clone` of this repository would produce.
|
|
17
|
+
*/
|
|
18
|
+
export function fingerprintTemplates(repoRoot) {
|
|
19
|
+
const listing = execFileSync("git", ["ls-files", "-s", "--", "templates"], {
|
|
20
|
+
cwd: repoRoot,
|
|
21
|
+
encoding: "utf8",
|
|
22
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const lines = listing.split("\n").filter(Boolean).sort();
|
|
26
|
+
if (!lines.length) throw new Error("git reports no tracked files under templates/");
|
|
27
|
+
|
|
28
|
+
return `sha256-${createHash("sha256").update(lines.join("\n")).digest("base64")}`;
|
|
29
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cavulsqa/create",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Create a Vue + Framework7 + Capacitor + SQLite app from the cavulsqa templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"capacitor",
|
|
@@ -52,9 +52,11 @@
|
|
|
52
52
|
}
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
|
+
"templatesFingerprint": "sha256-7SiAd2fNFtbBqL3RPdjFpJEM9CeKmmPWj/oet2rfeGk=",
|
|
55
56
|
"scripts": {
|
|
56
57
|
"build": "node scripts/bundleTemplates.mjs",
|
|
57
58
|
"check": "vp check",
|
|
58
|
-
"test": "vp test"
|
|
59
|
+
"test": "vp test",
|
|
60
|
+
"stamp": "node scripts/stampTemplates.mjs"
|
|
59
61
|
}
|
|
60
62
|
}
|
|
@@ -41,9 +41,7 @@ export default defineConfig({
|
|
|
41
41
|
|
|
42
42
|
Icons({ autoInstall: true, compiler: "vue3" }),
|
|
43
43
|
|
|
44
|
-
VueI18nPlugin({
|
|
45
|
-
include: [fileURLToPath(new URL("./src/locales/**", import.meta.url))],
|
|
46
|
-
}),
|
|
44
|
+
VueI18nPlugin({ include: [fileURLToPath(new URL("./src/locales/**", import.meta.url))] }),
|
|
47
45
|
|
|
48
46
|
/**
|
|
49
47
|
* Composition API, i18n, vueuse and the Framework7 helpers are available without an import
|