@alphasquad/saleor-template-advance 0.1.3 → 0.1.4

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 (2) hide show
  1. package/next.config.ts +22 -0
  2. package/package.json +1 -1
package/next.config.ts CHANGED
@@ -48,6 +48,7 @@ function getRemoteImageHosts(): string[] {
48
48
  );
49
49
  }
50
50
 
51
+
51
52
  // --- Tenant Override Resolution ---
52
53
  // When running via @alphasquad/create-saleor-storefront CLI wrapper,
53
54
  // process.cwd() is the tenant root. The tenant can place override components
@@ -60,10 +61,31 @@ const hasTenantOverrides =
60
61
  fs.existsSync(tenantOverridesIndex.replace(".ts", ".tsx")) ||
61
62
  fs.existsSync(tenantOverridesIndex.replace(".ts", ".js"));
62
63
 
64
+ // Create symlink for Turbopack to access tenant overrides outside project root
65
+ const templateSrcDir = path.join(__dirname, "src");
66
+ const tenantSymlinkPath = path.join(templateSrcDir, "tenant-overrides");
67
+ if (hasTenantOverrides && !fs.existsSync(tenantSymlinkPath)) {
68
+ try {
69
+ fs.symlinkSync(tenantOverridesDir, tenantSymlinkPath, "dir");
70
+ } catch (e) {
71
+ console.error("Error creating tenant overrides symlink:", e);
72
+ // Symlink may already exist or permission denied
73
+ }
74
+ }
75
+
63
76
  const nextConfig: NextConfig = {
64
77
  // Next.js skips tsconfig path resolution for files inside node_modules.
65
78
  // When this template is consumed as a package, we need explicit aliases.
66
79
  transpilePackages: ["@alphasquad/saleor-template-advance"],
80
+ turbopack: {
81
+ resolveAlias: {
82
+ "@": path.resolve(__dirname, "src"),
83
+ // Use symlink for tenant overrides, falls back to defaults
84
+ "@tenant-overrides": hasTenantOverrides
85
+ ? "@/tenant-overrides"
86
+ : "@/lib/overrides/defaults",
87
+ },
88
+ },
67
89
  webpack(config) {
68
90
  config.resolve.alias["@"] = path.resolve(__dirname, "src");
69
91
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphasquad/saleor-template-advance",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "scripts": {
5
5
  "dev": "next dev --turbopack",
6
6
  "build": "next build",