Skip to content

Commit

Permalink
fix diff for e2e (#3246)
Browse files Browse the repository at this point in the history
Co-authored-by: ScriptedAlchemy <[email protected]>
  • Loading branch information
ScriptedAlchemy and ScriptedAlchemy authored Oct 25, 2023
1 parent a8616de commit 31b82ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
25 changes: 9 additions & 16 deletions checkChangedWorkspaces.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
const getPackages = require('./repotools.js');
const stdout = JSON.stringify(getPackages('./', 'origin/master'))
const all = getPackages('./', null)
try {
// remove last line of stdout
const updatedPackages = JSON.parse(stdout);
// if (stdout.includes("cypress")) {
// TODO filter for "@" added temporary to not to add packages wich are not automated and formated yet.
const changedPackages = getPackages('./', 'origin/master');
const allPackages = getPackages('./', null);

const newPackages = all.filter(x => !x.name?.includes("_") && !updatedPackages?.includes(x) && !x.name?.includes("cypress") && !x.name?.includes("@"));
console.log(JSON.stringify({ container: newPackages.map(x => x.name)}));
// } else {
// console.log(JSON.stringify({ container: updatedPackages.filter(x => !x.name.includes("_") && !x.name.includes("@")).map(x => x.name)
// }))
// }
} catch (e) {
console.error(e);
}
try {
const updatedPackages = changedPackages;
const newPackages = changedPackages

console.log(JSON.stringify({ container: newPackages.map(package => package.name)}));
} catch (e) {
console.error(e);
}
2 changes: 1 addition & 1 deletion native-federation-core-microfrontend
5 changes: 3 additions & 2 deletions repotools.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function getPackages(dir, since) {
if (fs.existsSync(packageJsonPath)) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
if (since) {
const result = execSync(`git log --since="${since}" -- ${nestedDir}`, { encoding: 'utf8' });
const result = execSync(`git diff --name-only ${since}..HEAD -- ${nestedDir}`, { encoding: 'utf8' });

if (result) {
packages.push({
name: packageJson.name,
Expand All @@ -42,6 +43,6 @@ function getPackages(dir, since) {
}

const since = process.argv[2] === '--since' ? process.argv[3] : null;
const packages = getPackages('./', since); // start from current directory
// const packages = getPackages('./', since); // start from current directory
// console.log(JSON.stringify(packages, null, 2));
module.exports = getPackages

0 comments on commit 31b82ee

Please sign in to comment.