@graphcommerce/next-config 9.0.0-canary.106 → 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.
- package/CHANGELOG.md +2 -0
- package/__tests__/commands/copyFiles.ts +512 -0
- package/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap +3 -0
- package/__tests__/config/utils/mergeEnvIntoConfig.ts +4 -17
- package/__tests__/config/utils/rewriteLegancyEnv.ts +30 -35
- package/__tests__/interceptors/findPlugins.ts +38 -53
- package/__tests__/interceptors/generateInterceptors.ts +23 -74
- package/__tests__/utils/resolveDependenciesSync.ts +9 -9
- package/dist/commands/copyFiles.js +132 -40
- package/dist/config/utils/mergeEnvIntoConfig.js +5 -5
- package/dist/generated/config.js +8 -0
- package/dist/interceptors/generateInterceptor.js +3 -5
- package/dist/withGraphCommerce.js +1 -1
- package/package.json +2 -1
- package/src/commands/copyFiles.ts +147 -45
- package/src/config/utils/mergeEnvIntoConfig.ts +6 -7
- package/src/generated/config.ts +18 -0
- package/src/interceptors/generateInterceptor.ts +3 -5
- package/src/withGraphCommerce.ts +1 -1
|
@@ -5,6 +5,7 @@ import { get, set } from 'lodash'
|
|
|
5
5
|
import snakeCase from 'lodash/snakeCase'
|
|
6
6
|
import type { ZodAny, ZodRawShape, ZodTypeAny } from 'zod'
|
|
7
7
|
import {
|
|
8
|
+
z,
|
|
8
9
|
ZodArray,
|
|
9
10
|
ZodBoolean,
|
|
10
11
|
ZodDefault,
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
ZodObject,
|
|
16
17
|
ZodOptional,
|
|
17
18
|
ZodString,
|
|
18
|
-
z,
|
|
19
19
|
} from 'zod'
|
|
20
20
|
import diff from './diff'
|
|
21
21
|
|
|
@@ -207,7 +207,7 @@ export function formatAppliedEnv(applyResult: ApplyResult) {
|
|
|
207
207
|
const lines = applyResult.map(({ from, to, envValue, envVar, dotVar, error, warning }) => {
|
|
208
208
|
const fromFmt = chalk.red(JSON.stringify(from))
|
|
209
209
|
const toFmt = chalk.green(JSON.stringify(to))
|
|
210
|
-
const envVariableFmt = `${envVar}
|
|
210
|
+
const envVariableFmt = `${envVar}`
|
|
211
211
|
const dotVariableFmt = chalk.bold.underline(`${dotVar}`)
|
|
212
212
|
|
|
213
213
|
const baseLog = `${envVariableFmt} => ${dotVariableFmt}`
|
|
@@ -223,11 +223,10 @@ export function formatAppliedEnv(applyResult: ApplyResult) {
|
|
|
223
223
|
|
|
224
224
|
if (!dotVar) return chalk.red(`${envVariableFmt} => ignored (no matching config)`)
|
|
225
225
|
|
|
226
|
-
if (from === undefined && to === undefined)
|
|
227
|
-
|
|
228
|
-
if (from
|
|
229
|
-
|
|
230
|
-
return ` ${chalk.yellowBright('~')} ${baseLog}: ${fromFmt} => ${toFmt}`
|
|
226
|
+
if (from === undefined && to === undefined) return ` = ${baseLog}: (ignored)`
|
|
227
|
+
if (from === undefined && to !== undefined) return ` ${chalk.green('+')} ${baseLog}`
|
|
228
|
+
if (from !== undefined && to === undefined) return ` ${chalk.red('-')} ${baseLog}`
|
|
229
|
+
return ` ${chalk.yellowBright('~')} ${baseLog}`
|
|
231
230
|
})
|
|
232
231
|
|
|
233
232
|
let header = chalk.blueBright('info')
|
package/src/generated/config.ts
CHANGED
|
@@ -215,6 +215,8 @@ export type GraphCommerceConfig = {
|
|
|
215
215
|
* To override the value for a specific locale, configure in i18n config.
|
|
216
216
|
*/
|
|
217
217
|
googleAnalyticsId?: InputMaybe<Scalars['String']['input']>;
|
|
218
|
+
/** To create an assetlinks.json file for the Android app. */
|
|
219
|
+
googlePlaystore?: InputMaybe<GraphCommerceGooglePlaystoreConfig>;
|
|
218
220
|
/**
|
|
219
221
|
* Google reCAPTCHA site key.
|
|
220
222
|
* When using reCAPTCHA, this value is required, even if you are configuring different values for each locale.
|
|
@@ -369,6 +371,14 @@ export type GraphCommerceDebugConfig = {
|
|
|
369
371
|
webpackDuplicatesPlugin?: InputMaybe<Scalars['Boolean']['input']>;
|
|
370
372
|
};
|
|
371
373
|
|
|
374
|
+
/** See https://developer.android.com/training/app-links/verify-android-applinks#web-assoc */
|
|
375
|
+
export type GraphCommerceGooglePlaystoreConfig = {
|
|
376
|
+
/** The package name of the Android app. */
|
|
377
|
+
packageName: Scalars['String']['input'];
|
|
378
|
+
/** The sha256 certificate fingerprint of the Android app. */
|
|
379
|
+
sha256CertificateFingerprint: Scalars['String']['input'];
|
|
380
|
+
};
|
|
381
|
+
|
|
372
382
|
/** Permissions input */
|
|
373
383
|
export type GraphCommercePermissions = {
|
|
374
384
|
/** Changes the availability of the add to cart buttons and the cart page to either customer only or completely disables it. */
|
|
@@ -546,6 +556,7 @@ export function GraphCommerceConfigSchema(): z.ZodObject<Properties<GraphCommerc
|
|
|
546
556
|
demoMode: z.boolean().default(true).nullish(),
|
|
547
557
|
enableGuestCheckoutLogin: z.boolean().nullish(),
|
|
548
558
|
googleAnalyticsId: z.string().nullish(),
|
|
559
|
+
googlePlaystore: GraphCommerceGooglePlaystoreConfigSchema().nullish(),
|
|
549
560
|
googleRecaptchaKey: z.string().nullish(),
|
|
550
561
|
googleTagmanagerId: z.string().nullish(),
|
|
551
562
|
hygraphEndpoint: z.string().min(1),
|
|
@@ -579,6 +590,13 @@ export function GraphCommerceDebugConfigSchema(): z.ZodObject<Properties<GraphCo
|
|
|
579
590
|
})
|
|
580
591
|
}
|
|
581
592
|
|
|
593
|
+
export function GraphCommerceGooglePlaystoreConfigSchema(): z.ZodObject<Properties<GraphCommerceGooglePlaystoreConfig>> {
|
|
594
|
+
return z.object({
|
|
595
|
+
packageName: z.string().min(1),
|
|
596
|
+
sha256CertificateFingerprint: z.string().min(1)
|
|
597
|
+
})
|
|
598
|
+
}
|
|
599
|
+
|
|
582
600
|
export function GraphCommercePermissionsSchema(): z.ZodObject<Properties<GraphCommercePermissions>> {
|
|
583
601
|
return z.object({
|
|
584
602
|
cart: CartPermissionsSchema.nullish(),
|
|
@@ -67,8 +67,8 @@ export type Interceptor = ResolveDependencyReturn & {
|
|
|
67
67
|
|
|
68
68
|
export type MaterializedPlugin = Interceptor & { template: string }
|
|
69
69
|
|
|
70
|
-
export const SOURCE_START = '/**
|
|
71
|
-
export const SOURCE_END = '/**
|
|
70
|
+
export const SOURCE_START = '/** SOURCE_START */'
|
|
71
|
+
export const SOURCE_END = '/** SOURCE_END */'
|
|
72
72
|
|
|
73
73
|
const originalSuffix = 'Original'
|
|
74
74
|
const interceptorSuffix = 'Interceptor'
|
|
@@ -103,9 +103,7 @@ const generateIdentifyer = (s: string) =>
|
|
|
103
103
|
}, 0),
|
|
104
104
|
).toString()
|
|
105
105
|
|
|
106
|
-
/**
|
|
107
|
-
* The is on the first line, with the format: \/* hash:${identifer} *\/
|
|
108
|
-
*/
|
|
106
|
+
/** The is on the first line, with the format: /* hash:${identifer} */
|
|
109
107
|
function extractIdentifier(source: string | undefined) {
|
|
110
108
|
if (!source) return null
|
|
111
109
|
const match = source.match(/\/\* hash:(\d+) \*\//)
|
package/src/withGraphCommerce.ts
CHANGED
|
@@ -54,10 +54,10 @@ export function withGraphCommerce(nextConfig: NextConfig, cwd: string): NextConf
|
|
|
54
54
|
|
|
55
55
|
return {
|
|
56
56
|
...nextConfig,
|
|
57
|
+
bundlePagesRouterDependencies: true,
|
|
57
58
|
experimental: {
|
|
58
59
|
...nextConfig.experimental,
|
|
59
60
|
scrollRestoration: true,
|
|
60
|
-
bundlePagesExternals: true,
|
|
61
61
|
swcPlugins: [...(nextConfig.experimental?.swcPlugins ?? []), ['@lingui/swc-plugin', {}]],
|
|
62
62
|
},
|
|
63
63
|
i18n: {
|