Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit f423d3a

Browse files
authored
Merge pull request #2322 from TriliumNext/feature/fix_nx_ignore
Feature/fix nx ignore
2 parents 641d2b0 + 3aba961 commit f423d3a

File tree

12 files changed

+131
-40
lines changed

12 files changed

+131
-40
lines changed

.env

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
- uses: nrwl/nx-set-shas@v4
4141
- name: Check affected
42-
run: pnpm nx affected --verbose -t typecheck build rebuild-deps
42+
run: pnpm nx affected --verbose -t typecheck build rebuild-deps test-build
4343

4444
test_dev:
4545
name: Test development

.nxignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
11
_regroup
2-
_regroup_monorepo
3-
4-
# Asset copying respects .gitignore / .nxignore for some reason.
5-
# See https://github.com/nrwl/nx/issues/20309
6-
!dist
7-
!node_modules
2+
_regroup_monorepo

apps/server/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,12 @@
348348
}
349349
]
350350
}
351+
},
352+
"test-build": {
353+
"dependsOn": [
354+
"build"
355+
],
356+
"command": "vitest --config {projectRoot}/vitest.build.config.mts"
351357
}
352358
}
353359
},
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { globSync } from "fs";
2+
import { join } from "path";
3+
import { it, describe, expect } from "vitest";
4+
5+
describe("Check artifacts are present", () => {
6+
const distPath = join(__dirname, "../../dist");
7+
8+
it("has the necessary node modules", async () => {
9+
const paths = [
10+
"node_modules/better-sqlite3",
11+
"node_modules/bindings",
12+
"node_modules/file-uri-to-path"
13+
];
14+
15+
ensurePathsExist(paths);
16+
});
17+
18+
it("includes the client", async () => {
19+
const paths = [
20+
"public/assets",
21+
"public/fonts",
22+
"public/node_modules",
23+
"public/src",
24+
"public/stylesheets",
25+
"public/translations"
26+
];
27+
28+
ensurePathsExist(paths);
29+
});
30+
31+
it("includes necessary assets", async () => {
32+
const paths = [
33+
"assets",
34+
"share-theme"
35+
];
36+
37+
ensurePathsExist(paths);
38+
});
39+
40+
function ensurePathsExist(paths: string[]) {
41+
for (const path of paths) {
42+
const result = globSync(join(distPath, path, "**"));
43+
expect(result, path).not.toHaveLength(0);
44+
}
45+
}
46+
});

apps/server/vite.config.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ export default defineConfig(() => ({
1111
setupFiles: ["./spec/setup.ts"],
1212
environment: "node",
1313
include: ['{src,spec}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
14+
exclude: [
15+
"spec/build-checks/**",
16+
],
1417
reporters: [
1518
"verbose"
1619
],
@@ -19,7 +22,6 @@ export default defineConfig(() => ({
1922
provider: 'v8' as const,
2023
reporter: [ "text", "html" ]
2124
},
22-
fileParallelism: false,
2325
pool: "threads"
2426
},
2527
}));

apps/server/vitest.build.config.mts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference types='vitest' />
2+
import { defineConfig } from 'vite';
3+
4+
export default defineConfig(() => ({
5+
root: __dirname,
6+
cacheDir: '../../node_modules/.vite/apps/server',
7+
plugins: [],
8+
test: {
9+
watch: false,
10+
globals: true,
11+
setupFiles: ["./spec/setup.ts"],
12+
environment: "node",
13+
include: ['spec/build-checks/**'],
14+
reporters: [
15+
"verbose"
16+
]
17+
},
18+
}));

apps/website/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,12 @@
3333
},
3434
"dependencies": {
3535
"@inlang/paraglide-js": "^2.0.0"
36+
},
37+
"nx": {
38+
"typecheck": {
39+
"dependsOn": [
40+
"build"
41+
]
42+
}
3643
}
3744
}

package.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
"patchedDependencies": {
8585
"@ckeditor/ckeditor5-mention": "patches/@ckeditor__ckeditor5-mention.patch",
8686
"@ckeditor/ckeditor5-code-block": "patches/@ckeditor__ckeditor5-code-block.patch",
87-
"ckeditor5": "patches/ckeditor5.patch"
87+
"ckeditor5": "patches/ckeditor5.patch",
88+
"@nx/js": "patches/@nx__js.patch"
8889
},
8990
"overrides": {
9091
"node-abi": "4.9.0",
@@ -99,11 +100,25 @@
99100
"dompurify@<3.2.4": ">=3.2.4",
100101
"esbuild@<=0.24.2": ">=0.25.0"
101102
},
103+
"ignoredBuiltDependencies": [
104+
"sqlite3"
105+
],
102106
"onlyBuiltDependencies": [
103-
"esbuild"
107+
"@parcel/watcher",
108+
"@scarf/scarf",
109+
"better-sqlite3",
110+
"bufferutil",
111+
"core-js-pure",
112+
"electron",
113+
"electron-winstaller",
114+
"esbuild",
115+
"fs-xattr",
116+
"macos-alias",
117+
"nx",
118+
"utf-8-validate"
104119
]
105120
},
106121
"nx": {
107122
"name": "triliumnext"
108123
}
109-
}
124+
}

patches/@nx__js.patch

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/src/utils/assets/copy-assets-handler.js b/src/utils/assets/copy-assets-handler.js
2+
index 6b68205d833ce9e8277283ac31230c020d2921ec..2f0a7f018b03eae3b8f3ce1a4cf4790aaafed677 100644
3+
--- a/src/utils/assets/copy-assets-handler.js
4+
+++ b/src/utils/assets/copy-assets-handler.js
5+
@@ -39,12 +39,6 @@ class CopyAssetsHandler {
6+
this.callback = opts.callback ?? exports.defaultFileEventHandler;
7+
// TODO(jack): Should handle nested .gitignore files
8+
this.ignore = (0, ignore_1.default)();
9+
- const gitignore = pathPosix.join(opts.rootDir, '.gitignore');
10+
- const nxignore = pathPosix.join(opts.rootDir, '.nxignore');
11+
- if ((0, node_fs_1.existsSync)(gitignore))
12+
- this.ignore.add((0, node_fs_1.readFileSync)(gitignore).toString());
13+
- if ((0, node_fs_1.existsSync)(nxignore))
14+
- this.ignore.add((0, node_fs_1.readFileSync)(nxignore).toString());
15+
this.assetGlobs = opts.assets.map((f) => {
16+
let isGlob = false;
17+
let pattern;

0 commit comments

Comments
 (0)