mirror of
https://github.com/zadam/trilium.git
synced 2025-10-19 22:58:52 +02:00
chore(dx/desktop): get prod build
This commit is contained in:
parent
72a256eccf
commit
135e2bb10e
@ -33,6 +33,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "cross-env NODE_OPTIONS=\"--import tsx\" NODE_ENV=development TRILIUM_ENV=dev TRILIUM_DATA_DIR=data TRILIUM_RESOURCE_DIR=../server/src electron src/electron-main.ts",
|
||||
"build": "tsx scripts/build.ts",
|
||||
"start-prod": "nx build desktop && cross-env TRILIUM_DATA_DIR=data TRILIUM_RESOURCE_DIR=dist TRILIUM_PORT=37841 electron dist/main.js"
|
||||
},
|
||||
"license": "AGPL-3.0-only",
|
||||
@ -63,63 +64,20 @@
|
||||
"options": {
|
||||
"main": "apps/desktop/src/electron-main.ts",
|
||||
"outputPath": "apps/desktop/dist",
|
||||
"outputFileName": "main.js",
|
||||
"tsConfig": "apps/desktop/tsconfig.app.json",
|
||||
"platform": "node",
|
||||
"external": [
|
||||
"electron",
|
||||
"@electron/remote",
|
||||
"better-sqlite3",
|
||||
"./xhr-sync-worker.js"
|
||||
],
|
||||
"format": [
|
||||
"cjs"
|
||||
],
|
||||
"thirdParty": true,
|
||||
"declaration": false,
|
||||
"esbuildOptions": {
|
||||
"splitting": false,
|
||||
"loader": {
|
||||
".css": "text"
|
||||
}
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "apps/server/dist/node_modules",
|
||||
"output": "node_modules"
|
||||
},
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "apps/desktop/node_modules/@electron/remote",
|
||||
"output": "node_modules/@electron/remote"
|
||||
},
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "apps/server/dist/assets",
|
||||
"output": "assets"
|
||||
},
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "packages/share-theme/src/templates",
|
||||
"output": "share-theme/templates"
|
||||
},
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "apps/desktop/src/assets",
|
||||
"output": "assets"
|
||||
},
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "apps/server/dist/public",
|
||||
"output": "public"
|
||||
},
|
||||
{
|
||||
"glob": "xhr-sync-worker.js",
|
||||
"input": "apps/server/node_modules/jsdom/lib/jsdom/living/xhr",
|
||||
"output": ""
|
||||
}
|
||||
],
|
||||
"declarationRootDir": "apps/desktop/src"
|
||||
}
|
||||
},
|
||||
|
22
apps/desktop/scripts/build.ts
Normal file
22
apps/desktop/scripts/build.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import BuildHelper from "../../../scripts/build-utils";
|
||||
|
||||
const build = new BuildHelper("apps/desktop");
|
||||
|
||||
async function main() {
|
||||
await build.buildBackend([ "src/main.ts"]);
|
||||
|
||||
// Copy assets.
|
||||
build.copy("src/assets", "assets/");
|
||||
build.copy("/apps/server/src/assets", "assets/");
|
||||
build.copy("/packages/share-theme/src/templates", "share-theme/templates/");
|
||||
|
||||
// Copy node modules dependencies
|
||||
build.copyNodeModules([ "better-sqlite3", "bindings", "file-uri-to-path", "@electron/remote" ]);
|
||||
build.copy("/apps/server/node_modules/jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js", "xhr-sync-worker.js");
|
||||
|
||||
// Integrate the client.
|
||||
build.triggerBuildAndCopyTo("apps/client", "public/");
|
||||
build.deleteFromOutput("public/webpack-stats.json");
|
||||
}
|
||||
|
||||
main();
|
@ -3,11 +3,11 @@ import BuildHelper from "../../../scripts/build-utils";
|
||||
const build = new BuildHelper("apps/server");
|
||||
|
||||
async function main() {
|
||||
build.buildBackend([ "src/main.ts", "src/docker_healthcheck.ts" ])
|
||||
await build.buildBackend([ "src/main.ts", "src/docker_healthcheck.ts" ])
|
||||
|
||||
// Copy assets
|
||||
build.copy("src/assets", "assets/");
|
||||
build.copy("../../packages/share-theme/src/templates", "share-theme/templates/");
|
||||
build.copy("/packages/share-theme/src/templates", "share-theme/templates/");
|
||||
|
||||
// Copy node modules dependencies
|
||||
build.copyNodeModules([ "better-sqlite3", "bindings", "file-uri-to-path" ]);
|
||||
|
@ -19,10 +19,17 @@ export default class BuildHelper {
|
||||
}
|
||||
|
||||
copy(projectDirPath: string, outDirPath: string) {
|
||||
let sourcePath: string;
|
||||
if (projectDirPath.startsWith("/")) {
|
||||
sourcePath = join(this.rootDir, projectDirPath.substring(1));
|
||||
} else {
|
||||
sourcePath = join(this.projectDir, projectDirPath);
|
||||
}
|
||||
|
||||
if (outDirPath.endsWith("/")) {
|
||||
mkdirpSync(join(outDirPath));
|
||||
}
|
||||
copySync(join(this.projectDir, projectDirPath), join(this.outDir, outDirPath), { dereference: true });
|
||||
copySync(sourcePath, join(this.outDir, outDirPath), { dereference: true });
|
||||
}
|
||||
|
||||
deleteFromOutput(path: string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user