Prerequisites
Describe the Feature Request
Hi,
When running npm stencil init and seleting component the user would get two additional questions:
Select the build types to include in stencil.config.ts:
dist works everywhere, but better for non-framework based apps
dist-custom-elements works everywhere, but better for framework based apps
If the user chooses only 1, then the appropriate config settings are set in stencil.config.ts and package.json. But if the user selects both, then they get an additional question:
Select the default build type:
dist
dist-custom-elements
Maybe link to https://stenciljs.com/docs/output-targets on those questions so people can make a better choice.
Then the script would:
- Set
isPrimaryPackageOutputTarget appropriately in stencil.config.ts
- Update
main and types in package.json to match the appropriate path
- Update the
"." entry under "exports" to match the appropriate path
The way it is now, in a framework like Vue or Angular, I need to do import { defineCustomElement } from @namespace/component-name/component-name with component-name duplicated. It all works just fine, but it is unexpected and looks odd.
Thanks for listening,
bob
Describe the Use Case
The use case is that when a user runs npm stencil init the generated files should more closely match the user's intent to reduce the need to make configuration changes and reduce troubleshooting when using components.
This was my experience. When running npm init stencil and choosing component as a starter project, three things threw me:
- Both
dist and dist-custom-elements are defined in stencil.config.ts
- package.json was configured so the default export,
"." pointed to the files created by the dist type.
- Setting
validatePrimaryPackageOutputTarget: true and under the dist-custom-element output config setting isPrimaryPackageOutputTarget: true resulted in build warnings, even though I picked component to create a custom element.
If I choose component as the starter project, I would expect dist-custom-element to be set as the default with the isPrimaryPackageOutputTarget: true option. I actually like having all 4 in the file because it helped me learn the config a little better, so I would opt for including it but setting dist-custom-element as the default.
And in package.json, the default module and types entries are set to the files created by dist.
So even though I thought I was setting up a custom element, there were a lot of configuration changes I needed to make.
Describe Preferred Solution
As described in the feature request
Describe Alternatives
Alternately, in the first question ? Select a starter project. have replace component with
component - dist works everywhere, but better for non-framework based apps
component - dist-custom-elements works everywhere, but better for framework based apps
Allow the user to pick both options, and if they do ask which should be the default as above.
Related Code
No response
Additional Information
No response
Prerequisites
Describe the Feature Request
Hi,
When running
npm stencil initand seletingcomponentthe user would get two additional questions:If the user chooses only 1, then the appropriate config settings are set in stencil.config.ts and package.json. But if the user selects both, then they get an additional question:
Maybe link to https://stenciljs.com/docs/output-targets on those questions so people can make a better choice.
Then the script would:
isPrimaryPackageOutputTargetappropriately in stencil.config.tsmainandtypesin package.json to match the appropriate path"."entry under"exports"to match the appropriate pathThe way it is now, in a framework like Vue or Angular, I need to do
import { defineCustomElement } from @namespace/component-name/component-namewith component-name duplicated. It all works just fine, but it is unexpected and looks odd.Thanks for listening,
bob
Describe the Use Case
The use case is that when a user runs
npm stencil initthe generated files should more closely match the user's intent to reduce the need to make configuration changes and reduce troubleshooting when using components.This was my experience. When running
npm init stenciland choosing component as a starter project, three things threw me:distanddist-custom-elementsare defined in stencil.config.ts"."pointed to the files created by thedisttype.validatePrimaryPackageOutputTarget: trueand under thedist-custom-elementoutput config settingisPrimaryPackageOutputTarget: trueresulted in build warnings, even though I picked component to create a custom element.If I choose
componentas the starter project, I would expectdist-custom-elementto be set as the default with theisPrimaryPackageOutputTarget: trueoption. I actually like having all 4 in the file because it helped me learn the config a little better, so I would opt for including it but settingdist-custom-elementas the default.And in package.json, the default
moduleandtypesentries are set to the files created bydist.So even though I thought I was setting up a custom element, there were a lot of configuration changes I needed to make.
Describe Preferred Solution
As described in the feature request
Describe Alternatives
Alternately, in the first question
? Select a starter project.have replacecomponentwithAllow the user to pick both options, and if they do ask which should be the default as above.
Related Code
No response
Additional Information
No response