-
Notifications
You must be signed in to change notification settings - Fork 75
feat(project): Add component type #1182
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
Changes from 4 commits
b421e33
cf45bf4
c09779e
3e76071
f0fb1d1
db2bb54
d42d9a5
7349a62
1ba5eac
73659ca
830b975
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| import {enhancePatternWithExcludes} from "./_utils.js"; | ||
| import {enhanceBundlesWithDefaults} from "../../validation/validator.js"; | ||
|
|
||
| /** | ||
| * Get tasks and their configuration for a given component project | ||
| * | ||
| * @private | ||
| * @param {object} parameters | ||
| * @param {object} parameters.project | ||
| * @param {object} parameters.taskUtil | ||
| * @param {Function} parameters.getTask | ||
| */ | ||
| export default function({project, taskUtil, getTask}) { | ||
| const tasks = new Map(); | ||
| tasks.set("escapeNonAsciiCharacters", { | ||
| options: { | ||
| encoding: project.getPropertiesFileSourceEncoding(), | ||
| pattern: "/**/*.properties" | ||
| } | ||
| }); | ||
|
|
||
| tasks.set("replaceCopyright", { | ||
| options: { | ||
| copyright: project.getCopyright(), | ||
| pattern: "/**/*.{js,json}" | ||
| } | ||
| }); | ||
|
|
||
| tasks.set("replaceVersion", { | ||
| options: { | ||
| version: project.getVersion(), | ||
| pattern: "/**/*.{js,json}" | ||
| } | ||
| }); | ||
|
|
||
| // Support rules should not be minified to have readable code in the Support Assistant | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Support rules are AFAIK a concept for libraries, so I wonder why we also do this for applications. But as we do, I think we should also do it here to stay consistent. |
||
| const minificationPattern = ["/**/*.js", "!**/*.support.js"]; | ||
| const minificationExcludes = project.getMinificationExcludes(); | ||
| if (minificationExcludes.length) { | ||
| enhancePatternWithExcludes(minificationPattern, minificationExcludes, "/resources/"); | ||
| } | ||
|
|
||
| tasks.set("minify", { | ||
| options: { | ||
| pattern: minificationPattern | ||
| } | ||
| }); | ||
|
|
||
| tasks.set("enhanceManifest", {}); | ||
|
|
||
| tasks.set("generateFlexChangesBundle", {}); | ||
|
|
||
| const bundles = project.getBundles(); | ||
| const existingBundleDefinitionNames = | ||
| bundles.map(({bundleDefinition}) => bundleDefinition.name).filter(Boolean); | ||
|
|
||
| const componentPreloadPaths = project.getComponentPreloadPaths(); | ||
| const componentPreloadNamespaces = project.getComponentPreloadNamespaces(); | ||
| const componentPreloadExcludes = project.getComponentPreloadExcludes(); | ||
| if (componentPreloadPaths.length || componentPreloadNamespaces.length) { | ||
| tasks.set("generateComponentPreload", { | ||
| options: { | ||
| paths: componentPreloadPaths, | ||
| namespaces: componentPreloadNamespaces, | ||
| excludes: componentPreloadExcludes, | ||
| skipBundles: existingBundleDefinitionNames | ||
| } | ||
| }); | ||
| } else { | ||
| // Default component preload | ||
| tasks.set("generateComponentPreload", { | ||
| options: { | ||
| namespaces: [project.getNamespace()], | ||
| excludes: componentPreloadExcludes, | ||
| skipBundles: existingBundleDefinitionNames | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| if (bundles.length) { | ||
| tasks.set("generateBundle", { | ||
| requiresDependencies: true, | ||
| taskFunction: async ({workspace, dependencies, taskUtil, options}) => { | ||
| const generateBundleTask = await getTask("generateBundle"); | ||
| // Async resolve default values for bundle definitions and options | ||
| const bundlesDefaults = await enhanceBundlesWithDefaults(bundles, taskUtil.getProject()); | ||
|
|
||
| return bundlesDefaults.reduce(async function(sequence, bundle) { | ||
| return sequence.then(function() { | ||
| return generateBundleTask.task({ | ||
| workspace, | ||
| dependencies, | ||
| taskUtil, | ||
| options: { | ||
| projectName: options.projectName, | ||
| bundleDefinition: bundle.bundleDefinition, | ||
| bundleOptions: bundle.bundleOptions | ||
| } | ||
| }); | ||
| }); | ||
| }, Promise.resolve()); | ||
| } | ||
| }); | ||
| } else { | ||
| // No bundles defined. Just set task so that it can be referenced by custom tasks | ||
| tasks.set("generateBundle", { | ||
| taskFunction: null | ||
| }); | ||
| } | ||
|
|
||
| tasks.set("generateVersionInfo", { | ||
| requiresDependencies: true, | ||
| options: { | ||
| rootProject: project, | ||
| pattern: "/resources/**/.library" | ||
| } | ||
| }); | ||
|
|
||
| tasks.set("generateCachebusterInfo", { | ||
| options: { | ||
| signatureType: project.getCachebusterSignatureType(), | ||
| } | ||
| }); | ||
|
|
||
| tasks.set("generateResourcesJson", {requiresDependencies: true}); | ||
|
|
||
| return tasks; | ||
| } | ||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.