Skip to content

Commit

Permalink
fix redirects build AG-14398
Browse files Browse the repository at this point in the history
Merge in ADGUARD-FILTERS/scriptlets from fix/AG-14398_01 to release/v1.7

Squashed commit of the following:

commit ecf384b
Author: Stanislav A <s.atroschenko@adguard.com>
Date:   Wed Nov 9 14:38:37 2022 +0300

    fix redirects build
  • Loading branch information
stanislav-atr committed Nov 9, 2022
1 parent 3327e89 commit f55b7ad
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/build-redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { minify } from 'terser';
import * as redirectsList from '../src/redirects/redirects-list';
import { version } from '../package.json';
import { rollupStandard } from './rollup-runners';
import { writeFileAsync, getDataFromFiles } from './helpers';
import { writeFile, getDataFromFiles } from './helpers';
import { redirectsFilenames, REDIRECTS_SRC_RELATIVE_DIR_PATH } from './constants';

const FILE_NAME = 'redirects.yml';
Expand Down Expand Up @@ -202,7 +202,7 @@ export const getPreparedRedirects = async (options) => {
const buildJsRedirectFiles = async (redirectsData) => {
const saveRedirectData = async (redirect) => {
const redirectPath = `${REDIRECT_FILES_PATH}/${redirect.file}`;
await writeFileAsync(redirectPath, redirect.content);
await writeFile(redirectPath, redirect.content);
};

await Promise.all(Object.values(redirectsData)
Expand Down Expand Up @@ -230,9 +230,9 @@ const buildStaticRedirectFiles = async (redirectsData) => {
// replace them all because base64 isn't supposed to have them
contentToWrite = content.replace(/(\r\n|\n|\r|\s)/gm, '');
const buff = Buffer.from(contentToWrite, 'base64');
await writeFileAsync(redirectPath, buff);
await writeFile(redirectPath, buff);
} else {
await writeFileAsync(redirectPath, contentToWrite);
await writeFile(redirectPath, contentToWrite);
}
};

Expand All @@ -251,7 +251,7 @@ const buildRedirectsYamlFile = async (mergedRedirects) => {
// add version and title to the top
yamlRedirects = `${banner}${yamlRedirects}`;

await writeFileAsync(RESULT_PATH, yamlRedirects);
await writeFile(RESULT_PATH, yamlRedirects);
};

export const prebuildRedirects = async () => {
Expand Down Expand Up @@ -372,7 +372,7 @@ export const buildRedirectsForCorelibs = async () => {

try {
const jsonString = JSON.stringify(base64Redirects, null, 4);
await writeFileAsync(CORELIBS_RESULT_PATH, jsonString);
await writeFile(CORELIBS_RESULT_PATH, jsonString);
} catch (e) {
// eslint-disable-next-line no-console
console.log(`Couldn't save to ${CORELIBS_RESULT_PATH}, because of: ${e.message}`);
Expand Down

0 comments on commit f55b7ad

Please sign in to comment.