mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
fix(monorepo/electron): fix some sub-dependencies not being copied
This commit is contained in:
parent
3558d3aced
commit
e408f7d8f1
@ -31,8 +31,8 @@ function copyAssets(baseDir: string, destDir: string, files: string[]) {
|
|||||||
/**
|
/**
|
||||||
* Copies the dependencies from the node_modules directory to the build directory.
|
* Copies the dependencies from the node_modules directory to the build directory.
|
||||||
* We cannot copy the node_modules directory directly because we are in a monorepo and all the packages are gathered at root level.
|
* We cannot copy the node_modules directory directly because we are in a monorepo and all the packages are gathered at root level.
|
||||||
*
|
*
|
||||||
* @param packageJsonPath
|
* @param packageJsonPath
|
||||||
*/
|
*/
|
||||||
function copyNodeModules(packageJsonPath: string) {
|
function copyNodeModules(packageJsonPath: string) {
|
||||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
||||||
@ -45,9 +45,17 @@ function copyNodeModules(packageJsonPath: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const src = path.join(rootDir, "node_modules", dependency);
|
const src = path.join(rootDir, "node_modules", dependency);
|
||||||
|
if (!fs.existsSync(src)) {
|
||||||
|
console.warn(`Dependency ${dependency} not found in node_modules. Skipping.`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const dest = path.join(DEST_DIR, "node_modules", dependency);
|
const dest = path.join(DEST_DIR, "node_modules", dependency);
|
||||||
log(`${src} -> ${dest}`);
|
log(`${src} -> ${dest}`);
|
||||||
fs.copySync(src, dest);
|
fs.copySync(src, dest);
|
||||||
|
|
||||||
|
// Copy sub-dependencies as well.
|
||||||
|
copyNodeModules(path.join(src, "package.json"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +79,7 @@ try {
|
|||||||
"./src/public/fonts",
|
"./src/public/fonts",
|
||||||
"./src/public/translations",
|
"./src/public/translations",
|
||||||
`./tpl/`,
|
`./tpl/`,
|
||||||
"./scripts/cleanupNodeModules.ts",
|
"./scripts/cleanupNodeModules.ts",
|
||||||
"./src/views/",
|
"./src/views/",
|
||||||
"./src/etapi/etapi.openapi.yaml",
|
"./src/etapi/etapi.openapi.yaml",
|
||||||
"./src/routes/api/openapi.json",
|
"./src/routes/api/openapi.json",
|
||||||
@ -79,7 +87,7 @@ try {
|
|||||||
|
|
||||||
const rootAssets = [
|
const rootAssets = [
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
"README.md"
|
"README.md"
|
||||||
];
|
];
|
||||||
|
|
||||||
copyNodeModules(path.join(serverDir, "package.json"));
|
copyNodeModules(path.join(serverDir, "package.json"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user