-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Enable integration with 3rd party assets management solutions #38445
Comments
Here is a draft of the design: Productionizing the client assets packageThere are several challenges integrating third-party tools that produce or transform web assets as part of the build process:
Goals
Out of scope
Technical designWe want to offer a declarative model where customers can indicate what tool to run, the inputs and the outputs and we take care of the rest. We will likely need a couple of "phases" or extensibility points in the pipeline. One initial phase to ensure that any third-party dependency toolchain (like npm or yarn) had a chance to run. A second phase where we invoke whatever tool or script we are given. Ideally, we want this to be a collaborative process where multiple tools can be added provided they don't depend on each other. That allows packages to include a command for their toolchain as long as it doesn't depend on the outputs of any other tools. One way we can make this work is by defining the invocations inside an item group as follows: <ItemGroup>
<ClientAssetTool Include="InstallNpmDependencies">
<Stage>Dependencies</Stage>
<Command>npm install</Command>
<Directory>assets</Directory>
<Inputs>assets\package.json;assets\package-lock.json</Inputs>
<ExcludeInputs></ExcludeInputs>
<Outputs>assets\node_modules\package-lock.json</Outputs>
<ExcludeOutputs></ExcludeOutputs>
</ClientAssetTool>
<ClientAssetTool Include="RunNpmBuildScript">
<Stage>Generation</Stage>
<Command>npm run build:$(Configuration)</Command>
<Directory>assets</Directory>
<Inputs>assets\**</Inputs>
<ExcludeInputs></ExcludeInputs>
<Outputs>*.js</Outputs>
<ExcludeOutputs>*.map.js</ExcludeOutputs>
</ClientAssetTool>
</ItemGroup> The metadata included in the item group defines all the aspects of how and when the tool needs to run:
With this metadata we will do as follows:
Notes on testing
The biggest part in this aspect is the incrementalism. Some scenarios that I can enumerate:
Questions
|
This is close to what I would like to see but I believe that there needs to be a way to have multiple sets of input & output specified. For example, I build both js & css; If a js source file changes I don't want to build css. As long as I can have multiple sections with generate and different commands/inputs/outputs I'd be covered |
@MarkStega this design currently contemplates that. You will create two separate item group items each one specifying a different command and a different set of inputs/outputs, one for your CSS and one for your JS |
@TanayParikh I am very interested in using this feature so I will volunteer to test off of nightly builds when you get to that point. |
@TanayParikh please make sure this is also covered as part of the work: #42472 |
@TanayParikh Do you have any insights into this? |
@MariovanZeist we do not plan to move forward with the experimental package (as we are planning to integrate the functionality directly into the SDK). Being an experimental package, it was expected to have bugs. We plan to address things like this as part of moving the functionality to the SDK repo, as we have there the infrastructure to test it properly. That said, the new functionality will give you the ability to define the command yourself, so you'll be responsible for things being quoted appropriately. We might define some out of the box conventions either on the SDK or inside a new package to further streamline the scenario when following the conventions (so that basically you put assets in a specific folder, and everything magically works after that). In that case we would be taking care of the quoting. |
@javiercn Thanks for clearing it up, I was indeed under the mistaken assumption that this particular package would be used. |
@MariovanZeist yeah, the idea is that we make this process declarative, you get to say what commands to run, what inputs and outputs and we take care of making sure that they end up in the right place inside the wwwroot folder and that things are done incrementally (provided you correctly specify inputs and outputs). It is much easier for us to test those things in the SDK repo because we have infrastructure that can create a project and run through different scenarios to make sure that stuff works, and it does not regress over time when changes are made. |
Thanks for contacting us. We're moving this issue to the |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Consider productionizing Microsoft.AspNetCore.ClientAssets package
The text was updated successfully, but these errors were encountered: