-
Notifications
You must be signed in to change notification settings - Fork 23
/
.aegir.js
126 lines (117 loc) · 2.9 KB
/
.aegir.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
// import copy from 'esbuild-plugin-copy'
import fs from 'node:fs'
import path from 'node:path'
const copyPlugin = ({ext}) => {
return {
name: `copy-${ext}`,
setup(build) {
const srcDir = 'src'
const destDir = 'dist/src'
build.onEnd(() => {
const copyFile = (src, dest) => {
fs.mkdirSync(path.dirname(dest), { recursive: true })
fs.copyFileSync(src, dest)
}
const walkDir = (dir, callback) => {
fs.readdirSync(dir).forEach(f => {
const dirPath = path.join(dir, f)
const isDirectory = fs.statSync(dirPath).isDirectory()
isDirectory ? walkDir(dirPath, callback) : callback(path.join(dir, f))
})
}
walkDir(srcDir, (filePath) => {
if (filePath.endsWith(`.${ext}`)) {
const relativePath = path.relative(srcDir, filePath)
const destPath = path.join(destDir, relativePath)
copyFile(filePath, destPath)
}
})
})
}
}
}
/** @type {import('aegir').PartialOptions} */
export default {
// TODO: fix build and test with aegir
// test: {
// build: false,
// files: [
// 'dist/test/**/*.spec.{js,ts, jsx, tsx}',
// ],
// },
build: {
config: {
inject: [
'./src/lib/browser-shims.js'
],
bundle: true,
loader: {
'.js': 'jsx',
'.ts': 'ts',
'.tsx': 'tsx',
'.jsx': 'jsx',
'.svg': 'text',
// '.css': 'css'
'.woff': 'file',
'.woff2': 'file',
'.eot': 'file',
'.otf': 'file',
},
platform: 'browser',
target: 'es2022',
format: 'esm',
metafile: true,
plugins: [
copyPlugin({ext: 'css'}),
copyPlugin({ext: 'svg'}),
],
}
},
lint: {
files: [
'src/**/*.{js,jsx,ts,tsx}',
'test/**/*.{js,jsx,ts,tsx}',
'dev/**/*.{js,jsx,ts,tsx}',
// TODO: re-enable linting of stories.
'!src/**/*.stories.*',
]
},
dependencyCheck: {
ignore: [
// .jsx files aren't checked properly.
'cytoscape',
'cytoscape-dagre',
'filesize',
'react-inspector',
'react-joyride',
'react-helmet',
// storybook deps
'@chromatic-com/storybook',
'@storybook/addon-actions',
'@storybook/addon-coverage',
'@storybook/addon-interactions',
'@storybook/addon-links',
'@storybook/types',
// problem with deps
'@typescript-eslint/eslint-plugin',
// scripts
'wait-on',
// playwright deps
'tsx',
// vite stuff
'rollup-plugin-node-polyfills',
'@vitest/coverage-v8',
// typescript plugins
'typescript-plugin-css-modules'
],
productionIgnorePatterns: [
'.aegir.js',
'.eslintrc.js',
'vite.config.ts',
'vitest.config.js',
'/test',
'.storybook',
'**/*.stories.*',
]
}
}