@graphcommerce/next-config 9.0.4-canary.0 → 9.0.4-canary.10
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 +28 -8
- package/__tests__/commands/copyFiles.ts +8 -5
- package/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap +0 -905
- package/__tests__/config/utils/mergeEnvIntoConfig.ts +21 -3
- package/__tests__/config/utils/replaceConfigInString.ts +0 -1
- package/__tests__/interceptors/findPlugins.ts +270 -272
- package/__tests__/interceptors/generateInterceptors.ts +1 -0
- package/__tests__/utils/resolveDependenciesSync.ts +45 -44
- package/dist/generated/config.js +110 -116
- package/dist/index.js +3359 -26
- package/package.json +34 -8
- package/src/commands/codegen.ts +3 -3
- package/src/commands/copyFiles.ts +14 -7
- package/src/config/commands/generateConfig.ts +17 -6
- package/src/config/demoConfig.ts +0 -1
- package/src/config/loadConfig.ts +3 -9
- package/src/config/utils/mergeEnvIntoConfig.ts +9 -9
- package/src/generated/config.ts +305 -245
- package/src/interceptors/Visitor.ts +1 -1
- package/src/interceptors/findOriginalSource.ts +1 -1
- package/src/interceptors/generateInterceptor.ts +0 -2
- package/src/interceptors/parseStructure.ts +3 -3
- package/src/interceptors/writeInterceptors.ts +1 -1
- package/src/utils/resolveDependenciesSync.ts +44 -7
- package/src/withGraphCommerce.ts +30 -42
- package/tsconfig.json +1 -1
- package/__tests__/config/utils/rewriteLegancyEnv.ts +0 -78
- package/dist/commands/codegen.js +0 -18
- package/dist/commands/copyFiles.js +0 -292
- package/dist/config/commands/exportConfig.js +0 -16
- package/dist/config/commands/generateConfig.js +0 -57
- package/dist/config/demoConfig.js +0 -52
- package/dist/config/index.js +0 -19
- package/dist/config/loadConfig.js +0 -62
- package/dist/config/utils/configToImportMeta.js +0 -39
- package/dist/config/utils/diff.js +0 -33
- package/dist/config/utils/exportConfigToEnv.js +0 -31
- package/dist/config/utils/mergeEnvIntoConfig.js +0 -184
- package/dist/config/utils/replaceConfigInString.js +0 -12
- package/dist/config/utils/rewriteLegacyEnv.js +0 -115
- package/dist/interceptors/InterceptorPlugin.js +0 -108
- package/dist/interceptors/RenameVisitor.js +0 -19
- package/dist/interceptors/Visitor.js +0 -1414
- package/dist/interceptors/commands/codegenInterceptors.js +0 -22
- package/dist/interceptors/extractExports.js +0 -159
- package/dist/interceptors/findOriginalSource.js +0 -103
- package/dist/interceptors/findPlugins.js +0 -68
- package/dist/interceptors/generateInterceptor.js +0 -219
- package/dist/interceptors/generateInterceptors.js +0 -56
- package/dist/interceptors/parseStructure.js +0 -84
- package/dist/interceptors/swc.js +0 -15
- package/dist/interceptors/writeInterceptors.js +0 -44
- package/dist/utils/PackagesSort.js +0 -7
- package/dist/utils/TopologicalSort.js +0 -87
- package/dist/utils/isMonorepo.js +0 -47
- package/dist/utils/packageRoots.js +0 -31
- package/dist/utils/resolveDependenciesSync.js +0 -78
- package/dist/utils/resolveDependency.js +0 -70
- package/dist/utils/sig.js +0 -34
- package/dist/withGraphCommerce.js +0 -162
- package/src/config/utils/rewriteLegacyEnv.ts +0 -125
|
@@ -5,7 +5,19 @@ import {
|
|
|
5
5
|
} from '../../../src/config/utils/mergeEnvIntoConfig'
|
|
6
6
|
import type { GraphCommerceConfig } from '../../../src/generated/config'
|
|
7
7
|
import { GraphCommerceConfigSchema } from '../../../src/generated/config'
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
export const removeColor = (str: string) =>
|
|
10
|
+
str.replace(
|
|
11
|
+
new RegExp(
|
|
12
|
+
[
|
|
13
|
+
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
|
14
|
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
|
|
15
|
+
].join('|'),
|
|
16
|
+
'g',
|
|
17
|
+
),
|
|
18
|
+
'',
|
|
19
|
+
)
|
|
20
|
+
|
|
9
21
|
const env = {
|
|
10
22
|
GC_ADVANCED_FILTERS: '0',
|
|
11
23
|
GC_DEMO_MODE: '1',
|
|
@@ -22,7 +34,13 @@ const env = {
|
|
|
22
34
|
}
|
|
23
35
|
it('traverses a schema and returns a list of env variables that match', () => {
|
|
24
36
|
const [envSchema] = configToEnvSchema(GraphCommerceConfigSchema())
|
|
25
|
-
|
|
37
|
+
|
|
38
|
+
const keys = Object.keys(envSchema.shape)
|
|
39
|
+
|
|
40
|
+
expect(keys.includes('GC_ADVANCED_FILTERS')).toBe(false)
|
|
41
|
+
expect(keys.includes('GC_STOREFRONT')).toBe(true)
|
|
42
|
+
expect(keys.includes('GC_STOREFRONT_0')).toBe(true)
|
|
43
|
+
expect(keys.includes('GC_STOREFRONT_1')).toBe(true)
|
|
26
44
|
})
|
|
27
45
|
it('parses an env config object', () => {
|
|
28
46
|
const [envSchema] = configToEnvSchema(GraphCommerceConfigSchema())
|
|
@@ -101,7 +119,7 @@ it('converts an env schema to a config schema', () => {
|
|
|
101
119
|
+ GC_STOREFRONT => storefront
|
|
102
120
|
~ GC_STOREFRONT_0_LOCALE => storefront.[0].locale"
|
|
103
121
|
`)
|
|
104
|
-
|
|
122
|
+
// Validate the resulting configura
|
|
105
123
|
const parsed = GraphCommerceConfigSchema().safeParse(mergedConfig)
|
|
106
124
|
expect(parsed.success).toBe(true)
|
|
107
125
|
if (parsed.success) {
|