You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Example how to run this with different directories:
21
+
// SOURCE=./path/to/Documentation TARGET=./another/path/to/Documentation-Output/ VITE_PORT=5173 npm run dev
22
+
// Note that the paths need to be within the project directory, else vite does not watch these directories.
23
+
24
+
if(!existsSync(sourceDirectory)){
25
+
console.log(`\x1b[37m\x1b[2m${newDate().toLocaleTimeString()}\x1b[0m \x1b[1m\x1b[36m[typo3-documentation-browsersync] \x1b[0m\x1b[31mSpecified \x1b[4m${sourceDirectory}\x1b[0m\x1b[31m does not exist, fallback to current directory.\x1b[0m`);
26
+
sourceDirectory='./';
27
+
}
28
+
29
+
if(!existsSync(targetDirectory)){
30
+
console.log(`\x1b[37m\x1b[2m${newDate().toLocaleTimeString()}\x1b[0m \x1b[1m\x1b[36m[typo3-documentation-browsersync] \x1b[0m\x1b[31mSpecified \x1b[4m${targetDirectory}\x1b[0m\x1b[31m does not exist, fallback to current directory.\x1b[0m`);
console.log(`\x1b[37m\x1b[2m${newDate().toLocaleTimeString()}\x1b[0m \x1b[1m\x1b[36m[typo3-documentation-browsersync] \x1b[0m\x1b[31mSpecified \x1b[4m${sourceDirectory}\x1b[0m\x1b[31m is not within project scope, vite cannot watch changes.\x1b[0m`);
console.log(`\x1b[37m\x1b[2m${newDate().toLocaleTimeString()}\x1b[0m \x1b[1m\x1b[36m[typo3-documentation-browsersync] \x1b[0m\x1b[31mSpecified \x1b[4m${targetDirectory}\x1b[0m\x1b[31m is not within project scope, vite cannot watch changes.\x1b[0m`);
41
+
process.exit(1);
42
+
}
43
+
44
+
console.log(`\x1b[37m\x1b[2m${newDate().toLocaleTimeString()}\x1b[0m \x1b[1m\x1b[36m[typo3-documentation-browsersync] \x1b[0m\x1b[32mListening on \x1b[4m${sourceDirectory}\x1b[0m\x1b[32m which renders to \x1b[4m${targetDirectory}\x1b[0m`);
45
+
console.log(`\x1b[37m\x1b[2m${newDate().toLocaleTimeString()}\x1b[0m \x1b[1m\x1b[36m[typo3-documentation-browsersync] \x1b[0m\x1b[32mUse e.g. \x1b[4mhttp://localhost:${vitePort}/${targetDirectory}/Index.html\x1b[0m\x1b[32m to view documentation.\x1b[0m`);
console.log(`\x1b[37m\x1b[2m${newDate().toLocaleTimeString()}\x1b[0m \x1b[1m\x1b[36m[typo3-documentation-browsersync] \x1b[0m\x1b[32m\x1b[33mBrowser reload\x1b[32m on \x1b[4m${file}\x1b[0m`);
15
64
server.ws.send({
16
65
type: 'full-reload',
17
66
path: '*'
18
67
});
19
-
}elseif(file.indexOf('/Documentation/')>0){
20
-
// TODO: Execute docker command here.
21
-
// TODO: Make "Documentation" directory configurable via env/param?!
22
-
console.log('Re-rendering due to change in: '+file);
68
+
}elseif(file.indexOf('/'+sourceDirectory+'/')>0){
69
+
// Changes on sourceDirectory (ReST input)
70
+
71
+
console.log(`\x1b[37m\x1b[2m${newDate().toLocaleTimeString()}\x1b[0m \x1b[1m\x1b[36m[typo3-documentation-browsersync] \x1b[0m\x1b[32m\x1b[33mRender\x1b[32m on \x1b[4m${file}\x1b[0m`);
72
+
73
+
try{
74
+
// The container by defaults operates on /project/Documentation/ and writes to /project/Documentation-GENERATED-temp/.
75
+
// We make our lives easy by just mapping those expected directories to our sourceDirectory/targetDirectory variables.
0 commit comments