@nlabs/lex 1.46.1 → 1.46.2
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/dist/LexConfig.js +1 -1
- package/dist/commands/build.js +3 -3
- package/dist/commands/bulid.test.js +2 -2
- package/dist/commands/clean.js +2 -2
- package/dist/commands/clean.test.js +2 -2
- package/dist/commands/compile.js +3 -3
- package/dist/commands/config.js +3 -3
- package/dist/commands/copy.js +1 -1
- package/dist/commands/create.js +7 -3
- package/dist/commands/dev.js +1 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/link.js +1 -1
- package/dist/commands/lint.js +2 -2
- package/dist/commands/migrate.js +1 -1
- package/dist/commands/publish.js +2 -2
- package/dist/commands/test.js +1 -1
- package/dist/commands/update.js +1 -1
- package/dist/commands/upgrade.js +2 -2
- package/dist/create/changelog.js +1 -1
- package/dist/utils/app.js +2 -2
- package/package.json +8 -5
- package/tsconfig.build.json +7 -16
- package/webpack.config.js +116 -73
- package/.eslintrc +0 -45
package/webpack.config.js
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Copyright (c) 2018-Present, Nitrogen Labs, Inc.
|
|
3
3
|
* Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.
|
|
4
4
|
*/
|
|
5
|
+
import {existsSync} from 'fs';
|
|
6
|
+
import {resolve as pathResolve} from 'path';
|
|
7
|
+
import {URL} from 'url';
|
|
8
|
+
|
|
5
9
|
import {StaticSitePlugin} from '@nlabs/webpack-plugin-static-site';
|
|
6
10
|
import autoprefixer from 'autoprefixer';
|
|
7
11
|
import CompressionWebpackPlugin from 'compression-webpack-plugin';
|
|
@@ -10,11 +14,9 @@ import cssnano from 'cssnano';
|
|
|
10
14
|
import DotenvPlugin from 'dotenv-webpack';
|
|
11
15
|
import {EsbuildPlugin} from 'esbuild-loader';
|
|
12
16
|
import FaviconsWebpackPlugin from 'favicons-webpack-plugin';
|
|
13
|
-
import {existsSync} from 'fs';
|
|
14
17
|
import {sync as globSync} from 'glob';
|
|
15
18
|
import HtmlWebPackPlugin from 'html-webpack-plugin';
|
|
16
19
|
import isEmpty from 'lodash/isEmpty.js';
|
|
17
|
-
import {resolve as pathResolve} from 'path';
|
|
18
20
|
import postcssBrowserReporter from 'postcss-browser-reporter';
|
|
19
21
|
import postcssCustomProperties from 'postcss-custom-properties';
|
|
20
22
|
import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';
|
|
@@ -25,7 +27,6 @@ import postcssPercentage from 'postcss-percentage';
|
|
|
25
27
|
import postcssPresetEnv from 'postcss-preset-env';
|
|
26
28
|
import postcssUrl from 'postcss-url';
|
|
27
29
|
import SVGSpriteMapPlugin from 'svg-spritemap-webpack-plugin';
|
|
28
|
-
import {URL} from 'url';
|
|
29
30
|
import {default as webpack} from 'webpack';
|
|
30
31
|
import {BundleAnalyzerPlugin} from 'webpack-bundle-analyzer';
|
|
31
32
|
import {merge} from 'webpack-merge';
|
|
@@ -60,7 +61,10 @@ const plugins = [
|
|
|
60
61
|
dependencies: true,
|
|
61
62
|
percentBy: null
|
|
62
63
|
}),
|
|
63
|
-
new DotenvPlugin({
|
|
64
|
+
new DotenvPlugin({
|
|
65
|
+
path: pathResolve(process.cwd(), '.env'),
|
|
66
|
+
systemvars: false
|
|
67
|
+
})
|
|
64
68
|
];
|
|
65
69
|
|
|
66
70
|
const isWeb = (preset || targetEnvironment) === 'web';
|
|
@@ -87,23 +91,29 @@ const globOptions = {
|
|
|
87
91
|
const svgPaths = `${sourceFullPath}/icons/**/**.svg`;
|
|
88
92
|
|
|
89
93
|
if(globSync(svgPaths, globOptions).length) {
|
|
90
|
-
plugins.push(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
plugins.push(
|
|
95
|
+
new SVGSpriteMapPlugin(svgPaths, {
|
|
96
|
+
input: {
|
|
97
|
+
allowDuplicates: false
|
|
98
|
+
},
|
|
99
|
+
output: {
|
|
100
|
+
chunk: {keep: true},
|
|
101
|
+
filename: './icons/icons.svg'
|
|
102
|
+
},
|
|
103
|
+
sprite: {
|
|
104
|
+
prefix: false
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
);
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
// If there is are static directories, make sure we copy the files over
|
|
105
111
|
const staticPaths = [];
|
|
106
|
-
const watchIgnorePaths = [
|
|
112
|
+
const watchIgnorePaths = [
|
|
113
|
+
`${sourceFullPath}/**/**.gif`,
|
|
114
|
+
`${sourceFullPath}/**/**.jpg`,
|
|
115
|
+
`${sourceFullPath}/**/**.png`
|
|
116
|
+
];
|
|
107
117
|
const imagePath = `${sourceFullPath}/images/`;
|
|
108
118
|
const fontPath = `${sourceFullPath}/fonts/`;
|
|
109
119
|
const docPath = `${sourceFullPath}/docs/`;
|
|
@@ -127,13 +137,15 @@ if(staticPaths.length) {
|
|
|
127
137
|
}
|
|
128
138
|
|
|
129
139
|
if(existsSync(`${sourceFullPath}/${lexConfig.entryHTML}`)) {
|
|
130
|
-
plugins.push(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
plugins.push(
|
|
141
|
+
new HtmlWebPackPlugin({
|
|
142
|
+
filename: './index.html',
|
|
143
|
+
minify: isProduction,
|
|
144
|
+
scriptLoading: 'defer',
|
|
145
|
+
showErrors: !isProduction,
|
|
146
|
+
template: `${sourceFullPath}/${lexConfig.entryHTML}`
|
|
147
|
+
})
|
|
148
|
+
);
|
|
137
149
|
}
|
|
138
150
|
|
|
139
151
|
let outputFilename = outputFile;
|
|
@@ -161,7 +173,10 @@ const webpackPath = relativeNodePath('webpack', dirName);
|
|
|
161
173
|
// Aliases
|
|
162
174
|
const aliasPaths = {
|
|
163
175
|
'@nlabs/arkhamjs': relativeNodePath('@nlabs/arkhamjs', process.cwd()),
|
|
164
|
-
'@nlabs/arkhamjs-utils-react': relativeNodePath(
|
|
176
|
+
'@nlabs/arkhamjs-utils-react': relativeNodePath(
|
|
177
|
+
'@nlabs/arkhamjs-utils-react',
|
|
178
|
+
process.cwd()
|
|
179
|
+
),
|
|
165
180
|
'core-js': relativeNodePath('core-js', dirName),
|
|
166
181
|
process: relativeNodePath('process', dirName),
|
|
167
182
|
react: relativeNodePath('react', process.cwd()),
|
|
@@ -183,7 +198,9 @@ export default (webpackEnv, webpackOptions) => {
|
|
|
183
198
|
const webpackConfig = {
|
|
184
199
|
bail: true,
|
|
185
200
|
cache: !isProduction,
|
|
186
|
-
devtool: isProduction
|
|
201
|
+
devtool: isProduction
|
|
202
|
+
? 'inline-cheap-module-source-map'
|
|
203
|
+
: 'eval-cheap-module-source-map',
|
|
187
204
|
entry: {
|
|
188
205
|
index: `${sourceFullPath}/${lexConfig.entryJs}`
|
|
189
206
|
},
|
|
@@ -302,26 +319,29 @@ export default (webpackEnv, webpackOptions) => {
|
|
|
302
319
|
}
|
|
303
320
|
]
|
|
304
321
|
},
|
|
305
|
-
optimization:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
322
|
+
optimization:
|
|
323
|
+
isProduction && isWeb
|
|
324
|
+
? {
|
|
325
|
+
minimizer: [
|
|
326
|
+
new EsbuildPlugin({
|
|
327
|
+
css: true,
|
|
328
|
+
target: targetEnvironment
|
|
329
|
+
})
|
|
330
|
+
],
|
|
331
|
+
runtimeChunk: 'single',
|
|
332
|
+
splitChunks: {
|
|
333
|
+
cacheGroups: {
|
|
334
|
+
vendor: {
|
|
335
|
+
chunks: 'all',
|
|
336
|
+
minSize: 0,
|
|
337
|
+
name: 'vendors',
|
|
338
|
+
test: /[\\/]node_modules[\\/]/
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
usedExports: true
|
|
321
343
|
}
|
|
322
|
-
|
|
323
|
-
usedExports: true
|
|
324
|
-
} : {},
|
|
344
|
+
: {},
|
|
325
345
|
output: {
|
|
326
346
|
filename: outputFilename,
|
|
327
347
|
library: libraryName,
|
|
@@ -333,9 +353,20 @@ export default (webpackEnv, webpackOptions) => {
|
|
|
333
353
|
recordsPath: relativeFilePath('webpack.records.json', process.cwd()),
|
|
334
354
|
resolve: {
|
|
335
355
|
alias,
|
|
336
|
-
extensions: [
|
|
356
|
+
extensions: [
|
|
357
|
+
'.*',
|
|
358
|
+
'.mjs',
|
|
359
|
+
'.js',
|
|
360
|
+
'.ts',
|
|
361
|
+
'.tsx',
|
|
362
|
+
'.jsx',
|
|
363
|
+
'.json',
|
|
364
|
+
'.gql',
|
|
365
|
+
'.graphql'
|
|
366
|
+
],
|
|
337
367
|
fallback: {
|
|
338
368
|
assert: relativeNodePath('assert', dirName),
|
|
369
|
+
buffer: relativeNodePath('buffer', dirName),
|
|
339
370
|
crypto: relativeNodePath('crypto-browserify', dirName),
|
|
340
371
|
http: relativeNodePath('stream-http', dirName),
|
|
341
372
|
https: relativeNodePath('https-browserify', dirName),
|
|
@@ -361,7 +392,10 @@ export default (webpackEnv, webpackOptions) => {
|
|
|
361
392
|
webpack: webpackPath
|
|
362
393
|
};
|
|
363
394
|
webpackConfig.optimization = {minimize: false};
|
|
364
|
-
webpackConfig.entry.wps = relativeNodePath(
|
|
395
|
+
webpackConfig.entry.wps = relativeNodePath(
|
|
396
|
+
'webpack-plugin-serve/client.js',
|
|
397
|
+
dirName
|
|
398
|
+
);
|
|
365
399
|
webpackConfig.stats = {errorDetails: true};
|
|
366
400
|
webpackConfig.plugins.push(
|
|
367
401
|
new WebpackPluginServe({
|
|
@@ -370,7 +404,7 @@ export default (webpackEnv, webpackOptions) => {
|
|
|
370
404
|
},
|
|
371
405
|
historyFallback: {
|
|
372
406
|
disableDotRule: true,
|
|
373
|
-
htmlAcceptHeaders: ['text/html','*/*'],
|
|
407
|
+
htmlAcceptHeaders: ['text/html', '*/*'],
|
|
374
408
|
index: '/index.html',
|
|
375
409
|
logger: console.log.bind(console),
|
|
376
410
|
rewrites: [
|
|
@@ -400,23 +434,27 @@ export default (webpackEnv, webpackOptions) => {
|
|
|
400
434
|
},
|
|
401
435
|
hmr: false,
|
|
402
436
|
log: {level: 'trace'},
|
|
403
|
-
middleware: (app) =>
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
437
|
+
middleware: (app) =>
|
|
438
|
+
app.use(async (ctx, next) => {
|
|
439
|
+
if(ctx.path.match(/^\/wps/)) {
|
|
440
|
+
const {accept, Accept, ...remainingHeaders} =
|
|
441
|
+
ctx.request.header;
|
|
442
|
+
ctx.request.header = remainingHeaders;
|
|
443
|
+
}
|
|
444
|
+
await next();
|
|
445
|
+
}),
|
|
410
446
|
open: process.env.WEBPACK_DEV_OPEN === 'true',
|
|
411
447
|
port: 7001,
|
|
412
448
|
progress: 'minimal',
|
|
413
449
|
static: [outputFullPath],
|
|
414
450
|
status: true
|
|
415
|
-
})
|
|
451
|
+
})
|
|
416
452
|
);
|
|
417
453
|
|
|
418
454
|
if(bundleAnalyzer) {
|
|
419
|
-
webpackConfig.plugins.push(
|
|
455
|
+
webpackConfig.plugins.push(
|
|
456
|
+
new BundleAnalyzerPlugin({openAnalyzer: false})
|
|
457
|
+
);
|
|
420
458
|
}
|
|
421
459
|
|
|
422
460
|
if(watch) {
|
|
@@ -432,25 +470,30 @@ export default (webpackEnv, webpackOptions) => {
|
|
|
432
470
|
const siteLogo = `${sourceFullPath}/images/logo.png`;
|
|
433
471
|
|
|
434
472
|
if(existsSync(siteLogo)) {
|
|
435
|
-
plugins.push(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
473
|
+
plugins.push(
|
|
474
|
+
new FaviconsWebpackPlugin({
|
|
475
|
+
icons: {
|
|
476
|
+
android: true,
|
|
477
|
+
appleIcon: true,
|
|
478
|
+
appleStartup: false,
|
|
479
|
+
coast: false,
|
|
480
|
+
favicons: true,
|
|
481
|
+
firefox: false,
|
|
482
|
+
opengraph: true,
|
|
483
|
+
twitter: true,
|
|
484
|
+
windows: false,
|
|
485
|
+
yandex: false
|
|
486
|
+
},
|
|
487
|
+
logo: siteLogo
|
|
488
|
+
})
|
|
489
|
+
);
|
|
450
490
|
}
|
|
451
491
|
|
|
452
492
|
if(isStatic) {
|
|
453
|
-
webpackConfig.plugins.push(
|
|
493
|
+
webpackConfig.plugins.push(
|
|
494
|
+
new StaticSitePlugin(),
|
|
495
|
+
new webpack.HashedModuleIdsPlugin()
|
|
496
|
+
);
|
|
454
497
|
}
|
|
455
498
|
}
|
|
456
499
|
|
package/.eslintrc
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"styleguidejs/typescript"
|
|
4
|
-
],
|
|
5
|
-
"rules": {
|
|
6
|
-
"import/order": [
|
|
7
|
-
"error",
|
|
8
|
-
{
|
|
9
|
-
"groups": [
|
|
10
|
-
"builtin",
|
|
11
|
-
"external",
|
|
12
|
-
"internal",
|
|
13
|
-
"parent",
|
|
14
|
-
"sibling",
|
|
15
|
-
"index"
|
|
16
|
-
],
|
|
17
|
-
"pathGroups": [
|
|
18
|
-
{
|
|
19
|
-
"pattern": "#!",
|
|
20
|
-
"group": "builtin",
|
|
21
|
-
"position": "before"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"pattern": "/**/*|//*",
|
|
25
|
-
"group": "builtin",
|
|
26
|
-
"position": "after"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"pattern": "type *",
|
|
30
|
-
"group": "index",
|
|
31
|
-
"position": "after"
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"newlines-between": "always",
|
|
35
|
-
"alphabetize": {
|
|
36
|
-
"order": "asc",
|
|
37
|
-
"caseInsensitive": true
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
"import/extensions": 0,
|
|
42
|
-
"jest/valid-expect": 0,
|
|
43
|
-
"no-useless-escape": 0
|
|
44
|
-
}
|
|
45
|
-
}
|