forked from coordinape/coordinape
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraco.config.js
126 lines (123 loc) · 3.91 KB
/
craco.config.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
const webpack = require('webpack');
const SentryCliPlugin = require('@sentry/webpack-plugin');
const {
COVERAGE,
SENTRY_AUTH_TOKEN,
VERCEL,
VERCEL_ENV,
VERCEL_GIT_COMMIT_SHA,
VERCEL_URL,
} = process.env;
const shouldDryRun = !(
VERCEL &&
SENTRY_AUTH_TOKEN &&
VERCEL_ENV !== 'development'
);
module.exports = {
jest: {
configure: {
verbose: true,
roots: [
'<rootDir>/src',
'<rootDir>/api',
'<rootDir>/api-lib',
'<rootDir>/api-test',
],
testMatch: [
'<rootDir>/api/**/*.{spec,test}.{js,jsx,ts,tsx}',
'<rootDir>/api-lib/**/*.{spec,test}.{js,jsx,ts,tsx}',
'<rootDir>/api-test/**/*.{spec,test}.{js,jsx,ts,tsx}',
],
collectCoverageFrom: [
'{src,api,api-lib}/**/*.{ts,tsx}',
'!**/*.d.ts',
'!**/*.stories.tsx',
],
coverageDirectory: 'coverage-jest',
coveragePathIgnorePatterns: ['/node_modules/', '/__generated.*/'],
coverageReporters: ['json', 'lcov', 'text-summary'],
transform: {
'.(ts|tsx)': 'ts-jest',
},
resetMocks: false,
setupFiles: ['<rootDir>/src/utils/test-setup.ts'],
moduleNameMapper: {
'react-markdown':
'<rootDir>/node_modules/react-markdown/react-markdown.min.js',
},
},
},
webpack: {
configure: {
module: {
rules: [
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
COVERAGE && {
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-typescript'],
plugins: ['istanbul'],
},
},
},
].filter(x => x),
},
ignoreWarnings: [/Failed to parse source map/],
resolve: {
fallback: {
buffer: require.resolve('buffer'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('http-browserify'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify'),
stream: require.resolve('stream-browserify'),
util: require.resolve('util'),
},
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser',
}),
VERCEL_ENV &&
new SentryCliPlugin({
// include the transpiled js and sourcemaps
include: 'build',
// Release will utilize the vercel-specified sha if available.
// Otherise the current branch HEAD's sha will be used instead.
// These are functionally the same, but its a small optimization
// when running in CI, and ensures compatibility across all
// integrations.
release: VERCEL_GIT_COMMIT_SHA,
// Dry run in development environments or if the Sentry Auth token
// is absent. Simply logging a webpack warning will still cause
// compilation to fail in CI, so we want to avoid that.
dryRun: shouldDryRun,
ignore: ['node_modules', 'craco.config.js'],
org: 'coordinape',
project: 'app',
deploy: {
// Commits are auto-associated from the production Vercel environment
// by the Sentry-GitHub integration. The token provided to Vercel
// is not given the `org:read` permission necessary to
// set commits.
env: VERCEL_ENV,
// Not sure where this shows up in the Sentry UI, but if we can
// include it, why not?
// Sentry complains without a protocol prefix, which Vercel does
// not provide
url: 'https://' + VERCEL_URL,
},
}),
].filter(x => x),
},
},
};