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.
- package/README.ja.md +47 -7
- package/README.md +47 -7
- package/dist/cli/commands/add-auth.d.ts.map +1 -1
- package/dist/cli/commands/add-auth.js +66 -21
- package/dist/cli/commands/add-auth.js.map +1 -1
- package/dist/cli/commands/dev.d.ts +4 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +108 -44
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/commands/init.d.ts +6 -5
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +83 -39
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/scaffold.d.ts +1 -1
- package/dist/cli/commands/scaffold.d.ts.map +1 -1
- package/dist/cli/commands/scaffold.js +38 -15
- package/dist/cli/commands/scaffold.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/core/config.d.ts +2 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +19 -0
- package/dist/core/config.js.map +1 -1
- package/dist/core/project/agent-instructions.d.ts +2 -1
- package/dist/core/project/agent-instructions.d.ts.map +1 -1
- package/dist/core/project/agent-instructions.js +12 -0
- package/dist/core/project/agent-instructions.js.map +1 -1
- package/dist/core/project/capabilities.d.ts +7 -0
- package/dist/core/project/capabilities.d.ts.map +1 -1
- package/dist/core/project/capabilities.js +7 -0
- package/dist/core/project/capabilities.js.map +1 -1
- package/dist/core/project/manifest.d.ts +3 -1
- package/dist/core/project/manifest.d.ts.map +1 -1
- package/dist/core/project/manifest.js +47 -25
- package/dist/core/project/manifest.js.map +1 -1
- package/dist/core/project/react-project.d.ts +26 -0
- package/dist/core/project/react-project.d.ts.map +1 -0
- package/dist/core/project/react-project.js +422 -0
- package/dist/core/project/react-project.js.map +1 -0
- package/dist/core/project/validation.d.ts.map +1 -1
- package/dist/core/project/validation.js +32 -10
- package/dist/core/project/validation.js.map +1 -1
- package/dist/core/scaffold/react-bff-generator.d.ts +10 -0
- package/dist/core/scaffold/react-bff-generator.d.ts.map +1 -0
- package/dist/core/scaffold/react-bff-generator.js +252 -0
- package/dist/core/scaffold/react-bff-generator.js.map +1 -0
- package/dist/core/scaffold/react-ui-generator.d.ts +6 -0
- package/dist/core/scaffold/react-ui-generator.d.ts.map +1 -0
- package/dist/core/scaffold/react-ui-generator.js +41 -0
- package/dist/core/scaffold/react-ui-generator.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/machine/index.js +2 -2
- package/dist/machine/index.js.map +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/package-manager.d.ts +2 -2
- package/dist/utils/package-manager.d.ts.map +1 -1
- package/dist/utils/package-manager.js +4 -1
- package/dist/utils/package-manager.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/agent-instructions.test.ts +1 -1
- package/src/__tests__/init.test.ts +29 -5
- package/src/__tests__/react.test.ts +819 -0
- package/src/__tests__/release-metadata.test.ts +121 -0
- package/src/cli/commands/add-auth.ts +67 -23
- package/src/cli/commands/dev.ts +109 -46
- package/src/cli/commands/init.ts +75 -35
- package/src/cli/commands/scaffold.ts +40 -19
- package/src/cli/index.ts +6 -3
- package/src/core/config.ts +21 -1
- package/src/core/project/agent-instructions.ts +14 -1
- package/src/core/project/agent-templates/AGENTS.md +24 -9
- package/src/core/project/agent-templates/bff-routes.instructions.md +5 -3
- package/src/core/project/capabilities.ts +14 -0
- package/src/core/project/manifest.ts +52 -27
- package/src/core/project/react-project.ts +507 -0
- package/src/core/project/validation.ts +32 -10
- package/src/core/scaffold/react-bff-generator.ts +292 -0
- package/src/core/scaffold/react-ui-generator.ts +51 -0
- package/src/index.ts +3 -1
- package/src/machine/index.ts +2 -2
- package/src/types/index.ts +4 -0
- 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(
|
|
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(
|
|
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(
|
|
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(
|
|
468
|
+
const cacheAfter = execFileSync(npmCommand, ["config", "get", "cache"], npmOptions);
|
|
445
469
|
expect(cacheAfter.trim()).toBe(env.npm_config_cache);
|
|
446
|
-
const after = execFileSync(
|
|
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 });
|