Skip to content

Commit c700cb3

Browse files
committed
Revert "chore: migrate scripts"
This reverts commit c140bf2.
1 parent 879117e commit c700cb3

File tree

5 files changed

+16
-24
lines changed

5 files changed

+16
-24
lines changed

scripts/add-banner.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import { readdir, readFile, writeFile } from 'fs/promises';
2-
import { createRequire } from 'module';
3-
import { resolve } from 'path';
1+
const { readdir, readFile, writeFile } = require('fs/promises');
2+
const { resolve } = require('path');
43

5-
import dedent from 'dedent';
4+
const dedent = require('dedent');
65

7-
const require = createRequire(import.meta.url);
86
const pkg = require('../package.json');
97

108
const banner = dedent`
@@ -15,8 +13,7 @@ const banner = dedent`
1513
* Released under the ${pkg.license} license.
1614
*/
1715
`;
18-
const distFolder =
19-
resolve(new URL('.', import.meta.url).pathname, '../', 'dist') + '/';
16+
const distFolder = resolve(__dirname, '../', 'dist') + '/';
2017

2118
async function getFiles(path = distFolder) {
2219
const entries = await readdir(path, {
@@ -45,7 +42,10 @@ getFiles().then((files) =>
4542
Promise.all(
4643
files.map(({ path }) =>
4744
readFile(path)
48-
.then((file) => `${banner}\n\n${file.toString()}\n `)
45+
.then(
46+
(file) => `${banner}\n\n${file.toString()}
47+
`,
48+
)
4949
.then((text) => writeFile(path, text, { encoding: 'utf-8' })),
5050
),
5151
),

scripts/ci/measure-size.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { readFile } from 'node:fs/promises';
22

33
import { setFailed, setOutput } from '@actions/core';
44
import { getExecOutput } from '@actions/exec';
5-
import bytes from 'bytes';
65
import { markdownTable } from 'markdown-table';
6+
import bytes from 'bytes';
77

88
async function run() {
99
/**

scripts/ci/set-message.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import dedent from 'dedent';
1+
const dedent = require('dedent');
22

3-
export default async function setMessage({
3+
module.exports = async function setMessage({
44
header,
55
body,
66
prNumber,
@@ -38,4 +38,4 @@ export default async function setMessage({
3838
body: commentBody,
3939
});
4040
}
41-
}
41+
};

scripts/copy-files.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import fs from 'fs';
2-
import path from 'path';
3-
import { fileURLToPath } from 'url';
4-
5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = path.dirname(__filename);
1+
const fs = require('fs');
2+
const path = require('path');
73

84
function copyRequiredFiles() {
95
copyPackageJson();

scripts/replace-version.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import fs from 'fs';
2-
import path from 'path';
3-
import { fileURLToPath } from 'url';
4-
5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = path.dirname(__filename);
1+
const fs = require('fs');
2+
const path = require('path');
73

84
console.log('Replacing version in compiled files...');
95

0 commit comments

Comments
 (0)