<commit_before>var fs = require("fs");
var path = require("path");
var ShopifyAPI = require("shopify-node-api");

var pageId = process.env.SHOPIFY_PAGE_ID;
var Shopify = new ShopifyAPI({
    shop: process.env.SHOPIFY_SHOP,
    shopify_api_key: process.env.SHOPIFY_API_KEY,
    access_token: process.env.SHOPIFY_API_PASSWORD
});

var indexPagePath = path.join(__dirname, "..", "dist", "index.html");
fs.readFile(indexPagePath, "utf-8", function (err, data) {
    if (!err) {
        var put_data = {
            page: {
                body_html: data
            }
        };
        Shopify.put("/admin/pages/" + pageId + ".json", put_data, function (err, data, headers) {
            if (err) {
                console.error("Failed to Deploy during API call");
                return 0;
            } else {
                console.log("Deploy Success");
                return 1;
            }
        });
    } else {
        console.error("Error reading file: ", err);
    }
});
<commit_msg>build(shopify.js): replace base href in index.html with live alternative<commit_after>var fs = require("fs");
var path = require("path");
var ShopifyAPI = require("shopify-node-api");

var pageId = process.env.SHOPIFY_PAGE_ID;
var Shopify = new ShopifyAPI({
    shop: process.env.SHOPIFY_SHOP,
    shopify_api_key: process.env.SHOPIFY_API_KEY,
    access_token: process.env.SHOPIFY_API_PASSWORD
});

var indexPagePath = path.join(__dirname, "..", "dist", "index.html");
fs.readFile(indexPagePath, "utf-8", function (err, data) {
    if (!err) {
        data = data.replace(/<base\shref=[^>]*>/gi, '<base href="/pages/recipe-test/"/>');
        var put_data = {
            page: {
                body_html: data
            }
        };
        Shopify.put("/admin/pages/" + pageId + ".json", put_data, function (err, data, headers) {
            if (err) {
                console.error("Failed to Deploy during API call");
                return 0;
            } else {
                console.log("Deploy Success");
                return 1;
            }
        });
    } else {
        console.error("Error reading file: ", err);
    }
});

{'fraction_non_alphanumeric': 0.146455223880597, 'fraction_numerical': 0.002798507462686567, 'mean_word_length': 2.1405563689604685, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7012818', 'n_tokens_mistral': 680, 'n_tokens_neox': 663, 'n_words': 146}