build: fix cache hash for admin
This commit is contained in:
@@ -19,7 +19,7 @@ export default defineConfig({
|
||||
},
|
||||
|
||||
build: {
|
||||
manifest: true,
|
||||
manifest: false,
|
||||
sourcemap: false,
|
||||
outDir: '../../module/oc_telegram_shop/upload/admin/view/javascript/telecart',
|
||||
emptyOutDir: true, // also necessary
|
||||
|
||||
@@ -194,7 +194,7 @@ class ControllerExtensionModuleTgshop extends Controller
|
||||
{
|
||||
$appDir = rtrim(DIR_APPLICATION, '/');
|
||||
if (file_exists("$appDir/view/javascript/telecart/telecart.js")) {
|
||||
$hash = md5(file_get_contents($appDir . '/view/javascript/telecart/manifest.json'));
|
||||
$hash = file_get_contents($appDir . '/view/javascript/telecart/checksum.hash');
|
||||
$this->document->addScript('view/javascript/telecart/telecart.js?v=' . $hash);
|
||||
$this->document->addStyle('view/javascript/telecart/telecart.css?v=' . $hash);
|
||||
} elseif (file_exists("$appDir/view/integration.js")) {
|
||||
|
||||
@@ -42,10 +42,13 @@ cd "${SRC_PATH}/frontend/admin"
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
echo "Move manifest file"
|
||||
cp "${SRC_PATH}/module/oc_telegram_shop/upload/admin/view/javascript/telecart/.vite/manifest.json" \
|
||||
"${SRC_PATH}/module/oc_telegram_shop/upload/admin/view/javascript/telecart/manifest.json"
|
||||
|
||||
echo "Calculate MD5 hash sum"
|
||||
cd ../../module/oc_telegram_shop/upload/admin/view/javascript/telecart
|
||||
FILES=("telecart.css" "telecart.js")
|
||||
HASH=$(cat "${FILES[@]}" | md5sum | awk '{print $1}')
|
||||
OUTPUT="checksum.hash"
|
||||
echo "$HASH" > "$OUTPUT"
|
||||
echo "Checksum in $OUTPUT: $HASH"
|
||||
|
||||
cd "$SRC_PATH"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user