fix: remove use of glob (#3932)

This commit is contained in:
Peng Xiao
2023-08-24 12:34:36 +08:00
committed by GitHub
parent e1816c165b
commit 4247a5d0d9
3 changed files with 175 additions and 47 deletions

View File

@@ -3,7 +3,6 @@
const fs = require('node:fs');
const path = require('node:path');
const crypto = require('node:crypto');
const glob = require('glob');
/* eslint-enable */
const yml = {
@@ -11,9 +10,9 @@ const yml = {
files: [],
};
const generateYml = async platform => {
const files = glob.sync(`./affine-*-${platform}-*.{exe,zip,dmg,AppImage}`);
const generateYml = platform => {
const regex = new RegExp(`^affine-.*-${platform}-.*.(exe|zip|dmg|AppImage)$`);
const files = fs.readdirSync(__dirname).filter(file => regex.test(file));
files.forEach(fileName => {
const filePath = path.join(__dirname, './', fileName);
try {