Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run AppWatcher as a dev process #4828

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

isaacroldan
Copy link
Contributor

WHY are these changes introduced?

We want to use the AppWatcher globally by all the other processes, this way any process can subscribe to app changes during dev.

WHAT is this pull request doing?

  • Create a new AppWatcherProcess that starts the App Watcher
  • Inject the shared AppWatcher to DevSessionProcess
  • Expose the BuildResult in each extension event -> To know if the extension was successfully built after the detected change.
  • Do some cleanup and update tests

How to test your changes?

Run app dev with the app management API.

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@isaacroldan isaacroldan requested a review from a team as a code owner November 11, 2024 16:30
Copy link
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

Copy link
Contributor

github-actions bot commented Nov 11, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
73.76% (-0.59% 🔻)
8440/11443
🟡 Branches
69.82% (-0.3% 🔻)
4116/5895
🟡 Functions
73.32% (-0.55% 🔻)
2221/3029
🟡 Lines
74.26% (-0.61% 🔻)
7979/10744
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🔴
... / app-watcher-process.ts
50% 100% 50% 50%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / migrate-app-module.ts
89.19% (-0.28% 🔻)
85.71% 90.91%
91.18% (-0.25% 🔻)
🟢
... / app-watcher-esbuild.ts
82.76% (-7.56% 🔻)
100%
78.57% (-6.04% 🔻)
85.19% (-7.92% 🔻)
🔴
... / cli.ts
1.41% (-98.59% 🔻)
0% (-75% 🔻)
0% (-100% 🔻)
1.56% (-98.44% 🔻)
🔴
... / custom-oclif-loader.ts
0% (-28.13% 🔻)
0% (-11.9% 🔻)
0% (-33.33% 🔻)
0% (-28.13% 🔻)
🟡
... / error-handler.ts
66.33% (-10.2% 🔻)
68.52% (-9.26% 🔻)
57.14% (-14.29% 🔻)
66.67% (-10.42% 🔻)
🟡
... / error.ts
79.31% (-6.9% 🔻)
73.53% (-2.94% 🔻)
92.31% (-7.69% 🔻)
78.57% (-7.14% 🔻)
🟡
... / path.ts
73.33% (-3.33% 🔻)
72.22%
68.75% (-6.25% 🔻)
74.07% (-3.7% 🔻)
🔴
... / system.ts
33.33% (-1.55% 🔻)
21.43% (-1.9% 🔻)
62.5% (-4.17% 🔻)
34.29% (-1.43% 🔻)

Test suite run success

1927 tests passing in 876 suites.

Report generated by 🧪jest coverage report action from 72841f6

@@ -57,8 +51,10 @@ export class ESBuildContextManager {
resolveDir: extension.directory,
loader: 'tsx',
},
stderr: this.stderr ?? process.stderr,
stdout: this.stdout ?? process.stdout,
logLevel: 'silent',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason/effect behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stdout and stderr are actually ignored by esbuild, it always prints to process.stdout which breaks our custom concurrent output.

To solve that, we configure esbuild to be silent, and the errors are printed with the right format by the app-event-watcher (see the usage of formatMessageSync inside a useConcurrentOutputContext

// eslint-disable-next-line no-catch-all/no-catch-all, @typescript-eslint/no-explicit-any
} catch (error: any) {
return {status: 'error', error: error.message, handle: ext.handle} as const
// If there is an `errors` array, it's an esbuild error, format it and log it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have something that covers this behaviour in tests? i.e. making sure we don't regress on how we want these errors to be handled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, will add them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done @shauns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants