Skip to content

Commit 39e3e8e

Browse files
committed
Merge branch 'develop' into beta
2 parents 24d228d + b5a23dd commit 39e3e8e

File tree

9 files changed

+1212
-227
lines changed

9 files changed

+1212
-227
lines changed

package-lock.json

Lines changed: 76 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"eslint-plugin-chai-friendly": "^1.1.0",
6767
"eslint-plugin-no-unsanitized": "^4.1.2",
6868
"eslint-plugin-prettier": "^5.5.4",
69-
"eslint-plugin-svelte": "^3.10.1",
69+
"eslint-plugin-svelte": "^3.12.5",
7070
"globals": "^16.4.0",
7171
"htm": "^3.1.1",
7272
"less-loader": "^12.3.0",
@@ -90,8 +90,8 @@
9090
"terser-webpack-plugin": "^5.3.14",
9191
"ts-loader": "^9.5.2",
9292
"typescript": "^5.9.3",
93-
"typescript-eslint": "^8.44.1",
94-
"vite": "^6.3.5",
93+
"typescript-eslint": "^8.46.1",
94+
"vite": "^6.4.1",
9595
"vitest": "^3.1.3",
9696
"webpack": "^5.102.1",
9797
"webpack-cli": "^6.0.1",

packages/stacks-classic/webpack.config.js

Lines changed: 0 additions & 78 deletions
This file was deleted.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import path from "path"
2+
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
3+
import cssnano from 'cssnano'
4+
import { fileURLToPath } from 'node:url';
5+
import { dirname } from 'node:path';
6+
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = dirname(__filename);
9+
10+
const tsRule = (configFile) => ({
11+
test: /\.tsx?$/,
12+
exclude: /node_modules/,
13+
use: [
14+
{
15+
loader: "ts-loader",
16+
options: configFile ? { configFile } : {},
17+
},
18+
],
19+
});
20+
21+
const lessRule = (minify = false) => ({
22+
test: /\.less$/,
23+
use: [
24+
MiniCssExtractPlugin.loader,
25+
{
26+
loader: "css-loader",
27+
options: {
28+
importLoaders: 1,
29+
url: false,
30+
},
31+
},
32+
{
33+
loader: "postcss-loader",
34+
options: {
35+
postcssOptions: {
36+
plugins: minify ? [cssnano] : [],
37+
},
38+
},
39+
},
40+
"less-loader",
41+
],
42+
});
43+
44+
const commonResolve = {
45+
extensions: [".tsx", ".ts", ".js"],
46+
};
47+
48+
const baseConfig = (isProd, minify) => ({
49+
name: "stacks" + (minify ? ".min" : ""),
50+
// run the minified bundle first, then the unminified bundle
51+
dependencies: minify ? [] : ["stacks.min"],
52+
mode: isProd ? "production" : "development",
53+
devtool: isProd ? false : "inline-source-map",
54+
entry: {
55+
// add .min to the file names of minified bundles
56+
[minify ? "stacks.min" : "stacks"]: path.resolve(
57+
__dirname,
58+
"lib/index.ts"
59+
),
60+
},
61+
output: {
62+
filename: `js/[name].js`,
63+
path: path.resolve(__dirname, "dist"),
64+
// don't empty out the dist folder when running the second build
65+
clean: minify,
66+
compareBeforeEmit: true,
67+
library: "Stacks",
68+
libraryTarget: "umd",
69+
},
70+
module: {
71+
rules: [tsRule("tsconfig.build.json"), lessRule(minify)],
72+
},
73+
optimization: {
74+
minimize: minify,
75+
},
76+
plugins: [
77+
new MiniCssExtractPlugin({
78+
filename: `css/[name].css`,
79+
}),
80+
],
81+
resolve: commonResolve,
82+
});
83+
84+
export { tsRule, lessRule, commonResolve };
85+
86+
// build the bundle twice - once minified and once not
87+
export default [
88+
(_, argv) => baseConfig(argv.mode === "production", true),
89+
(_, argv) => baseConfig(argv.mode === "production", false),
90+
];

packages/stacks-docs/webpack.config.js

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import path from "path";
2+
import fs from "fs";
3+
import {
4+
tsRule,
5+
lessRule,
6+
commonResolve,
7+
} from "../stacks-classic/webpack.config.mjs";
8+
import MiniCssExtractPlugin from "mini-css-extract-plugin";
9+
10+
import { fileURLToPath } from "node:url";
11+
import { dirname } from "node:path";
12+
13+
const __filename = fileURLToPath(import.meta.url);
14+
const __dirname = dirname(__filename);
15+
16+
export default (_, argv) => {
17+
const isProd = argv.mode === "production";
18+
19+
// load each entry.*.js file in assets/js as its own bundle
20+
const entries = fs
21+
.readdirSync(path.resolve(__dirname, "assets/js/"))
22+
.filter((f) => f.startsWith("entry."))
23+
.reduce((p, n) => {
24+
// { "entry.file": "path/to/entry.file.js" }
25+
p[n.slice(0, -3)] = path.resolve(__dirname, "assets/js/", n);
26+
return p;
27+
}, {});
28+
29+
return {
30+
mode: isProd ? "production" : "development",
31+
devtool: isProd ? false : "inline-source-map",
32+
entry: {
33+
docs: path.resolve(__dirname, "assets/js/index.ts"),
34+
...entries,
35+
},
36+
output: {
37+
filename: "[name].js",
38+
path: path.resolve(__dirname, "assets/dist"),
39+
clean: true,
40+
},
41+
module: {
42+
rules: [
43+
tsRule(), // no special config file here
44+
lessRule(isProd),
45+
],
46+
},
47+
plugins: [new MiniCssExtractPlugin()],
48+
resolve: commonResolve,
49+
devServer: {
50+
webSocketURL: {
51+
// 11ty/browsersync steal the default port (8080), so set it to something else
52+
port: 8081,
53+
},
54+
},
55+
};
56+
};

packages/stacks-svelte/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
"format": "prettier --write .",
2020
"lint": "svelte-check && eslint .",
2121
"lint:fix": "eslint . --fix",
22-
"test": "npm run build:dependencies && web-test-runner",
23-
"test:skipbuild": "web-test-runner",
22+
"test": "npm run build:dependencies && web-test-runner && npm run test:tools",
2423
"test:watch": "npm run build:dependencies && web-test-runner --watch",
24+
"test:tools": "npm run storybook:build && node --test tools/*.test.js",
2525
"storybook": "storybook dev -p 6006",
26-
"storybook:build": "storybook build -o netlify/dist"
26+
"storybook:build": "storybook build -o netlify/dist && npm run storybook:extract",
27+
"storybook:extract": "node tools/storybook-llms-extractor.js"
2728
},
2829
"peerDependencies": {
2930
"@stackoverflow/stacks": "^3.0.0-beta.0",

0 commit comments

Comments
 (0)