Skip to content

Commit

Permalink
more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmenke committed Apr 6, 2023
1 parent 5c87570 commit 2c9ab99
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
12 changes: 2 additions & 10 deletions .github/bin/list-workspaces/list-workspaces.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { getFiles } from '../util/get-files.mjs';
import fs, { promises as fsp } from 'fs';
import { toposort } from '../util/toposort.mjs';

const p = (path.posix ?? path);

export async function listWorkspaces() {
try {
const rootPackageJSON = JSON.parse(await fsp.readFile('package.json'));
Expand Down Expand Up @@ -32,18 +30,12 @@ export async function listWorkspaces() {
}
}

console.error('---- workspaces ----')
console.error(Array.from(packages.values()));
console.error('---- ----')


const result = [];

for (const packageJSONPath of Array.from(packages)) {
const packageJSON = JSON.parse(await fsp.readFile(packageJSONPath));
const packagePath = p.relative(process.cwd(), path.dirname(packageJSONPath));

console.error(packagePath);
const packagePath = path.relative(process.cwd(), path.dirname(packageJSONPath));
console.error('package relative path - ', packagePath);

result.push({
path: packagePath,
Expand Down
2 changes: 1 addition & 1 deletion .github/bin/modified-workspaces/list-modified-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function getPullRequestFiles(repository, pullRequestNumber, page) {
headers: headers
}, (res) => {
if (!res.statusCode || (Math.floor(res.statusCode / 100) !== 2)) {
throw new Error(`Unepected response code "${res.statusCode}" with message "${res.statusMessage}"`)
throw new Error(`Unexpected response code "${res.statusCode}" with message "${res.statusMessage}"`)
}

let data = [];
Expand Down
6 changes: 5 additions & 1 deletion .github/bin/modified-workspaces/modified-workspaces.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { listModifiedFilesInPullRequest } from './list-modified-files.mjs';
import { listWorkspaces } from '../list-workspaces/list-workspaces.mjs';
import path from 'path';

const internalDependencies = [
'.github/',
Expand Down Expand Up @@ -44,6 +45,9 @@ export async function listModifiedWorkspaces() {
const modifiedWorkspaces = new Set();

for (const modifiedFile of modifiedFiles) {
const modifiedFilePath = path.relative(process.cwd(), path.format(path.posix.parse(modifiedFile)));
console.error('modified file - ', modifiedFilePath);

if (modifiedFile.startsWith('e2e/')) {
continue;
}
Expand All @@ -67,7 +71,7 @@ export async function listModifiedWorkspaces() {

let isNonWorkspaceFile = true;
for (const workspace of workspaces) {
if (modifiedFile.startsWith(workspace.path)) {
if (modifiedFilePath.startsWith(workspace.path)) {
isNonWorkspaceFile = false;

modifiedWorkspaces.add(workspace.name);
Expand Down

0 comments on commit 2c9ab99

Please sign in to comment.