minista 1.1.0 → 1.2.0

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/README.md CHANGED
@@ -78,12 +78,12 @@ src
78
78
  import { render } from "minista" // Required!
79
79
 
80
80
  const PageHome = () => {
81
- return render( // Required!
81
+ return (
82
82
  <h1>Hello</h1>
83
83
  )
84
84
  }
85
85
 
86
- export default PageHome
86
+ export default render(<PageHome />) // Required!
87
87
  ```
88
88
 
89
89
  ## Commands
@@ -119,7 +119,7 @@ $ minista build
119
119
  import { render, Comment } from "minista"
120
120
 
121
121
  const PageHome = () => {
122
- return render(
122
+ return (
123
123
  <>
124
124
  <Comment text="Comment Test" />
125
125
  <h1>Hello</h1>
@@ -127,7 +127,7 @@ const PageHome = () => {
127
127
  )
128
128
  }
129
129
 
130
- export default PageHome
130
+ export default render(<PageHome />)
131
131
  ```
132
132
 
133
133
  ```html
@@ -158,9 +158,6 @@ export default PageHome
158
158
  const MiniCssExtractPlugin = require("mini-css-extract-plugin")
159
159
  const CopyPlugin = require("copy-webpack-plugin")
160
160
 
161
- // Example of dev mode
162
- const isDev = process.env.NODE_ENV !== "production"
163
-
164
161
  const webpackConfig = {
165
162
  // Merge
166
163
  devServer: {
@@ -168,6 +165,22 @@ const webpackConfig = {
168
165
  },
169
166
  // Replace
170
167
  entry: { custom: "./src/assets/index.js" },
168
+ module: {
169
+ rules: [
170
+ // Merge: loader options
171
+ {
172
+ test: /\.css$/,
173
+ use: [
174
+ {
175
+ loader: "css-loader",
176
+ options: {
177
+ url: false,
178
+ },
179
+ },
180
+ ],
181
+ },
182
+ ],
183
+ },
171
184
  plugins: [
172
185
  // Replace
173
186
  new MiniCssExtractPlugin({
@@ -178,10 +191,7 @@ const webpackConfig = {
178
191
  patterns: [{ from: "./static", to: "./", noErrorOnMissing: true }],
179
192
  }),
180
193
  ],
181
-
182
- // All optimization is replaced.
183
194
  optimization: {
184
- minimize: !isDev,
185
195
  minimizer: [
186
196
  /* Replace plugins */
187
197
  ],
package/cli.js CHANGED
@@ -3,7 +3,7 @@ const fs = require("fs")
3
3
  const path = require("path")
4
4
  const glob = require("glob")
5
5
  const webpack = require("webpack")
6
- const { mergeWithCustomize, customizeObject, unique } = require("webpack-merge")
6
+ const { mergeWithRules, unique } = require("webpack-merge")
7
7
  const webpackDevServer = require("webpack-dev-server")
8
8
  const beautify = require("js-beautify")
9
9
 
@@ -20,17 +20,30 @@ function getUserWebpackConfig() {
20
20
  }
21
21
 
22
22
  function getMergedWebpackConfig({ config, userConfig }) {
23
- const mergedConfig = mergeWithCustomize({
24
- customizeObject: customizeObject({
23
+ const mergedConfig = mergeWithRules(
24
+ {
25
25
  entry: "replace",
26
- optimization: "replace",
27
- }),
28
- customizeArray: unique(
29
- "plugins",
30
- ["MiniCssExtractPlugin", "CopyPlugin"],
31
- (plugin) => plugin.constructor && plugin.constructor.name
32
- ),
33
- })(config, userConfig)
26
+ module: {
27
+ rules: {
28
+ test: "match",
29
+ use: {
30
+ loader: "match",
31
+ options: "merge",
32
+ },
33
+ },
34
+ },
35
+ optimization: {
36
+ minimizer: "replace",
37
+ },
38
+ },
39
+ {
40
+ customizeArray: unique(
41
+ "plugins",
42
+ ["MiniCssExtractPlugin", "CopyPlugin"],
43
+ (plugin) => plugin.constructor && plugin.constructor.name
44
+ ),
45
+ }
46
+ )(config, userConfig)
34
47
  const filterdPlugins = filterWebpackPlugins({
35
48
  plugins: mergedConfig.plugins,
36
49
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "minista",
3
3
  "description": "Mini static site generator that can be written in React (JSX) for web coding",
4
- "version": "1.1.0",
4
+ "version": "1.2.0",
5
5
  "bin": {
6
6
  "minista": "cli.js"
7
7
  },
package/webpack.config.js CHANGED
@@ -115,7 +115,7 @@ const webpackConfig = {
115
115
  path: path.resolve("dist"),
116
116
  publicPath: "/",
117
117
  filename: "assets/[name].js",
118
- assetModuleFilename: "assets/images/[name].[ext]",
118
+ assetModuleFilename: "assets/images/[name][ext]",
119
119
  },
120
120
  module: {
121
121
  rules: [
@@ -195,7 +195,7 @@ const webpackConfig = {
195
195
  test: /\.(woff2?|eot|ttf|otf)$/i,
196
196
  type: "asset/resource",
197
197
  generator: {
198
- filename: "assets/fonts/[name].[ext]",
198
+ filename: "assets/fonts/[name][ext]",
199
199
  },
200
200
  },
201
201
  {
@@ -229,7 +229,12 @@ const webpackConfig = {
229
229
  }),
230
230
  new CopyPlugin({
231
231
  patterns: [
232
- { from: "./public", to: path.resolve("dist"), noErrorOnMissing: true },
232
+ {
233
+ from: "./public",
234
+ to: path.resolve("dist"),
235
+ noErrorOnMissing: true,
236
+ info: { minimized: true },
237
+ },
233
238
  ],
234
239
  }),
235
240
  ],