mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 15:04:52 +09:00
Drop unused dependencies from web_ui and tests (#1163)
* Take FieldData from antd instead of rc-field-form web_ui depended on rc-field-form 1.x for a single type import, while antd 5 uses rc-field-form 2.x. Derive the type from antd's FormProps and drop the dependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Move typescript to web_ui devDependencies web_ui only needs typescript to build its own types. The runtime dependency is a leftover from webpack's ts-loader, Vite doesn't use it, and it pulls in a 30 MB native compiler for anyone installing web_ui. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Use native FormData in controller route tests Node's FormData and Blob do what the form-data package did here, and fetch sets the multipart Content-Type header itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Remove leftover typedoc.json files TypeDoc was dropped in #1147, but these configs still ship in the published packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
3707fc35fc
9 files changed
+15
-42
No files matched your search
@@ -46,7 +46,6 @@
|
||||
"@types/node": "catalog:",
|
||||
"c8": "^12.0.0",
|
||||
"express": "catalog:",
|
||||
"form-data": "^4.0.6",
|
||||
"jsonwebtoken": "catalog:",
|
||||
"mocha": "^11.8.0",
|
||||
"oxlint": "^1.88.0",
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"entryPoints": ["index.ts"],
|
||||
"includeVersion": true
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"entryPoints": ["index.ts"],
|
||||
"includeVersion": true
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"entryPoints": ["index.ts"],
|
||||
"includeVersion": true
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"entryPoints": ["index.ts"],
|
||||
"includeVersion": true
|
||||
}
|
||||
@@ -45,7 +45,6 @@
|
||||
"os-browserify": "^0.3.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"process": "^0.11.10",
|
||||
"rc-field-form": "^1.44.0",
|
||||
"react": "catalog:",
|
||||
"react-dom": "catalog:",
|
||||
"react-markdown": "catalog:",
|
||||
@@ -53,7 +52,6 @@
|
||||
"react-router-dom": "catalog:",
|
||||
"semver": "catalog:",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"typescript": "catalog:",
|
||||
"util": "^0.12.5",
|
||||
"vite": "catalog:"
|
||||
},
|
||||
@@ -61,6 +59,7 @@
|
||||
"@types/node": "catalog:",
|
||||
"@types/react": "catalog:",
|
||||
"@types/react-dom": "^18.3.7",
|
||||
"@types/semver": "catalog:"
|
||||
"@types/semver": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
import React, { Fragment, memo, useCallback, useEffect, useContext, useRef, useState } from "react";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { FieldData } from "rc-field-form/lib/interface";
|
||||
|
||||
import {
|
||||
Button, Card, ColorPicker, Checkbox, Col, ConfigProvider, Descriptions, Form, Input, Pagination,
|
||||
Popconfirm, Row, Table, Tag, Typography, Select, Skeleton, Space, Spin, Switch, Modal, Tooltip,
|
||||
TablePaginationConfig, Alert, notification,
|
||||
TablePaginationConfig, Alert, notification, FormProps,
|
||||
} from "antd";
|
||||
|
||||
import {
|
||||
@@ -35,6 +34,8 @@ const { logger } = lib;
|
||||
const { Text } = Typography;
|
||||
const strcmp = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" }).compare;
|
||||
|
||||
type FieldData = NonNullable<FormProps["fields"]>[number];
|
||||
|
||||
type ModChange =
|
||||
{
|
||||
type: "name" | "description"
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"entryPoints": ["src/index.ts"],
|
||||
"includeVersion": true
|
||||
}
|
||||
+10
-16
@@ -1,6 +1,5 @@
|
||||
import assert from "node:assert/strict";
|
||||
import events from "node:events";
|
||||
import FormData from "form-data";
|
||||
import http from "node:http";
|
||||
|
||||
import { wait, expositionContentType } from "@clusterio/lib";
|
||||
@@ -308,27 +307,25 @@ describe("controller/src/routes", function() {
|
||||
let form;
|
||||
form = new FormData();
|
||||
form.append("instance_id", "123");
|
||||
form.append("file", "totally a zip file", { filename: "test.zip", contentType: "text/plain" });
|
||||
form.append("file", new Blob(["totally a zip file"], { type: "text/plain" }), "test.zip");
|
||||
response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Access-Token": testToken,
|
||||
...form.getHeaders(),
|
||||
},
|
||||
body: form.getBuffer(),
|
||||
body: form,
|
||||
});
|
||||
assert.equal(response.status, 400);
|
||||
assert.deepEqual(await response.json(), { request_errors: ["invalid file Content-Type"] });
|
||||
form = new FormData();
|
||||
form.append("file", "totally a zip file", { filename: "test.zip", contentType: "application/zip" });
|
||||
form.append("file", new Blob(["totally a zip file"], { type: "application/zip" }), "test.zip");
|
||||
form.append("instance_id", "123");
|
||||
response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Access-Token": testToken,
|
||||
...form.getHeaders(),
|
||||
},
|
||||
body: form.getBuffer(),
|
||||
body: form,
|
||||
});
|
||||
assert.equal(response.status, 400);
|
||||
assert.deepEqual(
|
||||
@@ -336,14 +333,13 @@ describe("controller/src/routes", function() {
|
||||
);
|
||||
form = new FormData();
|
||||
form.append("instance_id", "123");
|
||||
form.append("file", "totally a zip file", { filename: "test.txt", contentType: "application/zip" });
|
||||
form.append("file", new Blob(["totally a zip file"], { type: "application/zip" }), "test.txt");
|
||||
response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Access-Token": testToken,
|
||||
...form.getHeaders(),
|
||||
},
|
||||
body: form.getBuffer(),
|
||||
body: form,
|
||||
});
|
||||
assert.equal(response.status, 400);
|
||||
assert.deepEqual(
|
||||
@@ -351,14 +347,13 @@ describe("controller/src/routes", function() {
|
||||
);
|
||||
form = new FormData();
|
||||
form.append("instance_id", "invalid");
|
||||
form.append("file", "totally a zip file", { filename: "test.zip", contentType: "application/zip" });
|
||||
form.append("file", new Blob(["totally a zip file"], { type: "application/zip" }), "test.zip");
|
||||
response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Access-Token": testToken,
|
||||
...form.getHeaders(),
|
||||
},
|
||||
body: form.getBuffer(),
|
||||
body: form,
|
||||
});
|
||||
assert.equal(response.status, 400);
|
||||
assert.deepEqual(
|
||||
@@ -410,14 +405,13 @@ describe("controller/src/routes", function() {
|
||||
let form;
|
||||
form = new FormData();
|
||||
form.append("instance_id", "123");
|
||||
form.append("file", "totally a zip file", { filename: "test.zip", contentType: "application/zip" });
|
||||
form.append("file", new Blob(["totally a zip file"], { type: "application/zip" }), "test.zip");
|
||||
response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Access-Token": testToken,
|
||||
...form.getHeaders(),
|
||||
},
|
||||
body: form.getBuffer(),
|
||||
body: form,
|
||||
});
|
||||
assert.equal(response.status, 500);
|
||||
assert.deepEqual(await response.json(), { errors: ["Something went wrong"], request_errors: [] });
|
||||
|
||||
Reference in new issue
Block a user