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

feat: migration to SDK #170

Conversation

gentlementlegen
Copy link
Member

@gentlementlegen gentlementlegen commented Oct 24, 2024

Resolves #102
Depends on ubiquity-os/ubiquity-os-kernel#169


I decided to split the local runs into two major parts:

  • adding the SDK
  • allowing local runs

Technically this PR already allows for local runs using the SDK and bun but doesn't fulfill the specs, because it would be too much of a huge pull-request to read (adding caching etc. is missing). The SDK greatly helps for subsequent steps. Changing to bun will allow easier local runs as well.

Changes

ESM

Our SDK mainly supports ESM packages so I migrated all the code and tests to be ESM compatible.

Bun

Why bun? bun is used in the Kernel and allows for bun link (this command was not cross compatible with bun and yarn). It also supports running a server out of the box with hono, so no need to write code to start a local server.

Cons: bun is still too immature and does not support properly network request mocking so yarn and jest are still needed for testing.

gentlementlegen and others added 24 commits October 24, 2024 17:35
Simplify code by replacing EnvConfigType with EnvConfig and refactor to use createPlugin.
Replace module-specific configurations with context plugin.
Simplify code by replacing EnvConfigType with EnvConfig and refactor to use createPlugin.
# Conflicts:
#	src/parser/permit-generation-module.ts
#	src/run.ts
Deleted github-comment-module-instance.ts, octokit.ts, and yarn.lock to clean up unused code.
Deleted config-reader and logger modules, simplifying configuration handling.
Reorganized imports to source BaseModule from module types instead of processor.
Reorganized imports to source BaseModule from module types instead of processor.
Swapped console.warn with logger.error for better logging, simplified issue payload.
Changed `dev` script to `bun --watch`, added new config to `issue.http`.
Add ContextPlugin type imports and instantiate testing modules.
Add ContextPlugin type imports and instantiate testing modules.
Updated error logging to use this.context.logger for consistency.
Enhanced the log message to provide better context about the issue.
Updated package.json dependency and fixed static test data in issue.http.
Add Bun package manager version to package.json for consistency.
Deleted validator.ts file. Updated package.json and removed related imports and test code.
Remove unnecessary blank line in CHANGELOG.md for better readability.
Add proper schema-based configs and remove redundant test case.
Update Octokit import style and replace jest.mock with jest.unstable_mockModule
Replaced manual mocks with jest.unstable_mockModule for consistency.
Refactored test context setup for shared usage and efficiency.
@gentlementlegen
Copy link
Member Author

@whilefoo to fix that whole mess I ended up creating a separate repo for the SDK to avoid circular references and allow this to compile
https://github.com/ubiquity-os/plugin-sdk

I will update the kernel accordingly.

Running plugin as SDK: https://github.com/Meniole/text-conversation-rewards/actions/runs/11723241994/job/32654486608#step:3:17

@gentlementlegen gentlementlegen merged commit 11d9092 into ubiquity-os-marketplace:development Nov 7, 2024
3 checks passed
@gentlementlegen gentlementlegen deleted the feat/local-run branch November 7, 2024 12:53
Copy link

@gentlementlegen, this task has been idle for a while. Please provide an update.

@gentlementlegen
Copy link
Member Author

Interesting, I guess no message should have been posted.

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.

Implement a way to easily run tests results on an issue
3 participants