-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[6.1] The build script for building scripts #46879
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
Open
Fedik
wants to merge
127
commits into
joomla:6.1-dev
Choose a base branch
from
Fedik:building-build-js
base: 6.1-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,398
−2,401
Open
Changes from 96 commits
Commits
Show all changes
127 commits
Select commit
Hold shift + click to select a range
1f1d8e9
Building build
Fedik 35e4913
Building build
Fedik 7d20a5b
Building build logs
Fedik 45d4647
Building build logs
Fedik 936e81a
Building build logs
Fedik fbc2c09
Building build
Fedik 4b5c32d
Building build
Fedik 78d72d7
Building build css
Fedik d15d54c
Building build css
Fedik bab2b4f
Building build css
Fedik f33080f
Building build css
Fedik 94a2ffd
Building build css
Fedik b65573f
Building build css
Fedik 56324c2
Building build css
Fedik 60a1481
Merge branch '6.1-dev' into building-build-js
Fedik baa1c3c
Building build js
Fedik 009096d
Building build js
Fedik 653fcc2
Building build js
Fedik 357e2ec
Building build js
Fedik ec5ed2d
Building build js
Fedik fabdc9c
Building build builders
Fedik fb46051
Building build
Fedik c58b478
Building build vendor
Fedik e4bbfbb
Building build vendor
Fedik 0439e91
Building build vendor
Fedik 56a89f6
Building build vendor
Fedik b40305d
Merge branch '6.1-dev' into building-build-js
Fedik cef4260
Building build vendor
Fedik b44a93e
Building build vendor
Fedik a8b4936
Building build vendor
Fedik d3a6b80
Building build vendor
Fedik 39baf22
Building build vendor
Fedik ffff1a1
Building build vendor
Fedik 843bf7c
Building build
Fedik 23abfa2
Building build vendor
Fedik fa29cf6
Building build vendor
Fedik c66fa0c
Building build vendor
Fedik fe3e58f
Building build blocking
Fedik 61e1c6a
Building build vendor clean
Fedik 02ea95f
Building build tinymce
Fedik c293ef2
Building build Codemirror
Fedik 2422128
Building build Codemirror
Fedik ccd83a6
Building build plg debug
Fedik 8981c18
Building build plg debug
Fedik e2b6573
Building build no copy deps
Fedik 742fb3f
Building build media
Fedik b703b36
Building build codemirror without progress bar
Fedik ebe126e
Building build bootstrap
Fedik 69b0245
Building build
Fedik b9753dd
Building build error pages
Fedik fc4deeb
Building build error pages
Fedik 4b138c2
Building build
Fedik 7688774
Building build
Fedik 77a810e
Building build
Fedik 5f516e9
Building build
Fedik 6b4ebda
Building build bootstrap
Fedik 0aa6eec
Building build remove unused
Fedik 01a16a8
Building build remove unused
Fedik 019babb
Building build compress
Fedik cdffcae
Building build remove unused
Fedik d545b8a
Building build watch
Fedik 6ea23db
Building build watch
Fedik 3799e6d
Building build watch
Fedik 95fa31c
Building build watch
Fedik 66ca9a0
Building build watch
Fedik dd694ab
Building build remove unused
Fedik 46a330f
Building build watch
Fedik a21f528
Building build watch
Fedik a169deb
Building build move com_media
Fedik 426d962
Building build move com_media
Fedik 59d1cd9
Building build move com_media
Fedik b99719b
Building build
Fedik 394d44f
Merge branch '6.1-dev' into building-build-js
Fedik 8e7c95e
Building build
Fedik cdb7b4a
Building build move workflow
Fedik b61fd6a
Building build
Fedik d9e1760
Building build
Fedik 9a092ac
Building build move source
Fedik 7bbc777
Building build move source
Fedik 95f5703
Building build
Fedik d8a3c5b
Building build
Fedik 36d2fb6
Building build read
Fedik cd6dcaa
Building build read
Fedik de825ab
Building build read
Fedik 9c6a178
Building build read
Fedik f4f4735
test
Fedik 639edac
test
Fedik 641fc5b
test
Fedik 973a734
Dirent parentPath not path
Fedik c6ef470
Building build read
Fedik fe90c0f
css cs
Fedik 57f7b97
Merge branch '6.1-dev' into building-build-js
Fedik 9239795
fixes
Fedik 2bfc542
upd
Fedik 0ab21e2
note
Fedik 7bb2feb
Building build remove unused
Fedik 99bd97c
Apply suggestions from code review
Fedik 60755bd
Update build/build-modules-js/command/build-command.mjs
Fedik 24cc682
Merge branch '6.1-dev' into building-build-js
Fedik e0ecb49
Merge branch '6.1-dev' into building-build-js
Fedik b338040
test
Fedik 84ecccb
test
Fedik 897b3d9
test
Fedik 253b8c6
test
Fedik e30c78d
test
Fedik f08077c
test
Fedik 027c27b
test
Fedik ecf224a
test
Fedik b9feb2b
test
Fedik 90cba90
test
Fedik 8a77a06
test
Fedik b3cf483
test
Fedik bc564ba
test
Fedik 6859e3f
test
Fedik 2ff79bf
test
Fedik 3bf1aaa
Building build
Fedik f7f3431
test
Fedik 857ae77
test
Fedik 5ebca26
Merge branch '6.1-dev' into building-build-js
Fedik 8544521
upd
Fedik fbdc90e
Merge branch '6.1-dev' into building-build-js
Fedik 269414d
Merge branch '6.1-dev' into building-build-js
Fedik 02675c9
fix
Fedik 4e521b9
Merge branch '6.1-dev' into building-build-js
Fedik 304cbc8
Merge branch '6.1-dev' into building-build-js
Fedik 9c6ab74
fix bs
Fedik 342fe7d
keep license comments
Fedik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /** | ||
| * Builder factory class | ||
| */ | ||
| import path from 'node:path'; | ||
| import fs from 'node:fs'; | ||
| import DefaultModuleBuilder from './default-module-builder.mjs'; | ||
|
|
||
| export class BuilderFactory{ | ||
| constructor(basePath = '', targetPath = '', cmdOptions = {}) { | ||
| this.basePath = basePath; | ||
| this.targetPath = targetPath; | ||
| this.cmdOptions = cmdOptions; | ||
| } | ||
|
|
||
| async createBuilder(name) { | ||
| // Module path | ||
| let modulePath = path.join(this.basePath, name, 'builder.mjs'); | ||
|
|
||
| // Check if we have the builder module | ||
| if (!fs.existsSync(modulePath)) { | ||
| // Use default module | ||
| return new DefaultModuleBuilder(name, this.basePath, this.targetPath, this.cmdOptions); | ||
| } | ||
|
|
||
| return import(modulePath).then((module) => { | ||
| return new module.default(name, this.basePath, this.targetPath, this.cmdOptions); | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Create and run the builder | ||
| * | ||
| * @param { Command } program | ||
| * @param { String } name | ||
| * @param { BuilderFactory } factory | ||
| * @param { string[] } tasksToRun | ||
| * @param { boolean } skipUndefinedTask | ||
| * @return { Promise } | ||
| */ | ||
| export const createAndRunBuilder = async (program, name, factory, tasksToRun = [], skipUndefinedTask = false) => { | ||
| return factory.createBuilder(name) | ||
| .then((builder) => { | ||
| if (!builder.getBuildTasks) { | ||
| program.error(`Builder module for "${name}" should provide "getBuildTasks()" method. Which used to determine which task can be run for the builder.`) | ||
Fedik marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| console.log(`Initialize build [${name}]`); | ||
|
|
||
| // Run tasks for given builder | ||
| const allTasks = builder.getAllTasks ? builder.getAllTasks() : builder.getBuildTasks(); | ||
| let lastPromise = Promise.resolve(); | ||
| (tasksToRun.length ? tasksToRun : builder.getBuildTasks()).forEach((taskName) => { | ||
| // Check whether the task is allowed for active builder | ||
| if (!allTasks.includes(taskName)) { | ||
| // Show error when the builder and the task was specified, and it is not applicable for active builder. | ||
| if (!skipUndefinedTask) { | ||
| program.error(`Task "${taskName}" is not applicable for "${name}" builder.`); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| // Execute the task sequentially, this is needed because task may depend on each other | ||
| lastPromise = lastPromise.then(() => { | ||
| console.log(`Start task [${name}::${taskName}]`); | ||
|
|
||
| return builder[taskName]().then(async () => { | ||
| console.log('\x1b[32m%s\x1b[0m', `Completed task [${name}::${taskName}]`); | ||
| }).catch((error) => { | ||
| console.log('\x1b[31m%s\x1b[0m', `Failed Task [${name}::${taskName}]`); | ||
| console.trace(error); | ||
| program.error(error.message); | ||
| }); | ||
| }); | ||
| }); | ||
| return lastPromise; | ||
| }).then(() => { | ||
| console.log('\x1b[32m%s\x1b[0m', `Completed build [${name}]`); | ||
| }); | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.