CI / build (push) Canceled after 0s
Phase 3: - Declare PowerPointApi 1.5 and replace template manifest values - Remove the dead command pipeline and the tracked Babel/polyfill setup - Extract constants, status/settings contexts, PowerPoint services, and an error boundary - Build with ES2020 and strict TypeScript; hash production assets and drop prod source maps - Add Vitest tests, CI, LICENSE, Node 20 pinning, and prune unused dependencies - Correct the README, user guide, developer guide, and audit notes Phase 4: - Add a persisted 16:9/4:3 slide size setting used by all layout tools - Add dark mode with Office/system theme detection - Make sections collapsible and move to accessible Fluent controls - Announce status through aria-live and add semantic status icons - Add a progress counter with cooperative cancellation and a Stop button - Update the tracked dependency tree for the pruned packages
101 lines
2.7 KiB
JavaScript
101 lines
2.7 KiB
JavaScript
/* eslint-disable no-undef */
|
|
|
|
const devCerts = require("office-addin-dev-certs");
|
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
const webpack = require("webpack");
|
|
const pkg = require("./package.json");
|
|
|
|
const urlDev = "https://localhost:3000/";
|
|
const urlProd = process.env.ADDIN_PROD_URL || "https://add-in.h3132.de/powerpoint/";
|
|
|
|
async function getHttpsOptions() {
|
|
const httpsOptions = await devCerts.getHttpsServerOptions();
|
|
return { ca: httpsOptions.ca, key: httpsOptions.key, cert: httpsOptions.cert };
|
|
}
|
|
|
|
module.exports = async (env, options) => {
|
|
const dev = options.mode === "development";
|
|
const config = {
|
|
devtool: dev ? "source-map" : false,
|
|
entry: {
|
|
react: ["react", "react-dom"],
|
|
taskpane: {
|
|
import: ["./src/taskpane/index.tsx", "./src/taskpane/taskpane.html"],
|
|
dependOn: "react",
|
|
},
|
|
},
|
|
output: {
|
|
clean: true,
|
|
filename: dev ? "[name].js" : "[name].[contenthash].js",
|
|
chunkFilename: dev ? "[name].js" : "[name].[contenthash].js",
|
|
},
|
|
resolve: {
|
|
extensions: [".ts", ".tsx", ".html", ".js"],
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
exclude: /node_modules/,
|
|
use: "ts-loader",
|
|
},
|
|
{
|
|
test: /\.html$/,
|
|
exclude: /node_modules/,
|
|
use: "html-loader",
|
|
},
|
|
{
|
|
test: /\.(png|jpg|jpeg|ttf|woff|woff2|gif|ico)$/,
|
|
type: "asset/resource",
|
|
generator: {
|
|
filename: "assets/[name][ext][query]",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
filename: "taskpane.html",
|
|
template: "./src/taskpane/taskpane.html",
|
|
chunks: ["taskpane", "react"],
|
|
}),
|
|
new CopyWebpackPlugin({
|
|
patterns: [
|
|
{
|
|
from: "assets/*",
|
|
to: "assets/[name][ext][query]",
|
|
},
|
|
{
|
|
from: "manifest*.xml",
|
|
to: "[name]" + "[ext]",
|
|
transform(content) {
|
|
if (dev) {
|
|
return content;
|
|
} else {
|
|
return content.toString().replace(new RegExp(urlDev, "g"), urlProd);
|
|
}
|
|
},
|
|
},
|
|
],
|
|
}),
|
|
],
|
|
devServer: {
|
|
hot: true,
|
|
headers: {
|
|
"Access-Control-Allow-Origin": "*",
|
|
},
|
|
server: {
|
|
type: "https",
|
|
options: env.WEBPACK_BUILD || options.https !== undefined ? options.https : await getHttpsOptions(),
|
|
},
|
|
port: process.env.npm_package_config_dev_server_port || 3000,
|
|
},
|
|
};
|
|
|
|
return config;
|
|
};
|