@s-ui/bundler 8.0.0-beta.2 → 8.0.0-beta.6

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.
@@ -39,9 +39,13 @@ program
39
39
  })
40
40
  .parse(process.argv)
41
41
 
42
- const {clean = false, context} = program
42
+ const {
43
+ clean = false,
44
+ context,
45
+ linkPackage: packagesToLink = []
46
+ } = program.opts()
47
+
43
48
  config.context = context || config.context
44
- const packagesToLink = program.linkPackage || []
45
49
 
46
50
  const nextConfig = packagesToLink.length
47
51
  ? linkLoaderConfigBuilder({
@@ -25,7 +25,8 @@ const linkLoaderConfigBuilder = require('../loaders/linkLoaderConfigBuilder')
25
25
  const log = require('../shared/log')
26
26
 
27
27
  const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000
28
- const HOST = process.env.HOST || '0.0.0.0'
28
+ const {CI = false, HOST = '0.0.0.0'} = process.env
29
+ const DEFAULT_WATCH = !CI
29
30
 
30
31
  if (!module.parent) {
31
32
  program
@@ -43,6 +44,11 @@ if (!module.parent) {
43
44
  },
44
45
  []
45
46
  )
47
+ .option(
48
+ '-w, --watch',
49
+ 'Watch files and restart the server on change',
50
+ DEFAULT_WATCH
51
+ )
46
52
  .on('--help', () => {
47
53
  console.log(' Examples:')
48
54
  console.log('')
@@ -52,13 +58,15 @@ if (!module.parent) {
52
58
  console.log('')
53
59
  })
54
60
  .parse(process.argv)
55
- const {context} = program
61
+
62
+ const {context} = program.opts()
63
+
56
64
  webpackConfig.context = context || webpackConfig.context
57
65
  }
58
66
 
59
67
  const start = async ({
60
68
  config = webpackConfig,
61
- packagesToLink = program.linkPackage || []
69
+ packagesToLink = program.opts().linkPackage || []
62
70
  } = {}) => {
63
71
  clearConsole()
64
72
  // Warn and crash if required files are missing
@@ -78,7 +86,7 @@ const start = async ({
78
86
  const urls = prepareUrls(protocol, HOST, port)
79
87
  const nextConfig = linkLoaderConfigBuilder({
80
88
  config,
81
- linkAll: program.linkAll,
89
+ linkAll: program.opts().linkAll,
82
90
  packagesToLink
83
91
  })
84
92
  const compiler = createCompiler(nextConfig, urls)
@@ -35,7 +35,7 @@ const {
35
35
  path: publicPath,
36
36
  args: [entry],
37
37
  root = false
38
- } = program
38
+ } = program.opts()
39
39
 
40
40
  if (!output) {
41
41
  showError(new Error('--output is mandatory.'), program)
@@ -7,6 +7,14 @@ const {HOST, HTTPS} = process.env
7
7
  const protocol = HTTPS === 'true' ? 'https' : 'http'
8
8
  const host = HOST || '0.0.0.0'
9
9
 
10
+ const getWatchOptions = ({context, watch}) => {
11
+ return watch
12
+ ? {
13
+ ignored: ignoredFiles(context)
14
+ }
15
+ : false
16
+ }
17
+
10
18
  module.exports = config => ({
11
19
  allowedHosts: 'all',
12
20
  client: {
@@ -19,9 +27,7 @@ module.exports = config => ({
19
27
  },
20
28
  static: {
21
29
  directory: 'public',
22
- watch: {
23
- ignored: ignoredFiles(config.context)
24
- }
30
+ watch: getWatchOptions(config)
25
31
  },
26
32
  hot: true,
27
33
  https: protocol === 'https',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s-ui/bundler",
3
- "version": "8.0.0-beta.2",
3
+ "version": "8.0.0-beta.6",
4
4
  "description": "Config-free bundler for ES6 React apps.",
5
5
  "bin": {
6
6
  "sui-bundler": "./bin/sui-bundler.js"
@@ -27,7 +27,7 @@
27
27
  "autoprefixer": "10.4.0",
28
28
  "babel-loader": "8.2.3",
29
29
  "babel-preset-sui": "3",
30
- "commander": "6.2.1",
30
+ "commander": "8.3.0",
31
31
  "css-loader": "6.5.1",
32
32
  "css-minimizer-webpack-plugin": "3.1.3",
33
33
  "esbuild-loader": "2.16.0",
@@ -42,8 +42,8 @@
42
42
  "sass": "1.43.4",
43
43
  "speed-measure-webpack-plugin": "1.5.0",
44
44
  "style-loader": "3.3.1",
45
- "webpack": "5.61.0",
46
- "webpack-dev-server": "4.4.0",
45
+ "webpack": "5.64.1",
46
+ "webpack-dev-server": "4.5.0",
47
47
  "webpack-manifest-plugin": "4.0.2",
48
48
  "webpack-node-externals": "3.0.0"
49
49
  }
@@ -47,7 +47,12 @@ const webpackConfig = {
47
47
  resolve: {
48
48
  alias: {...aliasFromConfig},
49
49
  extensions: ['.js', '.json'],
50
- modules: ['node_modules', path.resolve(process.cwd())]
50
+ modules: ['node_modules', path.resolve(process.cwd())],
51
+ fallback: {
52
+ assert: false,
53
+ fs: false,
54
+ path: false
55
+ }
51
56
  },
52
57
  entry: MAIN_ENTRY_POINT,
53
58
  output: {