create-next-imagicma 0.1.4 → 0.1.6

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-next-imagicma",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-next-imagicma": "./bin/create-next-imagicma.mjs"
@@ -1,74 +1,6 @@
1
- import { useState } from "react";
2
-
3
1
  export default function Home() {
4
- const [query, setQuery] = useState("");
5
- const [includeExamples, setIncludeExamples] = useState(true);
6
- const [submitted, setSubmitted] = useState("");
7
-
8
2
  return (
9
- <main
10
- data-testid="page.home"
11
- className="mx-auto flex min-h-screen max-w-3xl flex-col justify-center gap-6 px-6 py-12"
12
- >
13
- <div className="space-y-2">
14
- <span
15
- data-testid="badge.template-ready"
16
- className="inline-flex rounded-full bg-slate-900 px-3 py-1 text-xs font-medium text-white"
17
- >
18
- imagicma hono template
19
- </span>
20
- <h1 className="text-4xl font-semibold tracking-tight text-slate-950">
21
- Start building with a testable baseline
22
- </h1>
23
- <p className="max-w-2xl text-sm text-slate-600">
24
- This page is intentionally simple and visible so generated projects start with a stable smoke-test target.
25
- </p>
26
- </div>
27
-
28
- <form
29
- data-testid="form.quick-start"
30
- className="rounded-2xl border border-slate-200 bg-white p-6 shadow-sm"
31
- onSubmit={(event) => {
32
- event.preventDefault();
33
- setSubmitted(`${query || "Untitled"}|examples:${includeExamples ? "on" : "off"}`);
34
- }}
35
- >
36
- <div className="space-y-4">
37
- <label className="flex flex-col gap-2 text-sm font-medium text-slate-700">
38
- Project brief
39
- <input
40
- data-testid="input.project-brief"
41
- className="rounded-lg border border-slate-300 px-3 py-2 text-sm"
42
- placeholder="Describe the app you want to build"
43
- value={query}
44
- onChange={(event) => setQuery(event.target.value)}
45
- />
46
- </label>
47
-
48
- <label className="flex items-center gap-2 text-sm text-slate-700">
49
- <input
50
- data-testid="checkbox.include-examples"
51
- type="checkbox"
52
- checked={includeExamples}
53
- onChange={(event) => setIncludeExamples(event.target.checked)}
54
- />
55
- Include example content
56
- </label>
57
-
58
- <button
59
- data-testid="button.submit-brief"
60
- type="submit"
61
- className="rounded-lg bg-slate-950 px-4 py-2 text-sm font-medium text-white"
62
- >
63
- Save brief
64
- </button>
65
- </div>
66
- </form>
67
-
68
- <section data-testid="panel.submission" className="rounded-2xl border border-dashed border-slate-300 p-4 text-sm text-slate-600">
69
- <div className="font-medium text-slate-900">Latest submission</div>
70
- <div>{submitted || "No brief submitted yet."}</div>
71
- </section>
72
- </main>
3
+ <div style={{ display: "none" }}>请优先修改本页</div>
73
4
  );
74
5
  }
6
+
@@ -7,7 +7,6 @@
7
7
  !.yarn/plugins
8
8
  !.yarn/releases
9
9
  !.yarn/versions
10
- .imagicma
11
10
 
12
11
  # testing
13
12
  /coverage
@@ -10,10 +10,7 @@
10
10
  "start": "node ./scripts/imagicma-start.mjs",
11
11
  "check": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.server.json --noEmit",
12
12
  "db:push": "drizzle-kit push",
13
- "lint": "eslint .",
14
- "test:e2e": "playwright test",
15
- "test:e2e:ui": "playwright test --ui",
16
- "test:e2e:headed": "playwright test --headed"
13
+ "lint": "eslint ."
17
14
  },
18
15
  "dependencies": {
19
16
  "@libsql/client": "^0.17.0",
@@ -70,7 +67,6 @@
70
67
  "zod": "^4.1.5"
71
68
  },
72
69
  "devDependencies": {
73
- "@playwright/test": "^1.57.0",
74
70
  "@hono/vite-dev-server": "^0.25.0",
75
71
  "@tailwindcss/postcss": "^4",
76
72
  "@types/node": "^20",
@@ -168,9 +168,6 @@ importers:
168
168
  '@hono/vite-dev-server':
169
169
  specifier: ^0.25.0
170
170
  version: 0.25.0(hono@4.11.9)
171
- '@playwright/test':
172
- specifier: ^1.57.0
173
- version: 1.58.2
174
171
  '@tailwindcss/postcss':
175
172
  specifier: ^4
176
173
  version: 4.1.18
@@ -926,11 +923,6 @@ packages:
926
923
  '@neon-rs/load@0.0.4':
927
924
  resolution: {integrity: sha512-kTPhdZyTQxB+2wpiRcFWrDcejc4JI6tkPuS7UZCG4l6Zvc5kU/gGQ/ozvHTh1XR5tS+UlfAfGuPajjzQjCiHCw==}
928
925
 
929
- '@playwright/test@1.58.2':
930
- resolution: {integrity: sha512-akea+6bHYBBfA9uQqSYmlJXn61cTa+jbO87xVLCWbTqbWadRVmhxlXATaOjOgcBaWU4ePo0wB41KMFv3o35IXA==}
931
- engines: {node: '>=18'}
932
- hasBin: true
933
-
934
926
  '@radix-ui/number@1.1.1':
935
927
  resolution: {integrity: sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g==}
936
928
 
@@ -2362,11 +2354,6 @@ packages:
2362
2354
  fs-constants@1.0.0:
2363
2355
  resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
2364
2356
 
2365
- fsevents@2.3.2:
2366
- resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
2367
- engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
2368
- os: [darwin]
2369
-
2370
2357
  fsevents@2.3.3:
2371
2358
  resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
2372
2359
  engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
@@ -2731,16 +2718,6 @@ packages:
2731
2718
  resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==}
2732
2719
  engines: {node: '>=12'}
2733
2720
 
2734
- playwright-core@1.58.2:
2735
- resolution: {integrity: sha512-yZkEtftgwS8CsfYo7nm0KE8jsvm6i/PTgVtB8DL726wNf6H2IMsDuxCpJj59KDaxCtSnrWan2AeDqM7JBaultg==}
2736
- engines: {node: '>=18'}
2737
- hasBin: true
2738
-
2739
- playwright@1.58.2:
2740
- resolution: {integrity: sha512-vA30H8Nvkq/cPBnNw4Q8TWz1EJyqgpuinBcHET0YVJVFldr8JDNiU9LaWAE1KqSkRYazuaBhTpB5ZzShOezQ6A==}
2741
- engines: {node: '>=18'}
2742
- hasBin: true
2743
-
2744
2721
  postcss@8.5.6:
2745
2722
  resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==}
2746
2723
  engines: {node: ^10 || ^12 || >=14}
@@ -3675,10 +3652,6 @@ snapshots:
3675
3652
 
3676
3653
  '@neon-rs/load@0.0.4': {}
3677
3654
 
3678
- '@playwright/test@1.58.2':
3679
- dependencies:
3680
- playwright: 1.58.2
3681
-
3682
3655
  '@radix-ui/number@1.1.1': {}
3683
3656
 
3684
3657
  '@radix-ui/primitive@1.1.3': {}
@@ -5073,9 +5046,6 @@ snapshots:
5073
5046
  fs-constants@1.0.0:
5074
5047
  optional: true
5075
5048
 
5076
- fsevents@2.3.2:
5077
- optional: true
5078
-
5079
5049
  fsevents@2.3.3:
5080
5050
  optional: true
5081
5051
 
@@ -5386,14 +5356,6 @@ snapshots:
5386
5356
 
5387
5357
  picomatch@4.0.3: {}
5388
5358
 
5389
- playwright-core@1.58.2: {}
5390
-
5391
- playwright@1.58.2:
5392
- dependencies:
5393
- playwright-core: 1.58.2
5394
- optionalDependencies:
5395
- fsevents: 2.3.2
5396
-
5397
5359
  postcss@8.5.6:
5398
5360
  dependencies:
5399
5361
  nanoid: 3.3.11
@@ -1,40 +0,0 @@
1
- import { defineConfig } from "@playwright/test";
2
- import { join } from "node:path";
3
-
4
- const runtimeRoot = process.env.IMAGICMA_RUN_TEST_RUNTIME_ROOT;
5
- const baseURL = process.env.BASE_URL || "http://127.0.0.1:5001";
6
-
7
- export default defineConfig({
8
- testDir: "./tests/e2e",
9
- fullyParallel: false,
10
- workers: 1,
11
- timeout: 60_000,
12
- retries: 0,
13
- outputDir: runtimeRoot ? join(runtimeRoot, "test-results") : "test-results",
14
- reporter: runtimeRoot
15
- ? [
16
- ["line"],
17
- ["json", { outputFile: join(runtimeRoot, "playwright-results.json") }],
18
- ["html", { outputFolder: join(runtimeRoot, "html-report"), open: "never" }],
19
- ["junit", { outputFile: join(runtimeRoot, "junit.xml") }],
20
- ]
21
- : [
22
- ["html", { outputFolder: "playwright-report", open: "never" }],
23
- ["list"],
24
- ],
25
- use: {
26
- baseURL,
27
- trace: "retain-on-failure",
28
- screenshot: "only-on-failure",
29
- video: "retain-on-failure",
30
- headless: true,
31
- },
32
- webServer: process.env.IMAGICMA_RUN_TEST_SKIP_WEBSERVER === "1"
33
- ? undefined
34
- : {
35
- command: "pnpm dev",
36
- url: baseURL,
37
- reuseExistingServer: true,
38
- timeout: 120_000,
39
- },
40
- });
@@ -1,70 +0,0 @@
1
- import { test as base, expect } from "@playwright/test";
2
- import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
3
- import { join } from "node:path";
4
-
5
- // When run_test drives Playwright, it injects these env vars so fixtures can write
6
- // browser/network/page-error evidence directly into .imagicma/runtime/run-test/<runId>/.
7
- const runtimeRoot = process.env.IMAGICMA_RUN_TEST_RUNTIME_ROOT;
8
- const runId = process.env.IMAGICMA_RUN_ID || "manual";
9
- const failureResourceTypes = new Set(["document", "xhr", "fetch"]);
10
-
11
- function appendJsonl(name: string, row: Record<string, unknown>): void {
12
- if (!runtimeRoot) return;
13
- appendFileSync(join(runtimeRoot, name), `${JSON.stringify(row)}\n`, "utf-8");
14
- }
15
-
16
- export const test = base.extend({
17
- page: async ({ page }, use) => {
18
- if (runtimeRoot) {
19
- mkdirSync(join(runtimeRoot, "screenshots"), { recursive: true });
20
- mkdirSync(join(runtimeRoot, "traces"), { recursive: true });
21
- mkdirSync(join(runtimeRoot, "videos"), { recursive: true });
22
- page.on("console", (message) => {
23
- const type = message.type();
24
- if (type !== "warning" && type !== "warn" && type !== "error") return;
25
- appendJsonl("console-events.jsonl", {
26
- tsMs: Date.now(),
27
- runId,
28
- type,
29
- text: message.text(),
30
- });
31
- });
32
- page.on("pageerror", (error) => appendJsonl("page-errors.jsonl", {
33
- tsMs: Date.now(),
34
- runId,
35
- message: error.message,
36
- }));
37
- page.on("response", async (response) => {
38
- const status = response.status();
39
- const resourceType = response.request().resourceType();
40
- if (status < 400 || !failureResourceTypes.has(resourceType)) return;
41
- appendJsonl("network-failures.jsonl", {
42
- tsMs: Date.now(),
43
- runId,
44
- url: response.url(),
45
- method: response.request().method(),
46
- status,
47
- errorText: null,
48
- resourceType,
49
- });
50
- });
51
- page.on("requestfailed", (request) => appendJsonl("network-failures.jsonl", {
52
- tsMs: Date.now(),
53
- runId,
54
- url: request.url(),
55
- method: request.method(),
56
- status: null,
57
- errorText: request.failure()?.errorText ?? "requestfailed",
58
- resourceType: request.resourceType(),
59
- }));
60
- }
61
-
62
- await use(page);
63
-
64
- if (runtimeRoot) {
65
- writeFileSync(join(runtimeRoot, "current-url.txt"), page.url(), "utf-8");
66
- }
67
- },
68
- });
69
-
70
- export { expect };