|
|
@@ -280,10 +280,24 @@ function get_watch_config() { |
|
|
|
assets_json, |
|
|
|
prev_assets_json |
|
|
|
} = await write_assets_json(result.metafile); |
|
|
|
|
|
|
|
let changed_files; |
|
|
|
if (prev_assets_json) { |
|
|
|
log_rebuilt_assets(prev_assets_json, assets_json); |
|
|
|
changed_files = get_rebuilt_assets( |
|
|
|
prev_assets_json, |
|
|
|
assets_json |
|
|
|
); |
|
|
|
|
|
|
|
let timestamp = new Date().toLocaleTimeString(); |
|
|
|
let message = `${timestamp}: Compiled ${changed_files.length} files...`; |
|
|
|
log(chalk.yellow(message)); |
|
|
|
for (let filepath of changed_files) { |
|
|
|
let filename = path.basename(filepath); |
|
|
|
log(" " + filename); |
|
|
|
} |
|
|
|
log(); |
|
|
|
} |
|
|
|
notify_redis({ success: true }); |
|
|
|
notify_redis({ success: true, changed_files }); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
@@ -453,7 +467,7 @@ function run_build_command_for_apps(apps) { |
|
|
|
process.chdir(cwd); |
|
|
|
} |
|
|
|
|
|
|
|
async function notify_redis({ error, success }) { |
|
|
|
async function notify_redis({ error, success, changed_files }) { |
|
|
|
// notify redis which in turns tells socketio to publish this to browser |
|
|
|
let subscriber = get_redis_subscriber("redis_socketio"); |
|
|
|
subscriber.on("error", _ => { |
|
|
@@ -475,7 +489,8 @@ async function notify_redis({ error, success }) { |
|
|
|
} |
|
|
|
if (success) { |
|
|
|
payload = { |
|
|
|
success: true |
|
|
|
success: true, |
|
|
|
changed_files |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
@@ -505,7 +520,7 @@ function open_in_editor() { |
|
|
|
subscriber.subscribe("open_in_editor"); |
|
|
|
} |
|
|
|
|
|
|
|
function log_rebuilt_assets(prev_assets, new_assets) { |
|
|
|
function get_rebuilt_assets(prev_assets, new_assets) { |
|
|
|
let added_files = []; |
|
|
|
let old_files = Object.values(prev_assets); |
|
|
|
let new_files = Object.values(new_assets); |
|
|
@@ -515,17 +530,5 @@ function log_rebuilt_assets(prev_assets, new_assets) { |
|
|
|
added_files.push(filepath); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
log( |
|
|
|
chalk.yellow( |
|
|
|
`${new Date().toLocaleTimeString()}: Compiled ${ |
|
|
|
added_files.length |
|
|
|
} files...` |
|
|
|
) |
|
|
|
); |
|
|
|
for (let filepath of added_files) { |
|
|
|
let filename = path.basename(filepath); |
|
|
|
log(" " + filename); |
|
|
|
} |
|
|
|
log(); |
|
|
|
} |
|
|
|
return added_files; |
|
|
|
} |