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

refactored fiber/futures syntax to ES6 async/await syntax #43

Merged

Conversation

awatson1978
Copy link

@awatson1978 awatson1978 commented Sep 14, 2024

What

Replaced Fiber/futures syntax with ES6 async/await syntax.

Why

Meteor v3
Intended to address issue #41

Explainable AI

Received the following explanation from code assistant. Seems like a reasonable summary of what the communitypackages:meteor-desktop-bundler bundle.js file does. May be worthing converting to comments in the file.

Refactoring code

Switching a large JavaScript file from Fibers/futures to async/await, especially for Node.js, involves converting Future-based code to async functions with await. Progressing one section at a time is crucial due to its complexity.

Analyzing code structure

I'm working through a Meteor plugin, pinpointing MeteorDesktopBundler's methods, particularly processFilesForTarget, for converting asynchronous logic to async/await and adopting ES6 syntax.

Refactoring imports

I’m thinking about the imports and removing Future as it’s not utilized. Ensuring utility functions like arraysIdentical are preserved.

Refining code functionality

I’m enhancing fs.existsSync and analyzing MeteorDesktopBundler, using Promises for chokidar event handling to ensure async adherence.

Refactoring process

I’m working through the class refactor, aiming to swap Fibers/Futures for async/await. The Plugin.registerCompiler remains untouched, but synchronous code might need careful handling due to the async shift.

Refactoring code

I’m mapping out the steps to refactor the code with async/await, focusing on imports, functions, and handling async operations within 'on' handlers.

Refactoring processFilesForTarget

I'm evaluating the need to refactor processFilesForTarget into an async function, using Promises and await, while maintaining synchronous operations for Plugin.registerCompiler and MeteorDesktopBundler.

Refactoring the code

I’m working through providing the entire refactored code.

Setting up version control

I’m pulling together a script for project setup. It makes sure version.desktop is in .gitignore and creates version.desktop if not present. This streamlines version management for the project.

Simplifying the process

OK, let me see. It seems like I’m copying code to bypass a specific error in the stack trace, aiming for a smoother workflow.

Validating and resolving dependencies

I’m managing Meteor Desktop's dependencies and ensuring compatibility by pulling data from settings.json and module.json, merging with core dependencies, checking for conflicting or missing module names, and calculating a compatibility version.

Noting critical details

The snippet outlines the need to save and reset a String.prototype method due to a meteor-desktop plugin issue, ensuring builds for Android remain functional without errors.

Analyzing sinon usage

I’m examining the toc_search_result function in the sinon file to determine if it alters the global_.addEventListener function. This involves checking if toc_search_result changes how global_.addEventListener listens to events on the page.

Understanding version updates

I’m exploring how shelljs versions 0.5.3 and 0.7.5 handle the to method in relation to String's prototype. This progression highlights their method changes over time.

Integrating dependencies

I’m aligning the dependencies with the StringPrototypeToOriginal declaration. Progress includes integrating DependenciesManager, ElectronAppScaffold, and adding specific utilities.

Preparing for production

I’m setting up context and debugging tools for a production build, adding necessary files, and finalizing the process with environment-specific messages and performance stamps.

Utilizing cache strategy

I’m validating Meteor Desktop Bundler's cache to determine actions on file changes and rebuilding based on file states, skipping cache updates in production environments.

Verification

I've verified that this code compiles as an Atmosphere package and can run within an existing Meteor v3 app. Haven't completed the desktop build; but thought I'd check this in, since the app compiles successfully.

@awatson1978
Copy link
Author

Screenshot 2024-09-14 at 1 16 30 PM

@awatson1978
Copy link
Author

awatson1978 commented Sep 14, 2024

Todo

  • Publish the atmosphere packages.
  • Verify that compiler chain works and creates desktop app.
  • Publish the NPM utility.

@StorytellerCZ StorytellerCZ added the enhancement New feature or request label Sep 16, 2024
@StorytellerCZ StorytellerCZ linked an issue Sep 16, 2024 that may be closed by this pull request
@StorytellerCZ StorytellerCZ merged commit fc56eee into Meteor-Community-Packages:master Sep 16, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

Meteor 3 & v4
2 participants