@graphcommerce/next-config 9.0.0-canary.105 → 9.0.0-canary.107

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.
@@ -0,0 +1,293 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.copyFiles = copyFiles;
7
+ /* eslint-disable no-await-in-loop */
8
+ const promises_1 = __importDefault(require("fs/promises"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const fast_glob_1 = __importDefault(require("fast-glob"));
11
+ const resolveDependenciesSync_1 = require("../utils/resolveDependenciesSync");
12
+ // Add debug logging helper
13
+ const debug = (...args) => {
14
+ if (process.env.DEBUG)
15
+ console.log('[copy-files]', ...args);
16
+ };
17
+ // Add constants for the magic comments
18
+ const MANAGED_BY_GC = '// managed by: graphcommerce';
19
+ const MANAGED_LOCALLY = '// managed by: local';
20
+ const GITIGNORE_SECTION_START = '# managed by: graphcommerce';
21
+ const GITIGNORE_SECTION_END = '# end managed by: graphcommerce';
22
+ /**
23
+ * Updates the .gitignore file with a list of GraphCommerce managed files
24
+ *
25
+ * - Removes any existing GraphCommerce managed files section
26
+ * - If managedFiles is not empty, adds a new section with the files
27
+ * - If managedFiles is empty, just cleans up the existing section
28
+ * - Ensures the file ends with a newline
29
+ */
30
+ async function updateGitignore(managedFiles) {
31
+ const gitignorePath = path_1.default.join(process.cwd(), '.gitignore');
32
+ let content;
33
+ try {
34
+ content = await promises_1.default.readFile(gitignorePath, 'utf-8');
35
+ debug('Reading existing .gitignore');
36
+ }
37
+ catch (err) {
38
+ debug('.gitignore not found, creating new file');
39
+ content = '';
40
+ }
41
+ // Remove existing GraphCommerce section if it exists
42
+ const sectionRegex = new RegExp(`${GITIGNORE_SECTION_START}[\\s\\S]*?${GITIGNORE_SECTION_END}\\n?`, 'g');
43
+ content = content.replace(sectionRegex, '');
44
+ // Only add new section if there are files to manage
45
+ if (managedFiles.length > 0) {
46
+ const newSection = [
47
+ GITIGNORE_SECTION_START,
48
+ ...managedFiles.sort(),
49
+ GITIGNORE_SECTION_END,
50
+ '', // Empty line at the end
51
+ ].join('\n');
52
+ // Append the new section
53
+ content = `${content.trim()}\n\n${newSection}`;
54
+ debug(`Updated .gitignore with ${managedFiles.length} managed files`);
55
+ }
56
+ else {
57
+ content = `${content.trim()}\n`;
58
+ debug('Cleaned up .gitignore managed section');
59
+ }
60
+ await promises_1.default.writeFile(gitignorePath, content);
61
+ }
62
+ /** Determines how a file should be managed based on its content */
63
+ function getFileManagement(content) {
64
+ if (!content)
65
+ return 'graphcommerce';
66
+ const contentStr = content.toString();
67
+ if (contentStr.startsWith(MANAGED_LOCALLY))
68
+ return 'local';
69
+ if (contentStr.startsWith(MANAGED_BY_GC))
70
+ return 'graphcommerce';
71
+ return 'unmanaged';
72
+ }
73
+ /**
74
+ * The packages are @graphcommerce/* packages and have special treatment.
75
+ *
76
+ * 1. Glob the `copy/**` directory for each package and generate a list of files that need to be
77
+ * copied. Error if a file with the same path exists in another package.
78
+ * 2. Copy the files to the project directory (cwd).
79
+ *
80
+ * 1. If the file doesn't exist: Create directories and the file with "managed by: graphcommerce"
81
+ * 2. If the file exists and starts with "managed by: local": Skip the file
82
+ * 3. If the file exists but doesn't have a management comment: Suggest adding "managed by: local"
83
+ * 4. If the file is managed by graphcommerce: Update if content differs
84
+ */
85
+ async function copyFiles() {
86
+ const startTime = performance.now();
87
+ debug('Starting copyFiles');
88
+ const cwd = process.cwd();
89
+ const deps = (0, resolveDependenciesSync_1.resolveDependenciesSync)();
90
+ const packages = [...deps.values()].filter((p) => p !== '.');
91
+ // Track files and their source packages to detect conflicts
92
+ const fileMap = new Map();
93
+ const managedFiles = new Set();
94
+ const existingManagedFiles = new Set();
95
+ // First scan existing files to find GraphCommerce managed ones
96
+ const scanStart = performance.now();
97
+ try {
98
+ // Use only default patterns for testing
99
+ const gitignorePatterns = [
100
+ '**/dist/**',
101
+ '**/build/**',
102
+ '**/.next/**',
103
+ '**/.git/**',
104
+ '**/node_modules/**',
105
+ ];
106
+ const allFiles = await (0, fast_glob_1.default)('**/*', {
107
+ cwd,
108
+ dot: true,
109
+ ignore: gitignorePatterns,
110
+ onlyFiles: true,
111
+ });
112
+ debug(`Found ${allFiles.length} project files in ${(performance.now() - scanStart).toFixed(0)}ms`);
113
+ const readStart = performance.now();
114
+ await Promise.all(allFiles.map(async (file) => {
115
+ const filePath = path_1.default.join(cwd, file);
116
+ try {
117
+ const content = await promises_1.default.readFile(filePath);
118
+ if (getFileManagement(content) === 'graphcommerce') {
119
+ existingManagedFiles.add(file);
120
+ debug(`Found existing managed file: ${file}`);
121
+ }
122
+ }
123
+ catch (err) {
124
+ debug(`Error reading file ${file}:`, err);
125
+ }
126
+ }));
127
+ debug(`Read ${existingManagedFiles.size} managed files in ${(performance.now() - readStart).toFixed(0)}ms`);
128
+ }
129
+ catch (err) {
130
+ debug('Error scanning project files:', err);
131
+ }
132
+ // First pass: collect all files and check for conflicts
133
+ const collectStart = performance.now();
134
+ await Promise.all(packages.map(async (pkg) => {
135
+ const copyDir = path_1.default.join(pkg, 'copy');
136
+ try {
137
+ const files = await (0, fast_glob_1.default)('**/*', { cwd: copyDir, dot: true, suppressErrors: true });
138
+ if (files.length > 0) {
139
+ debug(`Found files in ${pkg}:`, files);
140
+ for (const file of files) {
141
+ const sourcePath = path_1.default.join(copyDir, file);
142
+ const existing = fileMap.get(file);
143
+ if (existing) {
144
+ console.error(`Error: File conflict detected for '${file}'
145
+ Found in packages:
146
+ - ${existing.packagePath} -> ${existing.sourcePath}
147
+ - ${pkg} -> ${sourcePath}`);
148
+ process.exit(1);
149
+ }
150
+ fileMap.set(file, { sourcePath, packagePath: pkg });
151
+ }
152
+ }
153
+ }
154
+ catch (err) {
155
+ if (err.code === 'ENOENT')
156
+ return;
157
+ console.error(`Error scanning directory ${copyDir}: ${err.message}\nPath: ${copyDir}`);
158
+ process.exit(1);
159
+ }
160
+ }));
161
+ debug(`Collected ${fileMap.size} files in ${(performance.now() - collectStart).toFixed(0)}ms`);
162
+ // Second pass: copy files and handle removals
163
+ const copyStart = performance.now();
164
+ await Promise.all(Array.from(fileMap.entries()).map(async ([file, { sourcePath }]) => {
165
+ const targetPath = path_1.default.join(cwd, file);
166
+ debug(`Processing file: ${file}`);
167
+ try {
168
+ await promises_1.default.mkdir(path_1.default.dirname(targetPath), { recursive: true });
169
+ const sourceContent = await promises_1.default.readFile(sourcePath);
170
+ const contentWithComment = Buffer.concat([
171
+ Buffer.from(`${MANAGED_BY_GC}\n// to modify this file, change it to managed by: local\n\n`),
172
+ sourceContent,
173
+ ]);
174
+ let targetContent;
175
+ try {
176
+ targetContent = await promises_1.default.readFile(targetPath);
177
+ const management = getFileManagement(targetContent);
178
+ if (management === 'local') {
179
+ debug(`File ${file} is managed locally, skipping`);
180
+ return;
181
+ }
182
+ if (management === 'unmanaged') {
183
+ console.log(`Note: File ${file} has been modified. Add '${MANAGED_LOCALLY.trim()}' at the top to manage it locally.`);
184
+ debug(`File ${file} doesn't have management comment, skipping`);
185
+ return;
186
+ }
187
+ debug(`File ${file} is managed by graphcommerce, will update if needed`);
188
+ }
189
+ catch (err) {
190
+ if (err.code !== 'ENOENT') {
191
+ console.error(`Error reading file ${file}: ${err.message}
192
+ Source: ${sourcePath}`);
193
+ process.exit(1);
194
+ }
195
+ console.log(`Creating new file: ${file}
196
+ Source: ${sourcePath}`);
197
+ debug('File does not exist yet');
198
+ }
199
+ // Skip if content is identical (including magic comment)
200
+ if (targetContent && Buffer.compare(contentWithComment, targetContent) === 0) {
201
+ debug(`File ${file} content is identical to source, skipping`);
202
+ managedFiles.add(file);
203
+ return;
204
+ }
205
+ // Copy the file with magic comment
206
+ await promises_1.default.writeFile(targetPath, contentWithComment);
207
+ if (targetContent) {
208
+ console.log(`Updated managed file: ${file}`);
209
+ debug(`Overwrote existing file: ${file}`);
210
+ }
211
+ // If the file is managed by GraphCommerce (new or updated), add it to managedFiles
212
+ if (!targetContent || targetContent.toString().startsWith(MANAGED_BY_GC)) {
213
+ managedFiles.add(file);
214
+ debug('Added managed file:', file);
215
+ }
216
+ }
217
+ catch (err) {
218
+ console.error(`Error copying file ${file}: ${err.message}
219
+ Source: ${sourcePath}`);
220
+ process.exit(1);
221
+ }
222
+ }));
223
+ debug(`Copied ${managedFiles.size} files in ${(performance.now() - copyStart).toFixed(0)}ms`);
224
+ // Remove files that are no longer provided
225
+ const removeStart = performance.now();
226
+ const filesToRemove = Array.from(existingManagedFiles).filter((file) => !managedFiles.has(file));
227
+ debug(`Files to remove: ${filesToRemove.length}`);
228
+ // Helper function to recursively clean up empty directories
229
+ async function cleanupEmptyDirs(startPath) {
230
+ let currentDir = startPath;
231
+ while (currentDir !== cwd) {
232
+ try {
233
+ const dirContents = await promises_1.default.readdir(currentDir);
234
+ if (dirContents.length === 0) {
235
+ await promises_1.default.rmdir(currentDir);
236
+ debug(`Removed empty directory: ${currentDir}`);
237
+ currentDir = path_1.default.dirname(currentDir);
238
+ }
239
+ else {
240
+ break; // Stop if directory is not empty
241
+ }
242
+ }
243
+ catch (err) {
244
+ if (err.code === 'EACCES') {
245
+ console.error(`Error cleaning up directory ${currentDir}: ${err.message}`);
246
+ process.exit(1);
247
+ }
248
+ break; // Stop on other errors (like ENOENT)
249
+ }
250
+ }
251
+ }
252
+ // Process file removals in parallel
253
+ await Promise.all(filesToRemove.map(async (file) => {
254
+ const filePath = path_1.default.join(cwd, file);
255
+ const dirPath = path_1.default.dirname(filePath);
256
+ try {
257
+ // First check if the directory exists and is accessible
258
+ await promises_1.default.readdir(dirPath);
259
+ // Then try to remove the file
260
+ try {
261
+ await promises_1.default.unlink(filePath);
262
+ console.log(`Removed managed file: ${file}`);
263
+ debug(`Removed file: ${file}`);
264
+ }
265
+ catch (err) {
266
+ if (err.code !== 'ENOENT') {
267
+ console.error(`Error removing file ${file}: ${err.message}`);
268
+ process.exit(1);
269
+ }
270
+ }
271
+ // Finally, try to clean up empty directories
272
+ await cleanupEmptyDirs(dirPath);
273
+ }
274
+ catch (err) {
275
+ if (err.code === 'EACCES') {
276
+ console.error(`Error accessing directory ${dirPath}: ${err.message}`);
277
+ process.exit(1);
278
+ }
279
+ // Ignore ENOENT errors for directories that don't exist
280
+ }
281
+ }));
282
+ debug(`Removed files in ${(performance.now() - removeStart).toFixed(0)}ms`);
283
+ // Update .gitignore with current list of managed files
284
+ if (managedFiles.size > 0) {
285
+ debug('Found managed files:', Array.from(managedFiles));
286
+ await updateGitignore(Array.from(managedFiles));
287
+ }
288
+ else {
289
+ debug('No managed files found, cleaning up .gitignore section');
290
+ await updateGitignore([]);
291
+ }
292
+ debug(`Total execution time: ${(performance.now() - startTime).toFixed(0)}ms`);
293
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const promises_1 = __importDefault(require("fs/promises"));
7
+ // ... earlier code remains the same ...
8
+ try {
9
+ targetContent = await promises_1.default.readFile(targetPath);
10
+ }
11
+ catch (err) {
12
+ if (err.code !== 'ENOENT')
13
+ throw err;
14
+ // File doesn't exist, log that we're creating it
15
+ console.log(`Creating new file: ${file}`);
16
+ }
17
+ // Skip if content is identical
18
+ if (targetContent && Buffer.compare(sourceContent, targetContent) === 0)
19
+ return;
20
+ // ... rest of the code remains the same ...
@@ -155,7 +155,7 @@ function formatAppliedEnv(applyResult) {
155
155
  const lines = applyResult.map(({ from, to, envValue, envVar, dotVar, error, warning }) => {
156
156
  const fromFmt = chalk_1.default.red(JSON.stringify(from));
157
157
  const toFmt = chalk_1.default.green(JSON.stringify(to));
158
- const envVariableFmt = `${envVar}='${envValue}'`;
158
+ const envVariableFmt = `${envVar}`;
159
159
  const dotVariableFmt = chalk_1.default.bold.underline(`${dotVar}`);
160
160
  const baseLog = `${envVariableFmt} => ${dotVariableFmt}`;
161
161
  if (error) {
@@ -169,12 +169,12 @@ function formatAppliedEnv(applyResult) {
169
169
  if (!dotVar)
170
170
  return chalk_1.default.red(`${envVariableFmt} => ignored (no matching config)`);
171
171
  if (from === undefined && to === undefined)
172
- return ` = ${baseLog}: (ignored, no change/wrong format)`;
172
+ return ` = ${baseLog}: (ignored)`;
173
173
  if (from === undefined && to !== undefined)
174
- return ` ${chalk_1.default.green('+')} ${baseLog}: ${toFmt}`;
174
+ return ` ${chalk_1.default.green('+')} ${baseLog}`;
175
175
  if (from !== undefined && to === undefined)
176
- return ` ${chalk_1.default.red('-')} ${baseLog}: ${fromFmt}`;
177
- return ` ${chalk_1.default.yellowBright('~')} ${baseLog}: ${fromFmt} => ${toFmt}`;
176
+ return ` ${chalk_1.default.red('-')} ${baseLog}`;
177
+ return ` ${chalk_1.default.yellowBright('~')} ${baseLog}`;
178
178
  });
179
179
  let header = chalk_1.default.blueBright('info');
180
180
  if (hasWarning)
@@ -4,6 +4,7 @@ exports.WebsitePermissionsSchema = exports.SidebarGalleryPaginationVariantSchema
4
4
  exports.DatalayerConfigSchema = DatalayerConfigSchema;
5
5
  exports.GraphCommerceConfigSchema = GraphCommerceConfigSchema;
6
6
  exports.GraphCommerceDebugConfigSchema = GraphCommerceDebugConfigSchema;
7
+ exports.GraphCommerceGooglePlaystoreConfigSchema = GraphCommerceGooglePlaystoreConfigSchema;
7
8
  exports.GraphCommercePermissionsSchema = GraphCommercePermissionsSchema;
8
9
  exports.GraphCommerceStorefrontConfigSchema = GraphCommerceStorefrontConfigSchema;
9
10
  exports.MagentoConfigurableVariantValuesSchema = MagentoConfigurableVariantValuesSchema;
@@ -46,6 +47,7 @@ function GraphCommerceConfigSchema() {
46
47
  demoMode: zod_1.z.boolean().default(true).nullish(),
47
48
  enableGuestCheckoutLogin: zod_1.z.boolean().nullish(),
48
49
  googleAnalyticsId: zod_1.z.string().nullish(),
50
+ googlePlaystore: GraphCommerceGooglePlaystoreConfigSchema().nullish(),
49
51
  googleRecaptchaKey: zod_1.z.string().nullish(),
50
52
  googleTagmanagerId: zod_1.z.string().nullish(),
51
53
  hygraphEndpoint: zod_1.z.string().min(1),
@@ -77,6 +79,12 @@ function GraphCommerceDebugConfigSchema() {
77
79
  webpackDuplicatesPlugin: zod_1.z.boolean().nullish()
78
80
  });
79
81
  }
82
+ function GraphCommerceGooglePlaystoreConfigSchema() {
83
+ return zod_1.z.object({
84
+ packageName: zod_1.z.string().min(1),
85
+ sha256CertificateFingerprint: zod_1.z.string().min(1)
86
+ });
87
+ }
80
88
  function GraphCommercePermissionsSchema() {
81
89
  return zod_1.z.object({
82
90
  cart: exports.CartPermissionsSchema.nullish(),
package/dist/index.js CHANGED
@@ -17,8 +17,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./utils/isMonorepo"), exports);
18
18
  __exportStar(require("./utils/resolveDependenciesSync"), exports);
19
19
  __exportStar(require("./utils/packageRoots"), exports);
20
+ __exportStar(require("./utils/sig"), exports);
20
21
  __exportStar(require("./withGraphCommerce"), exports);
21
22
  __exportStar(require("./generated/config"), exports);
22
23
  __exportStar(require("./config"), exports);
23
24
  __exportStar(require("./runtimeCachingOptimizations"), exports);
24
25
  __exportStar(require("./interceptors/commands/codegenInterceptors"), exports);
26
+ __exportStar(require("./commands/copyFiles"), exports);
27
+ __exportStar(require("./commands/codegen"), exports);
@@ -41,8 +41,8 @@ function isReplacePluginConfig(plugin) {
41
41
  function isPluginConfig(plugin) {
42
42
  return isPluginBaseConfig(plugin);
43
43
  }
44
- exports.SOURCE_START = '/** Original source starts here (do not modify!): **/';
45
- exports.SOURCE_END = '/** Original source ends here (do not modify!) **/';
44
+ exports.SOURCE_START = '/** SOURCE_START */';
45
+ exports.SOURCE_END = '/** SOURCE_END */';
46
46
  const originalSuffix = 'Original';
47
47
  const interceptorSuffix = 'Interceptor';
48
48
  const disabledSuffix = 'Disabled';
@@ -68,9 +68,7 @@ const generateIdentifyer = (s) => Math.abs(s.split('').reduce((a, b) => {
68
68
  // eslint-disable-next-line no-bitwise
69
69
  return a & a;
70
70
  }, 0)).toString();
71
- /**
72
- * The is on the first line, with the format: \/* hash:${identifer} *\/
73
- */
71
+ /** The is on the first line, with the format: /* hash:${identifer} */
74
72
  function extractIdentifier(source) {
75
73
  if (!source)
76
74
  return null;
@@ -8,12 +8,14 @@ exports.resolveDependenciesSync = resolveDependenciesSync;
8
8
  const node_fs_1 = __importDefault(require("node:fs"));
9
9
  const node_path_1 = __importDefault(require("node:path"));
10
10
  const PackagesSort_1 = require("./PackagesSort");
11
+ const sig_1 = require("./sig");
11
12
  const resolveCache = new Map();
12
13
  function resolveRecursivePackageJson(dependencyPath, dependencyStructure, root, additionalDependencies = []) {
13
14
  const isRoot = dependencyPath === root;
14
15
  const fileName = require.resolve(node_path_1.default.join(dependencyPath, 'package.json'));
15
16
  const packageJsonFile = node_fs_1.default.readFileSync(fileName, 'utf-8').toString();
16
17
  const packageJson = JSON.parse(packageJsonFile);
18
+ const e = [atob('QGdyYXBoY29tbWVyY2UvYWRvYmUtY29tbWVyY2U=')].filter((n) => !globalThis.gcl ? true : !globalThis.gcl.includes(n));
17
19
  if (!packageJson.name)
18
20
  throw Error(`Package ${packageJsonFile} does not have a name field`);
19
21
  // Previously processed
@@ -29,7 +31,9 @@ function resolveRecursivePackageJson(dependencyPath, dependencyStructure, root,
29
31
  ...Object.keys(packageJson.devDependencies ?? []),
30
32
  ...additionalDependencies,
31
33
  ...Object.keys(packageJson.peerDependencies ?? {}),
32
- ].filter((name) => name.includes('graphcommerce'))),
34
+ ].filter((name) => name.includes('graphcommerce')
35
+ ? !(e.length >= 0 && e.some((v) => name.startsWith(v)))
36
+ : false)),
33
37
  ];
34
38
  const name = isRoot ? '.' : packageJson.name;
35
39
  dependencyStructure[name] = {
@@ -66,6 +70,7 @@ function resolveDependenciesSync(root = process.cwd()) {
66
70
  const cached = resolveCache.get(root);
67
71
  if (cached)
68
72
  return cached;
73
+ (0, sig_1.sig)();
69
74
  const dependencyStructure = resolveRecursivePackageJson(root, {}, root, process.env.PRIVATE_ADDITIONAL_DEPENDENCIES?.split(',') ?? []);
70
75
  const sorted = sortDependencies(dependencyStructure);
71
76
  resolveCache.set(root, sorted);
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.g = g;
7
+ exports.sig = sig;
8
+ // import necessary modules
9
+ const crypto_1 = __importDefault(require("crypto"));
10
+ // Function to generate a license key based on input data
11
+ function g(data) {
12
+ const iv = crypto_1.default.randomBytes(16); // Initialization vector
13
+ const cipher = crypto_1.default.createCipheriv('aes-256-cbc', 'BbcFEkUydGw3nE9ZPm7gbxTIIBQ9IiKN', iv);
14
+ let encrypted = cipher.update(JSON.stringify(data), 'utf-8', 'hex');
15
+ encrypted += cipher.final('hex');
16
+ // Return the IV and the encrypted data as a single string, encoded in base64
17
+ return Buffer.from(`${iv.toString('hex')}:${encrypted}`).toString();
18
+ }
19
+ // Function to validate and decode the license key
20
+ function sig() {
21
+ const l = process.env[atob('R0NfTElDRU5TRQ==')];
22
+ if (!l)
23
+ return;
24
+ if (!globalThis.gcl)
25
+ try {
26
+ const decipher = crypto_1.default.createDecipheriv('aes-256-cbc', 'BbcFEkUydGw3nE9ZPm7gbxTIIBQ9IiKN', Buffer.from(l.split(':')[0], 'hex'));
27
+ let decrypted = decipher.update(l.split(':')[1], 'hex', 'utf-8');
28
+ decrypted += decipher.final('utf-8');
29
+ globalThis.gcl = JSON.parse(decrypted); // Parse and return the decoded data
30
+ }
31
+ catch (error) {
32
+ // Silent
33
+ }
34
+ }
@@ -41,10 +41,10 @@ function withGraphCommerce(nextConfig, cwd) {
41
41
  ];
42
42
  return {
43
43
  ...nextConfig,
44
+ bundlePagesRouterDependencies: true,
44
45
  experimental: {
45
46
  ...nextConfig.experimental,
46
47
  scrollRestoration: true,
47
- bundlePagesExternals: true,
48
48
  swcPlugins: [...(nextConfig.experimental?.swcPlugins ?? []), ['@lingui/swc-plugin', {}]],
49
49
  },
50
50
  i18n: {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/next-config",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "9.0.0-canary.105",
5
+ "version": "9.0.0-canary.107",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",
8
8
  "types": "src/index.ts",
@@ -13,23 +13,24 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "@graphql-mesh/cli": "latest",
16
- "@lingui/loader": "4.11.4",
17
- "@lingui/macro": "4.11.4",
18
- "@lingui/react": "4.11.4",
19
- "@lingui/swc-plugin": "4.0.8",
20
- "@swc/core": "1.7.26",
21
- "@swc/wasm-web": "^1.7.28",
16
+ "@lingui/loader": "4.14.0",
17
+ "@lingui/macro": "4.14.0",
18
+ "@lingui/react": "4.14.0",
19
+ "@lingui/swc-plugin": "4.1.0",
20
+ "@swc/core": "1.9.3",
21
+ "@swc/wasm-web": "^1.9.3",
22
22
  "@types/circular-dependency-plugin": "^5.0.8",
23
- "@types/lodash": "^4.17.10",
23
+ "@types/lodash": "^4.17.13",
24
24
  "babel-plugin-macros": "^3.1.0",
25
25
  "circular-dependency-plugin": "^5.2.2",
26
+ "fast-glob": "^3.3.2",
26
27
  "glob": "^10.4.5",
27
28
  "graphql": "^16",
28
29
  "inspectpack": "^4.7.1",
29
30
  "js-yaml-loader": "^1.2.2",
30
31
  "lodash": "^4.17.21",
31
32
  "react": "^18.3.1",
32
- "typescript": "5.6.2",
33
+ "typescript": "5.7.2",
33
34
  "webpack": "^5.96.1",
34
35
  "znv": "^0.4.0",
35
36
  "zod": "^3.23.8"
@@ -0,0 +1,18 @@
1
+ import { generateConfig } from '../config/commands/generateConfig'
2
+ import { codegenInterceptors } from '../interceptors/commands/codegenInterceptors'
3
+ import { copyFiles } from './copyFiles'
4
+
5
+ /** Run all code generation steps in sequence */
6
+ export async function codegen() {
7
+ // Copy files from packages to project
8
+ console.log('🔄 Copying files from packages to project...')
9
+ await copyFiles()
10
+
11
+ // Generate GraphCommerce config types
12
+ console.log('⚙️ Generating GraphCommerce config types...')
13
+ await generateConfig()
14
+
15
+ // Generate interceptors
16
+ console.log('🔌 Generating interceptors...')
17
+ await codegenInterceptors()
18
+ }