Skip to content

Commit

Permalink
rename writeFile helper back
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed Nov 7, 2022
1 parent 7790df7 commit d0d6c71
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions scripts/build-corelibs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { minify } from 'terser';

import * as scriptletList from '../src/scriptlets/scriptlets-list';
import { version } from '../package.json';
import { writeFileAsync } from './helpers';
import { writeFile } from './helpers';

const buildCorelibsJson = async () => {
const { getScriptletFunction } = require('../tmp/scriptlets-func'); // eslint-disable-line import/no-unresolved,global-require
Expand Down Expand Up @@ -37,6 +37,6 @@ const buildCorelibsJson = async () => {
export const buildScriptletsForCorelibs = async () => {
console.log('Start building corelibs...');
const json = await buildCorelibsJson();
await writeFileAsync(path.resolve(__dirname, '../dist/scriptlets.corelibs.json'), json, 'utf8');
await writeFile(path.resolve(__dirname, '../dist/scriptlets.corelibs.json'), json, 'utf8');
console.log('Corelibs built');
};
4 changes: 2 additions & 2 deletions scripts/build-funcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import path from 'path';
import { minify } from 'terser';
import { addCall, attachDependencies } from '../src/helpers/injector';
import { writeFileAsync } from './helpers';
import { writeFile } from './helpers';

/**
* Method creates string for file with scriptlets functions,
Expand Down Expand Up @@ -67,7 +67,7 @@ export const buildScriptletsFunc = async () => {
format: { beautify: true },
});

await writeFileAsync(path.resolve(__dirname, '../tmp/scriptlets-func.js'), beautifiedScriptletFunctions.code);
await writeFile(path.resolve(__dirname, '../tmp/scriptlets-func.js'), beautifiedScriptletFunctions.code);

console.log('Scriptlets functions built successfully');
};
4 changes: 2 additions & 2 deletions scripts/build-redirects-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { minify } from 'terser';
import path from 'path';

import { getPreparedRedirects } from './build-redirects';
import { writeFileAsync } from './helpers';
import { writeFile } from './helpers';

const createRedirectsMap = (redirects) => {
const map = {};
Expand Down Expand Up @@ -41,7 +41,7 @@ export const buildRedirectsMap = async () => {
format: { beautify: true },
});

await writeFileAsync(path.resolve(__dirname, '../tmp/redirects-map.js'), beautifiedScriptletFunctions.code);
await writeFile(path.resolve(__dirname, '../tmp/redirects-map.js'), beautifiedScriptletFunctions.code);

console.log('Finish building redirect map');
};
4 changes: 2 additions & 2 deletions scripts/build-txt.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import path from 'path';
import { writeFileAsync } from './helpers';
import { writeFile } from './helpers';
import { version } from '../package.json';

const PATH = '../dist';
const FILENAME = 'build.txt';

export const buildTxt = async () => {
const content = `version=${version}`;
await writeFileAsync(path.resolve(__dirname, PATH, FILENAME), content);
await writeFile(path.resolve(__dirname, PATH, FILENAME), content);
};
4 changes: 2 additions & 2 deletions scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const dox = require('dox');
* @param {string} filePath absolute path to file
* @param {string} content content to write to the file
*/
const writeFileAsync = async (filePath, content) => {
const writeFile = async (filePath, content) => {
const dirname = path.dirname(filePath);

await fs.ensureDir(dirname);
Expand Down Expand Up @@ -120,7 +120,7 @@ const getDataFromFiles = (filesList, relativeDirPath) => {
};

module.exports = {
writeFileAsync,
writeFile,
getFilesList,
getDataFromFiles,
};

0 comments on commit d0d6c71

Please sign in to comment.