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

Added process to export protobuf enums for use in webconfig #1279

Merged

Conversation

mikepparks
Copy link
Contributor

This exports enums from the protobuf definitions for use in development of the webconfig. It will help reduce the need to reproduce these values in locations where they are listed, such as input modes or Display button layouts.

@mikepparks mikepparks marked this pull request as ready for review January 30, 2025 05:53
@Pelsin
Copy link
Contributor

Pelsin commented Jan 30, 2025

This alias might need additional config.
For typescript to pick up the alias we would need a tsconfig file:

This should be the minimum to make it work

{
	"compilerOptions": {
		"baseUrl": "./",
		"paths": {
			"@proto/*": ["src_gen/*"]
		}
	},
	"include": ["src"],
	"exclude": ["node_modules"]
}

There is a chance our setup wont import the alias correctly, it might default to looking for .js.

Possible to recreate by adding to Pins.ts

import { GpioAction } from '@proto/enums';
const testEnum = GpioAction;
console.log(testEnum);

Defining extension order in vite config could be one way to solve this:

resolve: {
		extensions: ['.ts', '.tsx', '.jsx', '.js', '.json'],

Gitignoring the .js file might also be nice to do

www/package.json Outdated Show resolved Hide resolved
www/package.json Outdated Show resolved Hide resolved
www/vite.config.ts Outdated Show resolved Hide resolved
Changed enum generation command to use standard output and skip js file generation
Copy link
Contributor

@arntsonl arntsonl left a comment

Choose a reason for hiding this comment

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

Looks awesome! Nice easy way to start adding in our proto enums into web

@arntsonl arntsonl merged commit 455495d into OpenStickCommunity:main Feb 6, 2025
41 checks passed
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.

3 participants