@involvex/magic-pwa-core 0.1.1 → 0.2.0

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": "@involvex/magic-pwa-core",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Shared config schema and helpers for Magic-PWA",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -15,6 +15,20 @@ describe("schema", () => {
15
15
  expect(config.targets.electron).toBe(true);
16
16
  });
17
17
 
18
+ test("vue and svelte templates parse with basic-style defaults", () => {
19
+ for (const template of ["vue", "svelte"] as const) {
20
+ const config = createDefaultConfig({
21
+ name: "Demo",
22
+ slug: "demo",
23
+ appId: "com.example.demo",
24
+ template,
25
+ });
26
+ expect(MagicPwaConfigSchema.parse(config).template).toBe(template);
27
+ expect(config.pwa.themeColor).toBe("#0f172a");
28
+ expect(config.android.enableHaptics).toBe(true);
29
+ }
30
+ });
31
+
18
32
  test("defineConfig rejects bad slug", () => {
19
33
  expect(() =>
20
34
  MagicPwaConfigSchema.parse({
package/src/schema.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
 
3
- export const PwaTemplateSchema = z.enum(["basic", "blank"]);
3
+ export const PwaTemplateSchema = z.enum(["basic", "blank", "vue", "svelte"]);
4
4
  export type PwaTemplate = z.infer<typeof PwaTemplateSchema>;
5
5
 
6
6
  export const BuildTargetSchema = z.enum(["web", "electron", "chrome", "android"]);
@@ -19,6 +19,8 @@ export const MagicPwaConfigSchema = z.object({
19
19
  .string()
20
20
  .min(1)
21
21
  .regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/i, "appId must be reverse-domain"),
22
+ description: z.string().min(1),
23
+ author: z.string().min(1),
22
24
  version: z.string().min(1),
23
25
  template: PwaTemplateSchema,
24
26
  targets: z.object({
@@ -70,6 +72,8 @@ export function createDefaultConfig(overrides: {
70
72
  slug: string;
71
73
  appId: string;
72
74
  template: PwaTemplate;
75
+ description?: string;
76
+ author?: string;
73
77
  targets?: Partial<MagicPwaConfig["targets"]>;
74
78
  }): MagicPwaConfig {
75
79
  const targets = {
@@ -86,6 +90,8 @@ export function createDefaultConfig(overrides: {
86
90
  name: overrides.name,
87
91
  slug: overrides.slug,
88
92
  appId: overrides.appId,
93
+ description: overrides.description ?? `${overrides.name} — multi-target PWA`,
94
+ author: overrides.author ?? "Unknown",
89
95
  version: "0.1.0",
90
96
  template: overrides.template,
91
97
  targets,