From 2c9ab9974a9cdcd76b0aeacf14125b3f0efe3bce Mon Sep 17 00:00:00 2001 From: Romain Menke Date: Thu, 6 Apr 2023 21:51:52 +0200 Subject: [PATCH] more logs --- .github/bin/list-workspaces/list-workspaces.mjs | 12 ++---------- .../bin/modified-workspaces/list-modified-files.mjs | 2 +- .../bin/modified-workspaces/modified-workspaces.mjs | 6 +++++- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/bin/list-workspaces/list-workspaces.mjs b/.github/bin/list-workspaces/list-workspaces.mjs index 20aac8dd4..49874dec3 100644 --- a/.github/bin/list-workspaces/list-workspaces.mjs +++ b/.github/bin/list-workspaces/list-workspaces.mjs @@ -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')); @@ -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, diff --git a/.github/bin/modified-workspaces/list-modified-files.mjs b/.github/bin/modified-workspaces/list-modified-files.mjs index 3f126bb73..3cbbd0664 100644 --- a/.github/bin/modified-workspaces/list-modified-files.mjs +++ b/.github/bin/modified-workspaces/list-modified-files.mjs @@ -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 = []; diff --git a/.github/bin/modified-workspaces/modified-workspaces.mjs b/.github/bin/modified-workspaces/modified-workspaces.mjs index c516816c5..922cd2531 100644 --- a/.github/bin/modified-workspaces/modified-workspaces.mjs +++ b/.github/bin/modified-workspaces/modified-workspaces.mjs @@ -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/', @@ -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; } @@ -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);