Update watcher function. Add .css files to the rebuild pipeline
This commit is contained in:
parent
13bd8bb851
commit
632c70fc90
8
dist/functions/server/watcher.js
vendored
8
dist/functions/server/watcher.js
vendored
@ -30,10 +30,11 @@ export default function watcher() {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!filename.match(target_files_match)) {
|
||||
const is_file_of_interest = Boolean(filename.match(target_files_match));
|
||||
if (!is_file_of_interest) {
|
||||
return;
|
||||
}
|
||||
if (!filename.match(/^src\/pages\//))
|
||||
if (!filename.match(/^src\/pages\/|\.css$/))
|
||||
return;
|
||||
if (filename.match(/\/(--|\()/))
|
||||
return;
|
||||
@ -41,8 +42,9 @@ export default function watcher() {
|
||||
return;
|
||||
const fullPath = path.join(ROOT_DIR, filename);
|
||||
const action = existsSync(fullPath) ? "created" : "deleted";
|
||||
const type = filename.match(/\.css$/) ? "Sylesheet" : "Page";
|
||||
await fullRebuild({
|
||||
msg: `Page ${action}: ${filename}. Rebuilding ...`,
|
||||
msg: `${type} ${action}: ${filename}. Rebuilding ...`,
|
||||
});
|
||||
});
|
||||
global.PAGES_SRC_WATCHER = pages_src_watcher;
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "tsc --watch",
|
||||
"git:push": "tsc --noEmit && tsc && git add . && git commit -m 'Update README.md' && git push",
|
||||
"git:push": "tsc --noEmit && tsc && git add . && git commit -m 'Update watcher function. Add .css files to the rebuild pipeline' && git push",
|
||||
"compile": "bun build ./src/commands/index.ts --compile --outfile bin/bunext",
|
||||
"build": "tsc",
|
||||
"test": "bun test --max-concurrency=1"
|
||||
|
||||
@ -15,6 +15,7 @@ export default function watcher() {
|
||||
},
|
||||
async (event, filename) => {
|
||||
if (!filename) return;
|
||||
|
||||
const excluded_match =
|
||||
/node_modules\/|^public\/|^\.bunext\/|^\.git\/|^dist\/|bun\.lockb$/;
|
||||
|
||||
@ -38,20 +39,25 @@ export default function watcher() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!filename.match(target_files_match)) {
|
||||
const is_file_of_interest = Boolean(
|
||||
filename.match(target_files_match),
|
||||
);
|
||||
|
||||
if (!is_file_of_interest) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!filename.match(/^src\/pages\//)) return;
|
||||
if (!filename.match(/^src\/pages\/|\.css$/)) return;
|
||||
if (filename.match(/\/(--|\()/)) return;
|
||||
|
||||
if (global.RECOMPILING) return;
|
||||
|
||||
const fullPath = path.join(ROOT_DIR, filename);
|
||||
const action = existsSync(fullPath) ? "created" : "deleted";
|
||||
const type = filename.match(/\.css$/) ? "Sylesheet" : "Page";
|
||||
|
||||
await fullRebuild({
|
||||
msg: `Page ${action}: ${filename}. Rebuilding ...`,
|
||||
msg: `${type} ${action}: ${filename}. Rebuilding ...`,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user