Commit Graph

13812 Commits (abcf08e68cdd02c7eac0ecb459ca958045e522cc)
 

Author SHA1 Message Date
Adorian Doran e74de6105a client/options: minor tweaks 2025-03-08 01:59:29 +07:00
Panagiotis Papadopoulos 91c37fa235 chore(routes/electron): disable lint rule for specific line
in this case using "{}" allows all primitive values, which seems to be what is required here.
so let's disable the rule "@typescript-eslint/no-empty-object-type" for this line
2025-03-08 00:54:29 +07:00
Panagiotis Papadopoulos b56ff558a4 refactor(routes/api/import): get rid of "any" type in catch blocks 2025-03-08 00:39:01 +07:00
Panagiotis Papadopoulos 07fd5327b1 refactor(routes/custom): get rid of "any" type catch blocks 2025-03-08 00:22:12 +07:00
Panagiotis Papadopoulos 4b6972fb21 refactor(error_handlers): get rid of "any" type in csrf error handler 2025-03-08 00:15:46 +07:00
Panagiotis Papadopoulos 76574f0938 refactor(error_handlers): use HttpError classes in errorHandler
also gets rid of "any" type :-)
2025-03-08 00:14:24 +07:00
Adorian Doran 6d39c404c4 client/options/appearance/ribbon widgets: place checkboxes on separate lines 2025-03-08 01:01:05 +07:00
Adorian Doran d24b5a232f style: fix the form text color 2025-03-08 00:54:53 +07:00
Adorian Doran 9a09a89066 client/options/appearance: change the layout of the "Native title bar" and "Enable background effects" options 2025-03-08 00:52:02 +07:00
Panagiotis Papadopoulos 0c8df7f885 refactor(error_handlers): use newly added ForbiddenError class 2025-03-07 23:30:12 +07:00
Panagiotis Papadopoulos 70e227f4c3 build(Docker): improve image size, by deleting node-compile-cache 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 907b8c503e build: copy package-lock.json into dist folder as well 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 38690053a8 build(Docker): improve image size, by deleting unnecessary node_modules fodler from dist folder
added a TODO as well, to get rid of this strange step here at some point
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 3553d64060 build(Docker/ci): get rid of running partial build locally
this is now handled fully inside Docker.

exception for "test_docker" job in "main-docker"
-> it seems that one needs to be there still, since it runs Playwright tests from outside the container
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos f544a84f6d build(Docker): simplify Docker alpine build and runtime stage
same changes as for the "non-alpine" Dockerfile previously commited, but adapted to Alpine.

this Dockerfile is aimed at production builds, i.e. trying to keep size as small as possible at the cost of "rebuild speed", due to missed docker cache opportunities.

Build Stage:
* do the complete build inside docker as oposed to the previous "hybrid", where tsc was run locally and the output got copied into the Docker build stage → you can now build this with Docker, without having to install the whole node/TS env locally

* build into a "build" subfolder, for easier clean up during build stage

* get rid of now unnecessary extra file/asset handling, as this is now handled by `npm run build:prepare-dist`

* no `npm prune` needed here, as we delete the whole build folder anyways in the last build step

Runtime stage:
* move the "electron" dep removal from the builder stage to the runtime stage, before installing the dependencies

* move to `npm ci` for reproducible installations – but only installing runtime deps here

* get rid of now unnecessary copying commands from the builder stage, as everything is now neatly available in "/usr/src/app"
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 68875683af build(Docker): get rid of apparently unused packages at build stage 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos e9824c4568 build(dockerignore): ignore unnecessary files 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos c68b0b02e4 build(Docker): simplify Docker build and runtime stage
this Dockerfile is aimed at production builds, i.e. trying to keep size as small as possible at the cost of "rebuild speed", due to missed docker cache opportunities.

Build Stage:
* do the complete build inside docker as oposed to the previous "hybrid", where tsc was run locally and the output got copied into the Docker build stage → you can now build this with Docker, without having to install the whole node/TS env locally

* build into a "build" subfolder, for easier clean up during build stage

* get rid of now unnecessary extra file/asset handling, as this is now handled by `npm run build:prepare-dist`

* no `npm prune` needed here, as we delete the whole build folder anyways in the last build step

Runtime stage:
* move the "electron" dep removal from the builder stage to the runtime stage, before installing the dependencies

* move to `npm ci` for reproducible installations – but only installing runtime deps here

* get rid of now unnecessary copying commands from the builder stage, as everything is now neatly available in "/usr/src/app"
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 2973d38db0 build(Docker): move server-package.json preparation into Dockerfile 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos bb7a4f9bc3 build(Docker): comment out seemingly useless installation of build dependencies 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos e389592017 build(copy-dist): copying build folder is not required anymore
TS and Webpack build into the dist folder directly now
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 5e289ea12d build: get rid of intermediary "build" folder -> use "dist" directly 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 3032156b45 build(copy-dist): execute code in try/catch -> get rid of function
since we don't export this anywhere, might as well just call the steps directly
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos d75cf8c11e build(copy-dist): consolidate nodeModules copying into a single loop 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos a816abb372 build(copy-dist): use sync copying
since this is a "standalone" script we are running and no other JS scritps are running "in the background", there's no real benefit for async here.
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 37f1525d0e build(copy-dist): remove unused paths 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos dbeae62709 build(copy-dist): simplify "copyNodeModuleFileOrFolder" copying
there's no benefit from stripping "node_modules/" from the string, to later add it again using the `DEST_DIR_NODE_MODULES` constant

=> just copy directly into the `DEST_DIR` folder and preserver the `node_modules` part in the path
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos ac3e96291a build(copy-dist): simplify "build" copying
there's no need to read the folder structure and then copy each single file in a loop

=> just copy the whole folder and be done with it :-)
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 9ac451e2b2 build(copy-dist): consolidate files and folder copying into one asset copying job
there's no benefit in having them split up like before
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos dbc2df0820 build(copy-dist): consolidate folder copying
the "srcDirsToCopy" block is useless now, we can just use the previous dirsToCopy to achieve the exact same thing
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 24382d8176 build(copy-dist): avoid copying over the app dir into dist
we have the bundled "app-dist" already in the "dist", copying over the original unbundled "app" folder serves no benefit here
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos af5e4ee3b5 build(copy-dist): copy over required folders/files from "public" folder 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 135101f57b build(copy-dist): do not copy build folder into src folder
stop the build folder from being copied into the dist/src subfolder
→ there is no sense in doing that
→ the contents of the build folder are corretly copied previously already (see line 26ff)
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 60a2b56636 chore(copy-dist): removee unnecesary copy of tsconfig.webpack.json
webpack bundling already ran before this script, so there is no need to copy this file over
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos e483cbca3c build(tsconfig): remove unnecessary exclude lines
these folder are already "excluded" implicitly, since we only include "./src" folder
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 3e307f4711 build(scripts): add "build:clean" script for removing dist and build folders 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 6c4a1732ad build(copy-trilium): use `npm run build:ts` 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos d0bb5f9768 build(scripts): add webpack progress flag 2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 3a87d71073 build(scripts): add build:ts and update build:prepare-dist
since we build into the build folder -> we should also clean the folder before building as well

also it makes sense to run tsc first, as it runs faster, so if there's any TS errors, we will have a faster failing build
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos e0c0086eb3 build(tsconfig): fix glob for build config
not sure why, but seems like it doesn't like `[jt]s` – which causes it to skip certain .d.ts files, making tsc fail
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 2be9389f3b build(webpack): change to nosources-source-map
as per https://webpack.js.org/configuration/devtool/#production

serving the `source-map` file to "normal" users seems to be not recommended, so instead let's go with `nosources-source-map`:

a) this drastically reduces app-dist folder size from 20MB down to 8.7MB
b) it still allows for stack traces
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos 745b294ca1 build(webpack): output webpack build in build folder
output the bundled files directly in the build folder
a) keeps the src folder clean from build output
b) it saves us some "manual" copying work
2025-03-07 23:14:56 +07:00
Panagiotis Papadopoulos cefc402263 build: add separate tsconfig.build.json
this prevents tsc from unnecessarily transpiling the frontend part as well:
previously it was transpiled by tsc, but the files got discarded and replaced by the files built by webpack.

speeds up tsc command a bit as well:
from 14 seconds to ~8 secs
2025-03-07 23:14:56 +07:00
Elian Doran a6e7f98f69
chore(release): 0.92.3-beta 2025-03-07 23:59:10 +07:00
Elian Doran e76601cd21
fix(bin): empty package.json 2025-03-07 23:58:41 +07:00
Elian Doran e252b491ba
chore(bin): make less error-tolerant 2025-03-07 23:57:31 +07:00
Elian Doran 555dcc956e
chore(release): 0.92.3-beta 2025-03-07 23:55:26 +07:00
Panagiotis Papadopoulos 2c91f6e7bc refactor(errors): add HttpError class and extend existing errors from it 2025-03-07 22:47:03 +07:00
Panagiotis Papadopoulos 39d45dc11b refactor(error_handlers): use existing NotFoundError class
also gets rid of "any" type :-)
2025-03-07 22:31:55 +07:00
Panagiotis Papadopoulos d8ce385134 refactor(routes): refactor handleException and get rid of "any" type 2025-03-07 22:27:13 +07:00