Skip to content

Commit

Permalink
Resolve bundles' defaults before generateBundleTask call
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Jun 27, 2024
1 parent 1f7e58e commit e6a9e0b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
20 changes: 14 additions & 6 deletions lib/build/definitions/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,27 @@ export default function({project, taskUtil, getTask}) {
requiresDependencies: true,
taskFunction: async ({workspace, dependencies, taskUtil, options}) => {
const generateBundleTask = await getTask("generateBundle");
return bundles.reduce(function(sequence, bundle) {
return sequence.then(async function() {
const {bundleDefinition, bundleOptions} = await enhanceBundleWithDefaults(
bundle.bundleDefinition, bundle.bundleOptions, taskUtil.getProject());
// Async resolve default values for bundle definitions and options
const bundlesDefaults = await Promise.all(
bundles.map((bundle) =>
enhanceBundleWithDefaults(
bundle.bundleDefinition,
bundle.bundleOptions,
taskUtil.getProject()
)
)
);

return bundlesDefaults.reduce(async function(sequence, bundle) {
return sequence.then(function() {
return generateBundleTask.task({
workspace,
dependencies,
taskUtil,
options: {
projectName: options.projectName,
bundleDefinition,
bundleOptions
bundleDefinition: bundle.bundleDefinition,
bundleOptions: bundle.bundleOptions
}
});
});
Expand Down
22 changes: 15 additions & 7 deletions lib/build/definitions/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,27 @@ export default function({project, taskUtil, getTask}) {
requiresDependencies: true,
taskFunction: async ({workspace, dependencies, taskUtil, options}) => {
const generateBundleTask = await getTask("generateBundle");
return bundles.reduce(function(sequence, bundle) {
return sequence.then(async function() {
const {bundleDefinition, bundleOptions} = await enhanceBundleWithDefaults(
bundle.bundleDefinition, bundle.bundleOptions, taskUtil.getProject());

// Async resolve default values for bundle definitions and options
const bundlesDefaults = await Promise.all(
bundles.map((bundle) =>
enhanceBundleWithDefaults(
bundle.bundleDefinition,
bundle.bundleOptions,
taskUtil.getProject()
)
)
);

return bundlesDefaults.reduce(function(sequence, bundle) {
return sequence.then(function() {
return generateBundleTask.task({
workspace,
dependencies,
taskUtil,
options: {
projectName: options.projectName,
bundleDefinition,
bundleOptions
bundleDefinition: bundle.bundleDefinition,
bundleOptions: bundle.bundleOptions
}
});
});
Expand Down

0 comments on commit e6a9e0b

Please sign in to comment.