forked from signalapp/Signal-Desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyleguide.config.js
177 lines (173 loc) · 4.3 KB
/
styleguide.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
const webpack = require('webpack');
const path = require('path');
const typescriptSupport = require('react-docgen-typescript');
const propsParser = typescriptSupport.withCustomConfig('./tsconfig.json').parse;
module.exports = {
sections: [
{
name: 'Components',
description: '',
components: 'ts/components/*.tsx',
},
{
name: 'Conversation',
description: 'Everything necessary to render a conversation',
components: 'ts/components/conversation/*.tsx',
},
{
name: 'Media Gallery',
description: 'Display media and documents in a conversation',
components: 'ts/components/conversation/media-gallery/*.tsx',
},
{
name: 'Utility',
description: 'Utility components used across the application',
components: 'ts/components/utility/*.tsx',
},
{
name: 'Test',
description: 'Components only used for testing',
components: 'ts/styleguide/**/*.tsx',
},
],
context: {
// Exposes necessary utilities in the global scope for all readme code snippets
util: 'ts/styleguide/StyleGuideUtil',
},
contextDependencies: [path.join(__dirname, 'ts/styleguide')],
// 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: {
links: [
{
rel: 'stylesheet',
type: 'text/css',
href: '/stylesheets/manifest.css',
},
],
},
body: {
// Brings in all the necessary components to boostrap Backbone views
// Mirrors the order used in background.js.
scripts: [
{
src: 'test/styleguide/legacy_bridge.js',
},
{
src: 'node_modules/moment/min/moment-with-locales.min.js',
},
{
src: 'js/components.js',
},
{
src: 'js/reliable_trigger.js',
},
{
src: 'js/database.js',
},
{
src: 'js/storage.js',
},
{
src: 'js/signal_protocol_store.js',
},
{
src: 'js/libtextsecure.js',
},
{
src: 'js/focus_listener.js',
},
{
src: 'js/notifications.js',
},
{
src: 'js/delivery_receipts.js',
},
{
src: 'js/read_receipts.js',
},
{
src: 'js/read_syncs.js',
},
{
src: 'js/libphonenumber-util.js',
},
{
src: 'js/models/messages.js',
},
{
src: 'js/models/conversations.js',
},
{
src: 'js/models/blockedNumbers.js',
},
{
src: 'js/expiring_messages.js',
},
{
src: 'js/chromium.js',
},
{
src: 'js/registration.js',
},
{
src: 'js/expire.js',
},
{
src: 'js/conversation_controller.js',
},
{
src: 'js/emoji_util.js',
},
// Select Backbone views
{
src: 'js/views/react_wrapper_view.js',
},
{
src: 'js/views/whisper_view.js',
},
{
src: 'js/views/timestamp_view.js',
},
{
src: 'js/views/attachment_view.js',
},
{
src: 'js/views/message_view.js',
},
// Hacky way of including templates for Backbone components
{
src: 'test/styleguide/legacy_templates.js',
},
],
},
},
propsParser,
webpackConfig: {
devtool: 'source-map',
resolve: {
// Necessary to enable the absolute path used in the context option above
modules: [__dirname, path.join(__dirname, 'node_modules')],
extensions: ['.tsx'],
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
},
{
// To test handling of attachments, we need arraybuffers in memory
test: /\.(gif|mp3|mp4|txt|jpg|jpeg|png)$/,
loader: 'arraybuffer-loader',
},
],
},
},
};