build: fix gh workflow script

This commit is contained in:
Csaba Tuncsik 2023-06-16 13:27:34 +02:00
parent 53fad99029
commit 61127c0f2b

View file

@ -1,13 +1,13 @@
import fs from 'fs';
import path from 'path';
import util from 'util';
import { exec } from 'child_process';
import { spawn } from 'child_process';
import { glob } from "glob";
import parser from '@babel/parser';
import traverse from '@babel/traverse';
const readFileAsync = util.promisify(fs.readFile);
const execAsync = util.promisify(exec);
const spawnAsync = util.promisify(spawn);
const filterAsync = async (asyncPredicate, arr) => {
const filterResults = await Promise.all(arr.map(async item => ({
@ -44,8 +44,10 @@ const hasFunctionOrClass = async filePath => {
const program = async () => {
// Run a git command to get a list of all files in the commit
const changedFilesCommand = "git diff --name-only --diff-filter=d origin/master...HEAD";
const changedFiles = await execAsync(changedFilesCommand).then(stdout => stdout.toString().trim().split('\n').filter(Boolean));
const changedFiles = await spawnAsync(
'git',
['diff', '--name-only', '--diff-filter=d', 'origin/master...HEAD']
).then(stdout => stdout.toString().trim().split('\n').filter(Boolean));
// Get all .spec.ts and .test.ts files from the packages
const specAndTestTsFiles = await glob('../../packages/*/**/{test,__tests__}/*.{spec,test}.ts');