erudit 4.3.3-dev.1 → 4.3.4-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "erudit",
3
- "version": "4.3.3-dev.1",
3
+ "version": "4.3.4-dev.2",
4
4
  "type": "module",
5
5
  "description": "🤓 CMS for perfect educational sites.",
6
6
  "license": "MIT",
@@ -24,9 +24,9 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@erudit-js/cli": "4.3.3-dev.1",
28
- "@erudit-js/core": "4.3.3-dev.1",
29
- "@erudit-js/prose": "4.3.3-dev.1",
27
+ "@erudit-js/cli": "4.3.4-dev.2",
28
+ "@erudit-js/core": "4.3.4-dev.2",
29
+ "@erudit-js/prose": "4.3.4-dev.2",
30
30
  "@floating-ui/vue": "^1.1.11",
31
31
  "@resvg/resvg-js": "^2.6.2",
32
32
  "@tailwindcss/vite": "^4.2.1",
@@ -61,6 +61,14 @@ export async function buildServerErudit() {
61
61
  // Watcher
62
62
  //
63
63
 
64
+ const watchedProjectDirs = [
65
+ 'content',
66
+ 'contributors',
67
+ 'cameos',
68
+ 'sponsors',
69
+ 'news',
70
+ ] as const;
71
+
64
72
  export async function tryServerWatchProject() {
65
73
  if (ERUDIT.mode === 'static') {
66
74
  return;
@@ -93,39 +101,14 @@ export async function tryServerWatchProject() {
93
101
  }
94
102
  }, 300);
95
103
 
96
- function isWatched(path: string) {
97
- if (path.startsWith(ERUDIT.paths.project('content') + '/')) {
98
- return true;
99
- }
100
-
101
- if (path.startsWith(ERUDIT.paths.project('contributors') + '/')) {
102
- return true;
103
- }
104
-
105
- if (path.startsWith(ERUDIT.paths.project('cameos') + '/')) {
106
- return true;
107
- }
108
-
109
- if (path.startsWith(ERUDIT.paths.project('sponsors') + '/')) {
110
- return true;
111
- }
112
-
113
- if (path.startsWith(ERUDIT.paths.project('news') + '/')) {
114
- return true;
115
- }
116
- }
117
-
118
- const watcher = chokidar.watch(ERUDIT.paths.project(), {
119
- ignoreInitial: true,
120
- });
104
+ const watcher = chokidar.watch(
105
+ watchedProjectDirs.map((dir) => ERUDIT.paths.project(dir)),
106
+ { ignoreInitial: true },
107
+ );
121
108
 
122
109
  watcher.on('all', (_, path) => {
123
110
  path = sn(path);
124
111
 
125
- if (!isWatched(path)) {
126
- return;
127
- }
128
-
129
112
  if (pendingRebuild) {
130
113
  return;
131
114
  }
@@ -23,8 +23,11 @@ export async function pushProblemScript(
23
23
  relativePath = problemScriptSrc;
24
24
  }
25
25
 
26
- await ERUDIT.db.insert(ERUDIT.db.schema.problemScripts).values({
27
- problemScriptSrc: relativePath,
28
- contentFullId,
29
- });
26
+ await ERUDIT.db
27
+ .insert(ERUDIT.db.schema.problemScripts)
28
+ .values({
29
+ problemScriptSrc: relativePath,
30
+ contentFullId,
31
+ })
32
+ .onConflictDoNothing();
30
33
  }