swallowkit 1.1.2 → 2.0.0-alpha.1

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.
Files changed (87) hide show
  1. package/README.ja.md +47 -7
  2. package/README.md +47 -7
  3. package/dist/cli/commands/add-auth.d.ts.map +1 -1
  4. package/dist/cli/commands/add-auth.js +66 -21
  5. package/dist/cli/commands/add-auth.js.map +1 -1
  6. package/dist/cli/commands/dev.d.ts +4 -1
  7. package/dist/cli/commands/dev.d.ts.map +1 -1
  8. package/dist/cli/commands/dev.js +108 -44
  9. package/dist/cli/commands/dev.js.map +1 -1
  10. package/dist/cli/commands/init.d.ts +6 -5
  11. package/dist/cli/commands/init.d.ts.map +1 -1
  12. package/dist/cli/commands/init.js +83 -39
  13. package/dist/cli/commands/init.js.map +1 -1
  14. package/dist/cli/commands/scaffold.d.ts +1 -1
  15. package/dist/cli/commands/scaffold.d.ts.map +1 -1
  16. package/dist/cli/commands/scaffold.js +38 -15
  17. package/dist/cli/commands/scaffold.js.map +1 -1
  18. package/dist/cli/index.d.ts.map +1 -1
  19. package/dist/cli/index.js +6 -3
  20. package/dist/cli/index.js.map +1 -1
  21. package/dist/core/config.d.ts +2 -1
  22. package/dist/core/config.d.ts.map +1 -1
  23. package/dist/core/config.js +19 -0
  24. package/dist/core/config.js.map +1 -1
  25. package/dist/core/project/agent-instructions.d.ts +2 -1
  26. package/dist/core/project/agent-instructions.d.ts.map +1 -1
  27. package/dist/core/project/agent-instructions.js +12 -0
  28. package/dist/core/project/agent-instructions.js.map +1 -1
  29. package/dist/core/project/capabilities.d.ts +7 -0
  30. package/dist/core/project/capabilities.d.ts.map +1 -1
  31. package/dist/core/project/capabilities.js +7 -0
  32. package/dist/core/project/capabilities.js.map +1 -1
  33. package/dist/core/project/manifest.d.ts +3 -1
  34. package/dist/core/project/manifest.d.ts.map +1 -1
  35. package/dist/core/project/manifest.js +47 -25
  36. package/dist/core/project/manifest.js.map +1 -1
  37. package/dist/core/project/react-project.d.ts +26 -0
  38. package/dist/core/project/react-project.d.ts.map +1 -0
  39. package/dist/core/project/react-project.js +422 -0
  40. package/dist/core/project/react-project.js.map +1 -0
  41. package/dist/core/project/validation.d.ts.map +1 -1
  42. package/dist/core/project/validation.js +32 -10
  43. package/dist/core/project/validation.js.map +1 -1
  44. package/dist/core/scaffold/react-bff-generator.d.ts +10 -0
  45. package/dist/core/scaffold/react-bff-generator.d.ts.map +1 -0
  46. package/dist/core/scaffold/react-bff-generator.js +252 -0
  47. package/dist/core/scaffold/react-bff-generator.js.map +1 -0
  48. package/dist/core/scaffold/react-ui-generator.d.ts +6 -0
  49. package/dist/core/scaffold/react-ui-generator.d.ts.map +1 -0
  50. package/dist/core/scaffold/react-ui-generator.js +41 -0
  51. package/dist/core/scaffold/react-ui-generator.js.map +1 -0
  52. package/dist/index.d.ts +3 -3
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +3 -2
  55. package/dist/index.js.map +1 -1
  56. package/dist/machine/index.js +2 -2
  57. package/dist/machine/index.js.map +1 -1
  58. package/dist/types/index.d.ts +4 -0
  59. package/dist/types/index.d.ts.map +1 -1
  60. package/dist/utils/package-manager.d.ts +2 -2
  61. package/dist/utils/package-manager.d.ts.map +1 -1
  62. package/dist/utils/package-manager.js +4 -1
  63. package/dist/utils/package-manager.js.map +1 -1
  64. package/package.json +2 -2
  65. package/src/__tests__/agent-instructions.test.ts +1 -1
  66. package/src/__tests__/init.test.ts +29 -5
  67. package/src/__tests__/react.test.ts +819 -0
  68. package/src/__tests__/release-metadata.test.ts +121 -0
  69. package/src/cli/commands/add-auth.ts +67 -23
  70. package/src/cli/commands/dev.ts +109 -46
  71. package/src/cli/commands/init.ts +75 -35
  72. package/src/cli/commands/scaffold.ts +40 -19
  73. package/src/cli/index.ts +6 -3
  74. package/src/core/config.ts +21 -1
  75. package/src/core/project/agent-instructions.ts +14 -1
  76. package/src/core/project/agent-templates/AGENTS.md +24 -9
  77. package/src/core/project/agent-templates/bff-routes.instructions.md +5 -3
  78. package/src/core/project/capabilities.ts +14 -0
  79. package/src/core/project/manifest.ts +52 -27
  80. package/src/core/project/react-project.ts +507 -0
  81. package/src/core/project/validation.ts +32 -10
  82. package/src/core/scaffold/react-bff-generator.ts +292 -0
  83. package/src/core/scaffold/react-ui-generator.ts +51 -0
  84. package/src/index.ts +3 -1
  85. package/src/machine/index.ts +2 -2
  86. package/src/types/index.ts +4 -0
  87. package/src/utils/package-manager.ts +5 -2
@@ -40,6 +40,8 @@ export default nextConfig;
40
40
  const updated = injectSwallowKitNextConfig(original, "sample-app");
41
41
 
42
42
  expect(updated).toContain("output: 'standalone'");
43
+ expect(updated).toContain("cacheComponents: false");
44
+ expect(updated).not.toContain("partialPrefetching");
43
45
  expect(updated).toContain("agentRules: false");
44
46
  expect(updated).toContain("transpilePackages: ['@sample-app/shared']");
45
47
  expect(updated).toContain("serverExternalPackages: ['applicationinsights', 'diagnostic-channel-publishers']");
@@ -60,6 +62,26 @@ module.exports = nextConfig;
60
62
  expect(updated).toContain("transpilePackages: ['@sample-app/shared']");
61
63
  expect(updated).toContain("agentRules: false");
62
64
  expect(updated).toContain("module.exports = nextConfig;");
65
+ expect(updated).toContain("cacheComponents: false");
66
+ });
67
+
68
+ it.each([true, false])("disables create-next-app Cache Components without duplicate keys (initially %s)", (enabled) => {
69
+ const original = `import type { NextConfig } from 'next';
70
+ const nextConfig: NextConfig = {
71
+ cacheComponents: ${enabled},
72
+ partialPrefetching: true,
73
+ reactCompiler: true,
74
+ };
75
+ export default nextConfig;
76
+ `;
77
+ const updated = injectSwallowKitNextConfig(original, "sample-app");
78
+ expect(updated).toContain("cacheComponents: false");
79
+ expect(updated).not.toContain("cacheComponents: true");
80
+ expect(updated).toContain("partialPrefetching: false");
81
+ expect(updated.match(/\bpartialPrefetching\s*:/g)).toHaveLength(1);
82
+ expect(updated.match(/\bcacheComponents\s*:/g)).toHaveLength(1);
83
+ expect(updated).toContain("reactCompiler: true");
84
+ expect(updated).toContain("output: 'standalone'");
63
85
  });
64
86
 
65
87
  it("generates a C# Program.cs compatible with the current worker packages", () => {
@@ -411,11 +433,13 @@ describe("SWA npm compatibility with pnpm projects", () => {
411
433
  scripts: { prestart: "pnpm run build" },
412
434
  });
413
435
  const env = { ...process.env, npm_config_cache: path.join(dir, "cache") };
436
+ const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
437
+ const npmOptions = { cwd: dir, env, encoding: "utf8" as const, shell: process.platform === "win32" };
414
438
  // setup-node's npm cache lookup is an npm command too, before any install.
415
- const cacheBefore = spawnSync("npm", ["config", "get", "cache"], { cwd: dir, env, encoding: "utf8" });
439
+ const cacheBefore = spawnSync(npmCommand, ["config", "get", "cache"], npmOptions);
416
440
  expect(cacheBefore.status).not.toBe(0);
417
441
  expect(cacheBefore.stderr).toContain("EBADDEVENGINES");
418
- const before = spawnSync("npm", ["run", "probe"], { cwd: dir, env, encoding: "utf8" });
442
+ const before = spawnSync(npmCommand, ["run", "probe"], npmOptions);
419
443
  expect(before.status).not.toBe(0);
420
444
  expect(before.stderr).toContain("EBADDEVENGINES");
421
445
 
@@ -430,7 +454,7 @@ describe("SWA npm compatibility with pnpm projects", () => {
430
454
  }
431
455
  const runtimeCommand = workflow.match(/node -e "const fs=require\('fs'\);const p=JSON.parse[^\n]+/);
432
456
  expect(runtimeCommand).not.toBeNull();
433
- execFileSync("bash", ["-c", runtimeCommand![0]], { cwd: dir });
457
+ execFileSync(process.execPath, ["-e", runtimeCommand![0].slice('node -e "'.length, -1)], { cwd: dir });
434
458
  const match = workflow.match(/node <<'NODE'\n([\s\S]*?)\n\s+NODE/);
435
459
  expect(match).not.toBeNull();
436
460
  execFileSync(process.execPath, ["-e", match![1]], { cwd: dir });
@@ -441,9 +465,9 @@ describe("SWA npm compatibility with pnpm projects", () => {
441
465
  expect(normalized.devEngines.runtime.version).toBe(">=22.14.0");
442
466
  expect(normalized.workspaces).toEqual(hasFunctions ? ["shared", "functions"] : ["shared"]);
443
467
  expect(normalized.dependencies["@sample/shared"]).toBe("file:shared");
444
- const cacheAfter = execFileSync("npm", ["config", "get", "cache"], { cwd: dir, env, encoding: "utf8" });
468
+ const cacheAfter = execFileSync(npmCommand, ["config", "get", "cache"], npmOptions);
445
469
  expect(cacheAfter.trim()).toBe(env.npm_config_cache);
446
- const after = execFileSync("npm", ["run", "probe"], { cwd: dir, env, encoding: "utf8" });
470
+ const after = execFileSync(npmCommand, ["run", "probe"], npmOptions);
447
471
  expect(after).toContain("npm/");
448
472
  } finally {
449
473
  fs.rmSync(dir, { recursive: true, force: true });