-
Notifications
You must be signed in to change notification settings - Fork 3
/
stencil.config.ts
76 lines (69 loc) · 1.72 KB
/
stencil.config.ts
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
import fs from 'fs';
import { Config } from '@stencil/core';
import { postcss } from '@stencil/postcss';
import postCSSPresetEnv from 'postcss-preset-env';
import replace from 'rollup-plugin-replace';
import { createFilter } from 'rollup-pluginutils';
// https://stenciljs.com/docs/config
const pkgManifest = JSON.parse(fs.readFileSync('package.json', 'utf8'));
interface Options {
include?: string;
exclude?: string;
}
function gql(opts: Options = {}) {
if (!opts.include) {
opts.include = '**/*.graphql'; // eslint-disable-line no-param-reassign
}
const filter = createFilter(opts.include, opts.exclude);
return {
name: 'gql',
// eslint-disable-next-line consistent-return
transform(code, id) {
if (filter(id)) {
return {
code: `export default ${JSON.stringify(code)}`,
};
}
},
};
}
export const config: Config = {
namespace: 'manifold',
globalStyle: 'src/global/theme.css',
globalScript: 'src/global/app.ts',
outputTargets: [{ type: 'dist' }],
excludeSrc: ['**/*-happo.*', '**/spec/mock/*'],
plugins: [
gql(),
postcss({
plugins: [
postCSSPresetEnv({
features: {
'custom-media-queries': true,
'nesting-rules': true,
},
}),
],
}),
replace({
exclude: 'node_modules/**',
delimiters: ['<@', '@>'],
values: {
NPM_PACKAGE_VERSION: pkgManifest.version,
},
}),
],
testing: {
setupFiles: ['./jest-setup'],
testPathIgnorePatterns: [
'<rootDir>/dist/',
'<rootDir>/docs/',
'<rootDir>/pkg/',
'<rootDir>/e2e/',
'/node_modules/',
],
transform: {
'\\.graphql$': './jest-transform-graphql',
},
},
};