@stanlemon/webdev 0.1.200 → 0.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.
@@ -0,0 +1 @@
1
+ export { default } from "@stanlemon/eslint-config";
package/jest.config.js CHANGED
@@ -1,6 +1,5 @@
1
- const path = require("path");
2
-
3
- const babelOptions = require("./.babelrc.json");
1
+ import path from "path";
2
+ import babelOptions from "./.babelrc.json" assert { type: "json" };
4
3
 
5
4
  // Disable using esmodules everywhere
6
5
  babelOptions.presets.find(
@@ -19,9 +18,9 @@ const esModules = [
19
18
  "@stanlemon/server-with-auth",
20
19
  ].join("|");
21
20
 
22
- module.exports = {
21
+ export default {
23
22
  verbose: true,
24
- setupFilesAfterEnv: [path.resolve(__dirname, "./jest.setup.js")],
23
+ setupFilesAfterEnv: [path.resolve(import.meta.dirname, "./jest.setup.js")],
25
24
  testEnvironment: "jsdom",
26
25
  transform: {
27
26
  "^.+\\.(js|jsx|ts|tsx)?$": ["babel-jest", babelOptions],
@@ -32,7 +31,7 @@ module.exports = {
32
31
  moduleNameMapper: {
33
32
  "\\.(css|less|sass|scss)$": "identity-obj-proxy",
34
33
  // Force module uuid to resolve with the CJS entry point, because Jest does not support package.json.exports. See https://github.com/uuidjs/uuid/issues/451
35
- uuid: require.resolve("uuid"),
34
+ "^uuid$": "uuid",
36
35
  },
37
36
  testPathIgnorePatterns: ["/node_modules/", "/dist/"],
38
37
  coverageDirectory: "coverage",
package/jest.setup.js CHANGED
@@ -1,4 +1,4 @@
1
- require("@testing-library/jest-dom");
1
+ import "@testing-library/jest-dom";
2
2
 
3
3
  if (!global.setImmediate) {
4
4
  // This is as gross as it looks. It's a workaround for using PouchDB in tests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stanlemon/webdev",
3
- "version": "0.1.200",
3
+ "version": "0.2.0",
4
4
  "description": "My typical web development setup, but without all the copy and paste.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -13,11 +13,13 @@
13
13
  "engines": {
14
14
  "node": ">=20.0"
15
15
  },
16
- "type": "commonjs",
16
+ "type": "module",
17
17
  "scripts": {
18
18
  "build": "WEBDEV_ENTRY=./example.tsx webpack build",
19
19
  "lint": "eslint .",
20
- "lint:fix": "eslint --fix ."
20
+ "lint:fix": "eslint --fix .",
21
+ "test": "jest",
22
+ "tsc": "tsc"
21
23
  },
22
24
  "dependencies": {
23
25
  "@babel/cli": "^7.25.6",
package/tsconfig.json CHANGED
@@ -15,8 +15,8 @@
15
15
  "forceConsistentCasingInFileNames": true,
16
16
  "noFallthroughCasesInSwitch": true,
17
17
  "noImplicitAny": true,
18
- "module": "ES6",
19
- "moduleResolution": "node",
18
+ "module": "es2015",
19
+ "moduleResolution": "bundler",
20
20
  "resolveJsonModule": true,
21
21
  "isolatedModules": true,
22
22
  "jsx": "react-jsx"
package/webpack.config.js CHANGED
@@ -1,14 +1,13 @@
1
- const path = require("path");
2
- const { existsSync } = require("fs");
3
- const webpack = require("webpack");
4
- const HtmlWebpackPlugin = require("html-webpack-plugin");
5
- const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
6
- const { config } = require("dotenv");
1
+ import path from "path";
2
+ import { existsSync } from "fs";
3
+ import webpack from "webpack";
4
+ import HtmlWebpackPlugin from "html-webpack-plugin";
5
+ import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
6
+ import { config } from "dotenv";
7
+ import babelOptions from "./.babelrc.json" assert { type: "json" };
7
8
 
8
9
  config();
9
10
 
10
- const babelOptions = require("./.babelrc.json");
11
-
12
11
  function getWebdevEntry() {
13
12
  if (process.env.WEBDEV_ENTRY) {
14
13
  return process.env.WEBDEV_ENTRY;
@@ -33,19 +32,22 @@ const WEBDEV_PROXY = process.env.WEBDEV_PROXY ?? "";
33
32
  const WEBPACK_PUBLIC_PATH = process.env.WEBPACK_PUBLIC_PATH ?? "/";
34
33
  const NODE_ENV = process.env.NODE_ENV ?? "development";
35
34
 
36
- const proxy = {};
37
- WEBDEV_PROXY.split(";").forEach((entry) => {
38
- if (entry.indexOf("@") === -1) {
39
- return;
40
- }
41
- const path = entry.substring(0, entry.indexOf("@"));
42
- const host = entry.substring(entry.indexOf("@") + 1);
43
- proxy[path] = host;
44
- });
35
+ const proxy = WEBDEV_PROXY.split(";")
36
+ .map((entry) => {
37
+ if (entry.indexOf("@") === -1) {
38
+ return null;
39
+ }
40
+ const path = entry.substring(0, entry.indexOf("@"));
41
+ const host = entry.substring(entry.indexOf("@") + 1);
42
+
43
+ return { context: [path], target: host };
44
+ })
45
+ // Remove any nulls
46
+ .filter((e) => e !== null);
45
47
 
46
48
  const isDevelopment = NODE_ENV !== "production";
47
49
 
48
- module.exports = {
50
+ export default {
49
51
  mode: isDevelopment ? "development" : "production",
50
52
  entry: WEBDEV_ENTRY.split(";"),
51
53
  output: {
@@ -100,7 +102,6 @@ module.exports = {
100
102
  loader: "babel-loader",
101
103
  options: {
102
104
  ...babelOptions,
103
- plugins: [isDevelopment && "react-refresh/babel"].filter(Boolean),
104
105
  },
105
106
  },
106
107
  resolve: {
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- dist/**
package/.eslintrc.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": [
3
- "@stanlemon"
4
- ]
5
- }