-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsconfig.js
58 lines (55 loc) · 1.55 KB
/
tsconfig.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const PROVIDERS = ['bigcommerce', 'shopify', 'swell', 'vendure', 'saleor']
function getProviderName() {
return (
process.env.COMMERCE_PROVIDER ||
(process.env.BIGCOMMERCE_STOREFRONT_API_URL
? 'bigcommerce'
: process.env.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN
? 'shopify'
: process.env.NEXT_PUBLIC_SWELL_STORE_ID
? 'swell'
: 'local')
)
}
const name = getProviderName()
const EXCLUDED_PROVIDERS = PROVIDERS.filter((p) => p !== name).map(
(p) => `./framework/${p}`
)
module.exports = {
compilerOptions: {
baseUrl: '.',
target: 'esnext',
lib: ['dom', 'dom.iterable', 'esnext'],
allowJs: true,
skipLibCheck: true,
strict: true,
forceConsistentCasingInFileNames: true,
noEmit: true,
esModuleInterop: true,
module: 'esnext',
moduleResolution: 'node',
resolveJsonModule: true,
isolatedModules: true,
jsx: 'preserve',
incremental: true,
paths: {
'@lib/*': ['lib/*'],
'@utils/*': ['utils/*'],
'@config/*': ['config/*'],
'@assets/*': ['assets/*'],
'@components/*': ['components/*'],
'@commerce': ['framework/commerce'],
'@commerce/*': ['framework/commerce/*'],
// Update paths to point to the selected provider
'@framework': [`framework/${name}`],
'@framework/*': [`framework/${name}/*`],
},
},
include: ['next-env.d.ts', '**/*.d.ts', '**/*.ts', '**/*.tsx', '**/*.js'],
exclude: [
'node_modules',
// It may be useful to exclude the other providers
// from TS checking
...EXCLUDED_PROVIDERS,
],
}