-
Notifications
You must be signed in to change notification settings - Fork 1k
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(cli): support TS/JS config files #3756
Conversation
What are the technical issues in implementing that? I assume you would compile on the fly. |
We'd have to ship typescript as a dependency and then do something like what Stencil does. |
Yeah, I figured it would be something like that. If you already have working code you can steal from Stencil, you might as well do it. You could add TypeScript as an optional dependency. |
capacitor.config.js
config filesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few comments on the definitions.
ios.scrollEnabled
is missing.
Also, since init won't work if a .ts/.js file is present, don't need to change the code in a few places, I commented the places where it doesn't need to change.
Added I reworded the bundle option and clarified the default value for
I chose not to use the config name in init. I think it might be easier when maintaining it in the future (easier to search for
For now I changed it back, but we should probably have a bigger discussion because Ionic, Capacitor, and Appflow all call it different things. 😂 I copied this description from create-capacitor-app, but I can change it to App ID there too. |
extConfigType: 'ts', | ||
extConfigName, | ||
extConfigFilePath: extConfigFilePath, | ||
extConfig: requireTS(ts, extConfigFilePath) as any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be quite useful to optionally support exporting a () => Promise<ExternalConfig>
instead of just ExternalConfig
.
Would you accept a pull request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was thinking about this as well. I would be happy to look at a PR that adds that functionality.
* | ||
* @since 1.0.0 | ||
*/ | ||
url?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Devs can now have
capacitor.config.ts
(orcapacitor.config.js
) files, for example:depends on #3755
resolves #3141