#!/usr/bin/env php $commit_hash, 'assets' => [] ]; if (!empty($config_file) && file_exists($config_file)) { $existing_hashes = include $config_file; if (is_array($existing_hashes) && isset($existing_hashes['assets'])) { $hashes['assets'] = $existing_hashes['assets']; } } // Process only changed projects or all if none specified $projects = !empty($changed_projects) ? $changed_projects : $all_projects; foreach ($projects as $project) { foreach (['js', 'css'] as $type) { $dist_dir = $app_root.'/public/'.$project.'/dist-'.$type; $entries = glob_recursive($dist_dir.'/*.'.$type); if (empty($entries)) { fwrite(STDERR, "warning: no files found in $dist_dir\n"); continue; } foreach ($entries as $file) { $asset_key = $type.'/'.basename($file); $hashes['assets'][$project][$asset_key] = [ 'integrity' => [] ]; foreach (\engine\skin\FeaturedSkin::RESOURCE_INTEGRITY_HASHES as $hash_type) { $hashes['assets'][$project][$asset_key]['integrity'][$hash_type] = base64_encode(hash_file($hash_type, $file, true)); } } } } echo "