Compare commits

..

1 commit

Author SHA1 Message Date
zx
db8b768b37
Merge 673fb8f8dd into 01906205f0 2024-10-14 21:22:57 +02:00
6 changed files with 874 additions and 1121 deletions

View file

@ -236,63 +236,42 @@ export function copyYAMLComments(doc : Document, src : Document) {
/** /**
* Copy yaml comments from srcItems to items * Copy yaml comments from srcItems to items
* Attempts to preserve comments by matching content rather than just array indices * Typescript is super annoying here, so I have to use any here
* TODO: Since comments are belong to the array index, the comments will be lost if the order of the items is changed or removed or added.
*/ */
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
function copyYAMLCommentsItems(items: any, srcItems: any) { function copyYAMLCommentsItems(items : any, srcItems : any) {
if (!items || !srcItems) { if (!items || !srcItems) {
return; return;
} }
// First pass - try to match items by their content
for (let i = 0; i < items.length; i++) { for (let i = 0; i < items.length; i++) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const item: any = items[i]; const item : any = items[i];
// Try to find matching source item by content
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const srcIndex = srcItems.findIndex((srcItem: any) => const srcItem : any = srcItems[i];
JSON.stringify(srcItem.value) === JSON.stringify(item.value) &&
JSON.stringify(srcItem.key) === JSON.stringify(item.key)
);
if (srcIndex !== -1) { if (!srcItem) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any continue;
const srcItem: any = srcItems[srcIndex]; }
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const nextSrcItem: any = srcItems[srcIndex + 1];
if (item.key && srcItem.key) { if (item.key && srcItem.key) {
item.key.comment = srcItem.key.comment; item.key.comment = srcItem.key.comment;
item.key.commentBefore = srcItem.key.commentBefore; item.key.commentBefore = srcItem.key.commentBefore;
} }
if (srcItem.comment) { if (srcItem.comment) {
item.comment = srcItem.comment; item.comment = srcItem.comment;
} }
// Handle comments between array items if (item.value && srcItem.value) {
if (nextSrcItem && nextSrcItem.commentBefore) { if (typeof item.value === "object" && typeof srcItem.value === "object") {
if (items[i + 1]) { item.value.comment = srcItem.value.comment;
items[i + 1].commentBefore = nextSrcItem.commentBefore; item.value.commentBefore = srcItem.value.commentBefore;
}
}
// Handle trailing comments after array items if (item.value.items && srcItem.value.items) {
if (srcItem.value && srcItem.value.comment) { copyYAMLCommentsItems(item.value.items, srcItem.value.items);
if (item.value) {
item.value.comment = srcItem.value.comment;
}
}
if (item.value && srcItem.value) {
if (typeof item.value === "object" && typeof srcItem.value === "object") {
item.value.comment = srcItem.value.comment;
item.value.commentBefore = srcItem.value.commentBefore;
if (item.value.items && srcItem.value.items) {
copyYAMLCommentsItems(item.value.items, srcItem.value.items);
}
} }
} }
} }

View file

@ -33,7 +33,7 @@ VOLUME /app/data
EXPOSE 5001 EXPOSE 5001
HEALTHCHECK --interval=60s --timeout=30s --start-period=60s --retries=5 CMD extra/healthcheck HEALTHCHECK --interval=60s --timeout=30s --start-period=60s --retries=5 CMD extra/healthcheck
ENTRYPOINT ["/usr/bin/dumb-init", "--"] ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["tsx", "./backend/index.ts"] CMD ["bash", "-c", "node ./extra/clean-tsx-tmp.js && tsx ./backend/index.ts"]
############################################ ############################################
# Mark as Nightly # Mark as Nightly

13
extra/clean-tsx-tmp.js Normal file
View file

@ -0,0 +1,13 @@
/*
* This script is used to clean up the tmp directory.
* A workaround for https://github.com/louislam/dockge/issues/353
*/
import * as fs from "fs";
try {
fs.rmSync("/tmp/tsx-0", {
recursive: true,
});
} catch (e) {
}

View file

@ -247,6 +247,7 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.main-terminal { .main-terminal {
height: 100%; height: 100%;
overflow-x: scroll;
} }
</style> </style>

View file

@ -38,14 +38,14 @@
"croner": "~8.1.2", "croner": "~8.1.2",
"dayjs": "~1.11.13", "dayjs": "~1.11.13",
"dotenv": "~16.3.2", "dotenv": "~16.3.2",
"express": "~4.21.2", "express": "~4.21.1",
"express-static-gzip": "~2.1.8", "express-static-gzip": "~2.1.8",
"http-graceful-shutdown": "~3.1.13", "http-graceful-shutdown": "~3.1.13",
"jsonwebtoken": "~9.0.2", "jsonwebtoken": "~9.0.2",
"jwt-decode": "~3.1.2", "jwt-decode": "~3.1.2",
"knex": "~2.5.1", "knex": "~2.5.1",
"limiter-es6-compat": "~2.1.2", "limiter-es6-compat": "~2.1.2",
"mysql2": "~3.12.0", "mysql2": "~3.11.3",
"promisify-child-process": "~4.1.2", "promisify-child-process": "~4.1.2",
"redbean-node": "~0.3.3", "redbean-node": "~0.3.3",
"semver": "^7.6.3", "semver": "^7.6.3",
@ -53,7 +53,7 @@
"socket.io-client": "~4.8.0", "socket.io-client": "~4.8.0",
"timezones-list": "~3.0.3", "timezones-list": "~3.0.3",
"ts-command-line-args": "~2.5.1", "ts-command-line-args": "~2.5.1",
"tsx": "~4.19.2", "tsx": "~4.6.2",
"type-fest": "~4.3.3", "type-fest": "~4.3.3",
"yaml": "~2.3.4" "yaml": "~2.3.4"
}, },

1910
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff