Site reorg: Remove site/ subpath (#306)

Unfortunately, for proper package pathing, need to remove the `site/`
subpath. This includes:
- Moving everything back into root
- Adding a `copy-site.sh` script to copy resources into `mkdocs/site/`
before building the site with mkdocs.
- Also update examples to ensure all are loading the local sw.js / ui.js
- Consolidate examples in `docs/examples`
- Consolidate assets under src/assets/
- Move `favicons` to root
- Reformat and relint
- Tests: update playwright tests to use mkdocs output, add test for
embed in docs
- bump to 2.0.0-beta.2
This commit is contained in:
Ilya Kreymer
2024-04-09 23:07:23 -07:00
committed by GitHub
parent fcd59b634b
commit 92343d59f7
82 changed files with 181 additions and 139 deletions
+9 -17
View File
@@ -72,10 +72,7 @@ const electronMainConfig = (/*env, argv*/) => {
}),
new webpack.BannerPlugin(BANNER_TEXT),
new CopyPlugin({
patterns: [
// { from: "node_modules/classic-level/prebuilds/", to: "prebuilds" },
{ from: "build/extra_prebuilds/", to: "prebuilds" },
],
patterns: [{ from: "build/extra_prebuilds/", to: "prebuilds" }],
}),
],
};
@@ -105,22 +102,17 @@ const browserConfig = (/*env, argv*/) => {
ui: "./src/index.ts",
};
//const patterns = [{ from: "package.json", to: "_data/package.json" }];
let patterns = [{
from: "src/assets/favicons",
to: "site/favicons",
}];
const extraPlugins = [];
if (isDevServer) {
entry["sw"] = "@webrecorder/wabac/src/sw.js";
} else {
patterns.push({
from: "node_modules/@webrecorder/wabac/dist/sw.js",
to: "site/sw.js",
});
const patterns = [
{ from: "node_modules/@webrecorder/wabac/dist/sw.js", to: "sw.js" },
];
extraPlugins.push(new CopyPlugin({ patterns }));
}
/** @type {import('webpack').Configuration} */
const config = {
target: "web",
@@ -136,7 +128,7 @@ const browserConfig = (/*env, argv*/) => {
output: {
path: path.join(__dirname),
filename: "site/[name].js",
filename: "[name].js",
libraryTarget: "self",
globalObject: "self",
publicPath: "/",
@@ -146,7 +138,7 @@ const browserConfig = (/*env, argv*/) => {
compress: true,
port: 9990,
open: false,
static: path.join(__dirname, "site"),
static: __dirname,
//publicPath: "/"
},
@@ -173,7 +165,7 @@ const browserConfig = (/*env, argv*/) => {
__VERSION__: JSON.stringify(package_json.version),
}),
new webpack.BannerPlugin(BANNER_TEXT),
new CopyPlugin({ patterns }),
...extraPlugins,
],
module: {