@stanlemon/webdev 0.1.148 → 0.1.150

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
@@ -1,5 +1,7 @@
1
1
  # Webdev
2
2
 
3
+ [![npm version](https://badge.fury.io/js/%40stanlemon%2Fwebdev.svg)](https://badge.fury.io/js/%40stanlemon%2Fwebdev)
4
+
3
5
  This repository contains all of my usual environment setup for babel, webpack and jest for developing React apps. I got tired of copying and pasting the same config files everywhere, so I put this together.
4
6
 
5
7
  To get started, either copy [apps/template](../../apps/template/) or create these files:
@@ -13,7 +15,7 @@ package.json
13
15
  "build": "NODE_ENV=production webpack",
14
16
  "test": "jest",
15
17
  "lint": "eslint --ext js,jsx,ts,tsx ./src/",
16
- "lint:format": "eslint --fix --ext js,jsx,ts,tsx ./src/"
18
+ "lint:fix": "eslint --fix --ext js,jsx,ts,tsx ./src/"
17
19
  },
18
20
  "dependencies": {
19
21
  "@stanlemon/webdev": "*"
package/jest.setup.js CHANGED
@@ -4,3 +4,15 @@ if (!global.setImmediate) {
4
4
  // This is as gross as it looks. It's a workaround for using PouchDB in tests.
5
5
  global.setImmediate = global.setTimeout; // ts: as unknown as typeof setImmediate;
6
6
  }
7
+
8
+ if (process.argv.includes("--silent")) {
9
+ global.console = {
10
+ ...console,
11
+ // Comment to expose a specific log level
12
+ log: jest.fn(),
13
+ debug: jest.fn(),
14
+ info: jest.fn(),
15
+ warn: jest.fn(),
16
+ error: jest.fn(),
17
+ };
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stanlemon/webdev",
3
- "version": "0.1.148",
3
+ "version": "0.1.150",
4
4
  "description": "My typical web development setup, but without all the copy and paste.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -15,23 +15,23 @@
15
15
  },
16
16
  "type": "commonjs",
17
17
  "scripts": {
18
- "test": "WEBDEV_ENTRY=./webpack.test.tsx webpack build",
18
+ "build": "WEBDEV_ENTRY=./example.tsx webpack build",
19
19
  "lint": "eslint --ext js,jsx,ts,tsx ./",
20
- "lint:format": "eslint --fix --ext js,jsx,ts,tsx ./"
20
+ "lint:fix": "eslint --fix --ext js,jsx,ts,tsx ./"
21
21
  },
22
22
  "dependencies": {
23
23
  "@babel/cli": "^7.23.4",
24
- "@babel/core": "^7.23.6",
24
+ "@babel/core": "^7.23.7",
25
25
  "@babel/plugin-transform-private-property-in-object": "^7.23.4",
26
- "@babel/preset-env": "^7.23.6",
26
+ "@babel/preset-env": "^7.23.7",
27
27
  "@babel/preset-react": "^7.23.3",
28
28
  "@babel/preset-typescript": "^7.23.3",
29
29
  "@peculiar/webcrypto": "^1.4.3",
30
30
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
31
31
  "@stanlemon/eslint-config": "*",
32
- "@testing-library/jest-dom": "^6.1.6",
32
+ "@testing-library/jest-dom": "^6.2.0",
33
33
  "@types/jest": "^29.5.11",
34
- "@types/react": "^18.2.45",
34
+ "@types/react": "^18.2.47",
35
35
  "@types/react-dom": "^18.2.18",
36
36
  "@types/webpack": "^5.28.5",
37
37
  "@types/webpack-env": "^1.18.4",
@@ -63,4 +63,4 @@
63
63
  "react": ">=17.0.0",
64
64
  "react-dom": ">=17.0.0"
65
65
  }
66
- }
66
+ }
package/webpack.config.js CHANGED
@@ -39,7 +39,7 @@ module.exports = {
39
39
  mode: isDevelopment ? "development" : "production",
40
40
  entry: WEBDEV_ENTRY.split(";"),
41
41
  output: {
42
- filename: "[name].[contenthash].js",
42
+ filename: "static/[name].[contenthash].js",
43
43
  path: path.resolve("./", "dist"),
44
44
  publicPath: WEBPACK_PUBLIC_PATH,
45
45
  },
@@ -63,7 +63,7 @@ module.exports = {
63
63
  );
64
64
  },
65
65
  chunks: "initial",
66
- filename: "react.[contenthash].js",
66
+ filename: "static/react.[contenthash].js",
67
67
  priority: 1,
68
68
  maxInitialRequests: 2,
69
69
  minChunks: 1,
@@ -72,6 +72,7 @@ module.exports = {
72
72
  test: /[\\/]node_modules[\\/]/,
73
73
  name: "vendors",
74
74
  chunks: "all",
75
+ filename: "static/vendors.[contenthash].js",
75
76
  },
76
77
  },
77
78
  },
@@ -123,8 +124,9 @@ module.exports = {
123
124
  html = html.substring(1);
124
125
  inject = false;
125
126
  }
127
+
126
128
  return new HtmlWebpackPlugin({
127
- filename: path.basename(html),
129
+ filename: path.resolve("./", "dist", html),
128
130
  inject,
129
131
  ...(existsSync(html) ? { template: html } : {}),
130
132
  });
@@ -134,7 +136,7 @@ module.exports = {
134
136
  }),
135
137
  ],
136
138
  ...[
137
- !isDevelopment &&
139
+ isDevelopment &&
138
140
  new BundleAnalyzerPlugin({
139
141
  analyzerMode: "static",
140
142
  openAnalyzer: false,
File without changes