2018-04-03 22:56:12 +00:00
|
|
|
const path = require('path');
|
2018-07-07 00:48:14 +00:00
|
|
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
2018-04-03 22:56:12 +00:00
|
|
|
const typescriptSupport = require('react-docgen-typescript');
|
|
|
|
|
|
|
|
const propsParser = typescriptSupport.withCustomConfig('./tsconfig.json').parse;
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
sections: [
|
2018-04-15 04:28:21 +00:00
|
|
|
{
|
|
|
|
name: 'Components',
|
|
|
|
description: '',
|
2019-01-14 21:49:58 +00:00
|
|
|
components: 'ts/components/[^_]*.tsx',
|
2018-04-15 04:28:21 +00:00
|
|
|
},
|
2018-04-03 22:56:12 +00:00
|
|
|
{
|
|
|
|
name: 'Conversation',
|
|
|
|
description: 'Everything necessary to render a conversation',
|
2019-01-14 21:49:58 +00:00
|
|
|
components: 'ts/components/conversation/[^_]*.tsx',
|
2018-04-03 22:56:12 +00:00
|
|
|
},
|
2019-05-24 23:58:27 +00:00
|
|
|
{
|
|
|
|
name: 'Emoji',
|
|
|
|
description: 'All components related to emojis',
|
|
|
|
components: 'ts/components/emoji/[^_]*.tsx',
|
|
|
|
},
|
2018-04-12 20:23:26 +00:00
|
|
|
{
|
|
|
|
name: 'Media Gallery',
|
|
|
|
description: 'Display media and documents in a conversation',
|
2019-01-14 21:49:58 +00:00
|
|
|
components: 'ts/components/conversation/media-gallery/[^_]*.tsx',
|
2018-04-12 20:23:26 +00:00
|
|
|
},
|
2019-05-16 22:32:11 +00:00
|
|
|
{
|
|
|
|
name: 'Stickers',
|
|
|
|
description: 'All components related to stickers',
|
|
|
|
components: 'ts/components/stickers/[^_]*.tsx',
|
|
|
|
},
|
2018-04-03 22:56:12 +00:00
|
|
|
{
|
|
|
|
name: 'Utility',
|
2018-04-05 22:30:40 +00:00
|
|
|
description: 'Utility components used across the application',
|
2019-01-14 21:49:58 +00:00
|
|
|
components: 'ts/components/utility/[^_]*.tsx',
|
2018-04-05 22:30:40 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Test',
|
|
|
|
description: 'Components only used for testing',
|
2018-04-11 20:31:35 +00:00
|
|
|
components: 'ts/styleguide/**/*.tsx',
|
2018-04-03 22:56:12 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
context: {
|
|
|
|
// Exposes necessary utilities in the global scope for all readme code snippets
|
2018-04-11 20:31:35 +00:00
|
|
|
util: 'ts/styleguide/StyleGuideUtil',
|
2018-04-03 22:56:12 +00:00
|
|
|
},
|
2018-04-27 21:25:04 +00:00
|
|
|
contextDependencies: [path.join(__dirname, 'ts/styleguide')],
|
2018-04-03 22:56:12 +00:00
|
|
|
// We don't want one long, single page
|
|
|
|
pagePerSection: true,
|
|
|
|
// Expose entire repository to the styleguidist server, primarily for stylesheets
|
|
|
|
assetsDir: './',
|
|
|
|
// Add top-level elements to the HTML:
|
|
|
|
// docs: https://github.com/vxna/mini-html-webpack-template
|
|
|
|
// https://react-styleguidist.js.org/docs/configuration.html#template
|
|
|
|
template: {
|
|
|
|
head: {
|
2018-04-27 21:25:04 +00:00
|
|
|
links: [
|
|
|
|
{
|
|
|
|
rel: 'stylesheet',
|
|
|
|
type: 'text/css',
|
|
|
|
href: '/stylesheets/manifest.css',
|
|
|
|
},
|
2019-06-27 20:35:21 +00:00
|
|
|
{
|
|
|
|
rel: 'stylesheet',
|
|
|
|
type: 'text/css',
|
|
|
|
href: '/node_modules/draft-js/dist/Draft.css',
|
|
|
|
},
|
2018-04-27 21:25:04 +00:00
|
|
|
],
|
2018-04-03 22:56:12 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
propsParser,
|
|
|
|
webpackConfig: {
|
|
|
|
devtool: 'source-map',
|
|
|
|
|
|
|
|
resolve: {
|
|
|
|
// Necessary to enable the absolute path used in the context option above
|
2018-04-27 21:25:04 +00:00
|
|
|
modules: [__dirname, path.join(__dirname, 'node_modules')],
|
2018-04-03 22:56:12 +00:00
|
|
|
extensions: ['.tsx'],
|
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
2018-04-27 21:25:04 +00:00
|
|
|
loader: 'ts-loader',
|
2018-04-03 22:56:12 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
// To test handling of attachments, we need arraybuffers in memory
|
2019-05-16 22:32:11 +00:00
|
|
|
test: /\.(gif|mp3|mp4|txt|jpg|jpeg|png|webp)$/,
|
2018-04-03 22:56:12 +00:00
|
|
|
loader: 'arraybuffer-loader',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|