@standardnotes/authenticator 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +21 -0
- package/.browserlistrc +2 -0
- package/.eslintignore +3 -0
- package/.eslintrc +30 -0
- package/CHANGELOG.md +136 -0
- package/README.md +7 -0
- package/app/assets/svg/drag-indicator.svg +14 -0
- package/app/assets/svg/palette.svg +3 -0
- package/app/assets/svg/reorder-icon.svg +37 -0
- package/app/components/AuthEntry.jsx +202 -0
- package/app/components/AuthMenu.jsx +63 -0
- package/app/components/ConfirmDialog.jsx +37 -0
- package/app/components/CopyNotification.jsx +15 -0
- package/app/components/CountdownPie.jsx +131 -0
- package/app/components/DataErrorAlert.jsx +21 -0
- package/app/components/EditEntry.jsx +283 -0
- package/app/components/Home.jsx +365 -0
- package/app/components/QRCodeReader.jsx +91 -0
- package/app/components/ViewEntries.jsx +82 -0
- package/app/index.js +4 -0
- package/app/lib/otp.js +184 -0
- package/app/lib/utils.js +185 -0
- package/app/stylesheets/main.scss +443 -0
- package/editor.index.ejs +10 -0
- package/ext.json.sample +8 -0
- package/package.json +68 -0
- package/webpack.config.js +74 -0
- package/webpack.dev.js +23 -0
- package/webpack.prod.js +11 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
@import '~@standardnotes/styles/src/Styles/main.scss';
|
|
2
|
+
|
|
3
|
+
body,
|
|
4
|
+
html {
|
|
5
|
+
background-color: var(--sn-stylekit-contrast-background-color);
|
|
6
|
+
padding: 0 !important;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
* {
|
|
10
|
+
// To prevent gray flash when focusing input on mobile Safari
|
|
11
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
12
|
+
font-family: var(--sn-stylekit-sans-serif-font);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.sn-component {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
|
|
19
|
+
@media screen and (max-width: 420px) {
|
|
20
|
+
min-height: -webkit-fill-available;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.sk-panel-content {
|
|
24
|
+
height: inherit !important;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#header {
|
|
29
|
+
border-bottom: 1px solid var(--sn-stylekit-border-color);
|
|
30
|
+
background-color: var(--sn-stylekit-background-color);
|
|
31
|
+
color: var(--sn-stylekit-foreground-color);
|
|
32
|
+
|
|
33
|
+
min-height: 26px;
|
|
34
|
+
padding: 10px;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
align-items: center;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#content {
|
|
41
|
+
background-color: var(--sn-stylekit-contrast-background-color);
|
|
42
|
+
flex: 1;
|
|
43
|
+
padding: 0 10px;
|
|
44
|
+
padding-bottom: 10px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.auth-dialog {
|
|
48
|
+
min-width: 380px;
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 50%;
|
|
51
|
+
left: 50%;
|
|
52
|
+
transform: translate(-50%, -50%);
|
|
53
|
+
z-index: 200;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.auth-overlay {
|
|
57
|
+
position: fixed !important;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
top: 0;
|
|
61
|
+
left: 0;
|
|
62
|
+
right: 0;
|
|
63
|
+
bottom: 0;
|
|
64
|
+
z-index: 100;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.auth-list {
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.auth-edit {
|
|
73
|
+
margin: 10px 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.sk-notification {
|
|
77
|
+
// Hacking sk-notification style
|
|
78
|
+
overflow: visible !important; // We need this for the dropdown menu
|
|
79
|
+
margin: 10px 0 0 0 !important;
|
|
80
|
+
padding: 28px 14px 28px 28px !important;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.auth-optional {
|
|
84
|
+
margin-top: 15px;
|
|
85
|
+
.auth-notes-row {
|
|
86
|
+
.auth-notes {
|
|
87
|
+
font-size: var(--sn-stylekit-base-font-size);
|
|
88
|
+
font-style: italic;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
.auth-password-row {
|
|
93
|
+
margin-top: 8px;
|
|
94
|
+
|
|
95
|
+
.auth-password {
|
|
96
|
+
font-size: var(--sn-stylekit-font-size-h1);
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Copy token notification
|
|
104
|
+
.auth-copy-notification {
|
|
105
|
+
position: fixed;
|
|
106
|
+
left: 50%;
|
|
107
|
+
bottom: 20px;
|
|
108
|
+
transform: translateX(-50%);
|
|
109
|
+
z-index: 200;
|
|
110
|
+
|
|
111
|
+
.sk-panel {
|
|
112
|
+
border-radius: 4px;
|
|
113
|
+
padding: 4px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&.visible {
|
|
117
|
+
visibility: visible;
|
|
118
|
+
opacity: 1;
|
|
119
|
+
transition: opacity 200ms ease-in;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&.hidden {
|
|
123
|
+
visibility: hidden;
|
|
124
|
+
opacity: 0;
|
|
125
|
+
transition: visibility 0s 500ms, opacity 500ms ease-out;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* entry default styles */
|
|
130
|
+
.auth-entry {
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
|
|
134
|
+
// Collapse on mobile
|
|
135
|
+
@media screen and (max-width: 480px) {
|
|
136
|
+
.auth-details {
|
|
137
|
+
flex-direction: column !important;
|
|
138
|
+
align-items: stretch !important;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.auth-details {
|
|
143
|
+
flex: 1;
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: row;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: space-between;
|
|
148
|
+
min-width: 0;
|
|
149
|
+
|
|
150
|
+
.auth-info {
|
|
151
|
+
margin: 4px 0;
|
|
152
|
+
min-width: inherit;
|
|
153
|
+
word-wrap: break-word;
|
|
154
|
+
|
|
155
|
+
.auth-service {
|
|
156
|
+
font-size: var(--sn-stylekit-font-size-h1);
|
|
157
|
+
font-weight: bold;
|
|
158
|
+
line-height: 1.9rem;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.auth-account {
|
|
162
|
+
line-height: 1.5rem;
|
|
163
|
+
font-size: var(--sn-stylekit-font-size-p);
|
|
164
|
+
text-align: left;
|
|
165
|
+
font-weight: normal;
|
|
166
|
+
word-wrap: break-word;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.auth-token-info {
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
padding-right: 12px;
|
|
174
|
+
|
|
175
|
+
.auth-token {
|
|
176
|
+
font-size: 2rem;
|
|
177
|
+
align-self: center;
|
|
178
|
+
font-weight: bold;
|
|
179
|
+
display: flex;
|
|
180
|
+
justify-content: space-between;
|
|
181
|
+
width: 8.2rem;
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.auth-countdown {
|
|
186
|
+
padding: 0 12px;
|
|
187
|
+
|
|
188
|
+
// Countdown animation
|
|
189
|
+
#countdown {
|
|
190
|
+
transform: rotateY(-180deg) rotateZ(-90deg);
|
|
191
|
+
height: 1.8rem;
|
|
192
|
+
width: 1.8rem;
|
|
193
|
+
align-self: center;
|
|
194
|
+
|
|
195
|
+
circle {
|
|
196
|
+
stroke-dasharray: 113px;
|
|
197
|
+
stroke-dashoffset: 0px;
|
|
198
|
+
stroke-width: 4px;
|
|
199
|
+
stroke: var(--sn-stylekit-success-color);
|
|
200
|
+
fill: none;
|
|
201
|
+
animation: countdown 10s linear infinite forwards;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.auth-options {
|
|
209
|
+
color: var(--sn-stylekit-contrast-foreground-color);
|
|
210
|
+
overflow: visible;
|
|
211
|
+
margin-bottom: 8px;
|
|
212
|
+
align-self: center;
|
|
213
|
+
|
|
214
|
+
.sk-menu-panel {
|
|
215
|
+
position: absolute;
|
|
216
|
+
right: 0;
|
|
217
|
+
z-index: 200;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.auth-drag-indicator-container {
|
|
222
|
+
color: inherit;
|
|
223
|
+
overflow: visible;
|
|
224
|
+
margin-bottom: 8px;
|
|
225
|
+
align-self: center;
|
|
226
|
+
padding-right: 22px;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* spinner */
|
|
231
|
+
.countdown-pie {
|
|
232
|
+
position: relative;
|
|
233
|
+
width: 24px;
|
|
234
|
+
height: 24px;
|
|
235
|
+
background: var(--sn-stylekit-background-color);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.countdown-pie,
|
|
239
|
+
.countdown-pie * {
|
|
240
|
+
box-sizing: border-box;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.countdown-pie .pie {
|
|
244
|
+
width: 50%;
|
|
245
|
+
height: 100%;
|
|
246
|
+
transform-origin: 100% 50%;
|
|
247
|
+
position: absolute !important;
|
|
248
|
+
background: var(--sn-stylekit-info-color);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.countdown-pie .spinner {
|
|
252
|
+
border-radius: 100% 0 0 100% / 50% 0 0 50%;
|
|
253
|
+
z-index: 20;
|
|
254
|
+
border-right: none;
|
|
255
|
+
// Injected in CountdownPie.js
|
|
256
|
+
// animation: rota 30s linear infinite;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.countdown-pie .background {
|
|
260
|
+
border-radius: 50%;
|
|
261
|
+
width: 100%;
|
|
262
|
+
z-index: 40;
|
|
263
|
+
color: inherit;
|
|
264
|
+
opacity: 0.4;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.countdown-pie .filler {
|
|
268
|
+
border-radius: 0 100% 100% 0 / 0 50% 50% 0;
|
|
269
|
+
left: 50%;
|
|
270
|
+
opacity: 0;
|
|
271
|
+
z-index: 10;
|
|
272
|
+
// Injected in CountdownPie.js
|
|
273
|
+
// animation: opa 30s steps(1, end) infinite reverse;
|
|
274
|
+
border-left: none;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.countdown-pie .mask {
|
|
278
|
+
width: 50%;
|
|
279
|
+
height: 100%;
|
|
280
|
+
position: absolute;
|
|
281
|
+
background: inherit;
|
|
282
|
+
opacity: 1;
|
|
283
|
+
z-index: 30;
|
|
284
|
+
// Injected in CountdownPie.js
|
|
285
|
+
// animation: opa 30s steps(1, end) infinite;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.color-picker-swatch {
|
|
289
|
+
padding: 5px;
|
|
290
|
+
background: var(--sn-stylekit-contrast-background-color);
|
|
291
|
+
border-radius: 1px;
|
|
292
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
293
|
+
display: inline-block;
|
|
294
|
+
cursor: pointer;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.color-picker-popover {
|
|
298
|
+
position: absolute;
|
|
299
|
+
z-index: 200;
|
|
300
|
+
right: 40px;
|
|
301
|
+
top: 80px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.color-picker-cover {
|
|
305
|
+
position: fixed;
|
|
306
|
+
top: 0px;
|
|
307
|
+
right: 0px;
|
|
308
|
+
bottom: 0px;
|
|
309
|
+
left: 0px;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.align-items-center {
|
|
313
|
+
align-items: center;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.sk-base-custom {
|
|
317
|
+
color: var(--sn-stylekit-foreground-color);
|
|
318
|
+
position: relative;
|
|
319
|
+
background-color: var(--sn-stylekit-background-color);
|
|
320
|
+
overflow: hidden;
|
|
321
|
+
border-radius: var(--sn-stylekit-general-border-radius);
|
|
322
|
+
border-color: var(--sn-stylekit-border-color);
|
|
323
|
+
border: 1px solid var(--sn-stylekit-border-color);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
@media only screen and (max-width: 600px) {
|
|
327
|
+
.left {
|
|
328
|
+
width: 60% !important;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.right {
|
|
332
|
+
width: 40% !important;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
@media only screen and (min-width: 600px) {
|
|
337
|
+
.left {
|
|
338
|
+
width: 75% !important;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.right {
|
|
342
|
+
width: 25% !important;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
@media only screen and (min-width: 768px) {
|
|
347
|
+
.left {
|
|
348
|
+
width: 80% !important;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.right {
|
|
352
|
+
width: 20% !important;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
@media only screen and (min-width: 992px) {
|
|
357
|
+
.left {
|
|
358
|
+
width: 85% !important;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.right {
|
|
362
|
+
width: 15% !important;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.left {
|
|
367
|
+
margin-right: 10px;
|
|
368
|
+
display: flex;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.right {
|
|
372
|
+
text-align: right;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.search-bar {
|
|
376
|
+
height: 27px;
|
|
377
|
+
}
|
|
378
|
+
// Injected in CountdownPie.js
|
|
379
|
+
// @keyframes rota {
|
|
380
|
+
// 0% {
|
|
381
|
+
// transform: rotate(0deg);
|
|
382
|
+
// }
|
|
383
|
+
|
|
384
|
+
// 100% {
|
|
385
|
+
// transform: rotate(360deg);
|
|
386
|
+
// }
|
|
387
|
+
// }
|
|
388
|
+
|
|
389
|
+
// Injected in CountdownPie.js
|
|
390
|
+
// @keyframes opa {
|
|
391
|
+
// 0% {
|
|
392
|
+
// opacity: 1;
|
|
393
|
+
// }
|
|
394
|
+
|
|
395
|
+
// 50%,
|
|
396
|
+
// 100% {
|
|
397
|
+
// opacity: 0;
|
|
398
|
+
// }
|
|
399
|
+
// }
|
|
400
|
+
|
|
401
|
+
.qr-code-reader-container {
|
|
402
|
+
margin-right: 15px;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.full-width {
|
|
406
|
+
width: 100% !important;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// Show palette icon on the first 4 color rectangles.
|
|
410
|
+
div.twitter-picker > div:nth-child(3) > span:nth-child(-n + 4) > div {
|
|
411
|
+
background-image: url('../assets/svg/palette.svg') !important;
|
|
412
|
+
background-repeat: no-repeat !important;
|
|
413
|
+
background-position: top 4px right 4px !important;
|
|
414
|
+
background-size: 12px 12px !important;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.grab-cursor {
|
|
418
|
+
cursor: grab;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.left-header {
|
|
422
|
+
display: flex;
|
|
423
|
+
|
|
424
|
+
@media screen and (max-width: 600px) {
|
|
425
|
+
flex-direction: column;
|
|
426
|
+
flex-wrap: wrap;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.sk-input-group {
|
|
430
|
+
> * {
|
|
431
|
+
display: inline-block;
|
|
432
|
+
vertical-align: middle;
|
|
433
|
+
|
|
434
|
+
&:not(:first-child) {
|
|
435
|
+
margin-left: 0 !important;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
&:not(:last-child) {
|
|
439
|
+
margin-right: 0.73125rem;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
package/editor.index.ejs
ADDED
package/ext.json.sample
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@standardnotes/authenticator",
|
|
3
|
+
"version": "2.3.5",
|
|
4
|
+
"main": "dist/dist.js",
|
|
5
|
+
"author": "Standard Notes Core",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "webpack --config webpack.prod.js",
|
|
11
|
+
"start": "webpack serve --config webpack.dev.js --progress --hot",
|
|
12
|
+
"skip:lint": "eslint app/ --ext .js",
|
|
13
|
+
"lint:fix": "eslint app/ --ext .js --fix",
|
|
14
|
+
"test": "echo \"Error: no test specified\" && exit 0",
|
|
15
|
+
"format": "prettier --write 'app/**/*.{html,css,scss,js,jsx,ts,tsx,json}' README.md"
|
|
16
|
+
},
|
|
17
|
+
"sn": {
|
|
18
|
+
"main": "dist/index.html"
|
|
19
|
+
},
|
|
20
|
+
"lint-staged": {
|
|
21
|
+
"README.md": [
|
|
22
|
+
"prettier --write"
|
|
23
|
+
],
|
|
24
|
+
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
|
|
25
|
+
"prettier --write"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@standardnotes/editor-kit": "standardnotes/editor-kit#50ffb15c935a297b082eb00ffd031adc05080d7f",
|
|
30
|
+
"@standardnotes/styles": "1.6.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@babel/core": "^7.18.5",
|
|
34
|
+
"@babel/eslint-parser": "^7.18.2",
|
|
35
|
+
"@babel/plugin-proposal-class-properties": "^7.17.12",
|
|
36
|
+
"@babel/plugin-transform-runtime": "^7.18.5",
|
|
37
|
+
"@babel/preset-env": "^7.18.2",
|
|
38
|
+
"@babel/preset-react": "^7.17.12",
|
|
39
|
+
"@standardnotes/eslint-config-extensions": "^1.0.4",
|
|
40
|
+
"@svgr/webpack": "^6.2.1",
|
|
41
|
+
"babel-loader": "^8.2.5",
|
|
42
|
+
"css-loader": "*",
|
|
43
|
+
"eslint": "*",
|
|
44
|
+
"eslint-plugin-react": "^7.30.0",
|
|
45
|
+
"html-webpack-plugin": "^5.5.0",
|
|
46
|
+
"immutability-helper": "^3.1.1",
|
|
47
|
+
"jsqr": "^1.4.0",
|
|
48
|
+
"mini-css-extract-plugin": "^2.6.1",
|
|
49
|
+
"node-sass": "*",
|
|
50
|
+
"notp": "^2.0.3",
|
|
51
|
+
"otplib": "^12.0.1",
|
|
52
|
+
"prettier": "*",
|
|
53
|
+
"prop-types": "^15.8.1",
|
|
54
|
+
"react": "^18.2.0",
|
|
55
|
+
"react-beautiful-dnd": "^13.1.0",
|
|
56
|
+
"react-color": "^2.19.3",
|
|
57
|
+
"react-dom": "^18.2.0",
|
|
58
|
+
"sass-loader": "*",
|
|
59
|
+
"style-loader": "~3.3.1",
|
|
60
|
+
"svg-url-loader": "^7.1.1",
|
|
61
|
+
"terser-webpack-plugin": "^5.3.3",
|
|
62
|
+
"webpack": "*",
|
|
63
|
+
"webpack-cli": "*",
|
|
64
|
+
"webpack-dev-server": "*",
|
|
65
|
+
"webpack-merge": "^5.8.0"
|
|
66
|
+
},
|
|
67
|
+
"gitHead": "d6b59929fcca381c8aef136b56a0897d3720d8e4"
|
|
68
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
3
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
context: __dirname,
|
|
7
|
+
entry: [
|
|
8
|
+
path.resolve(__dirname, 'app/index.js'),
|
|
9
|
+
path.resolve(__dirname, 'app/stylesheets/main.scss')
|
|
10
|
+
],
|
|
11
|
+
output: {
|
|
12
|
+
path: path.resolve(__dirname, 'dist'),
|
|
13
|
+
filename: 'dist.js'
|
|
14
|
+
},
|
|
15
|
+
externals: {
|
|
16
|
+
'filesafe-js': {}
|
|
17
|
+
},
|
|
18
|
+
module: {
|
|
19
|
+
rules: [
|
|
20
|
+
{
|
|
21
|
+
test: /\.s[ac]ss$/i,
|
|
22
|
+
exclude: /node_modules/,
|
|
23
|
+
use: [
|
|
24
|
+
MiniCssExtractPlugin.loader,
|
|
25
|
+
"css-loader",
|
|
26
|
+
{
|
|
27
|
+
loader: "sass-loader"
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
test: /\.js[x]?$/,
|
|
33
|
+
exclude: /node_modules/,
|
|
34
|
+
use: ['babel-loader'],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
test: /\.svg$/i,
|
|
38
|
+
issuer: /\.[jt]sx?$/,
|
|
39
|
+
exclude: /node_modules/,
|
|
40
|
+
use: ['@svgr/webpack'],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
test: /\.svg$/i,
|
|
44
|
+
issuer: /\.s[ac]ss$/i,
|
|
45
|
+
exclude: /node_modules/,
|
|
46
|
+
use: [
|
|
47
|
+
{
|
|
48
|
+
loader: 'svg-url-loader',
|
|
49
|
+
options: {
|
|
50
|
+
limit: 10000
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
resolve: {
|
|
58
|
+
extensions: ['.js', '.jsx'],
|
|
59
|
+
alias: {
|
|
60
|
+
'@Components': path.resolve(__dirname, 'app/components'),
|
|
61
|
+
'@Lib': path.resolve(__dirname, 'app/lib')
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
plugins: [
|
|
65
|
+
new MiniCssExtractPlugin({
|
|
66
|
+
filename: "dist.css"
|
|
67
|
+
}),
|
|
68
|
+
new HtmlWebpackPlugin({
|
|
69
|
+
title: "TokenVault",
|
|
70
|
+
template: 'editor.index.ejs',
|
|
71
|
+
filename: 'index.html'
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
}
|
package/webpack.dev.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { merge } = require('webpack-merge');
|
|
3
|
+
const config = require('./webpack.config.js');
|
|
4
|
+
|
|
5
|
+
module.exports = merge(config, {
|
|
6
|
+
mode: 'development',
|
|
7
|
+
devtool: 'cheap-source-map',
|
|
8
|
+
devServer: {
|
|
9
|
+
port: 8001,
|
|
10
|
+
static: path.resolve(__dirname, 'dist'),
|
|
11
|
+
allowedHosts: "all",
|
|
12
|
+
historyApiFallback: true,
|
|
13
|
+
headers: {
|
|
14
|
+
'Access-Control-Allow-Origin': '*',
|
|
15
|
+
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
|
16
|
+
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
watchOptions: {
|
|
20
|
+
aggregateTimeout: 300,
|
|
21
|
+
poll: 1000
|
|
22
|
+
},
|
|
23
|
+
});
|
package/webpack.prod.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { merge } = require('webpack-merge');
|
|
2
|
+
const config = require('./webpack.config.js');
|
|
3
|
+
const TerserPlugin = require("terser-webpack-plugin");
|
|
4
|
+
|
|
5
|
+
module.exports = merge(config, {
|
|
6
|
+
mode: 'production',
|
|
7
|
+
optimization: {
|
|
8
|
+
minimize: true,
|
|
9
|
+
minimizer: [new TerserPlugin()]
|
|
10
|
+
}
|
|
11
|
+
});
|