Maven Javascript Tools

Create a JS fragment or similar that includes all JS necessary files

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.0-alpha
  • Component/s: None
  • Labels:
    None
  • Environment:
    n/a
  • Number of attachments :
    0

Description

Create a JS fragment or similar that includes all JS necessary files.

Please leave feedback, maybe discuss on list.

The end result of this is two things:

  • convenience and a (more) compelling reason to use Maven for JS builds (where MAKE seems to have a lot of traction, what the?)
  • the foundation for functionality needed to create the biggest, most bad-assed Google AJAX API killer ever.

Think:
Mate Maven JS artifacts with the Dojo dependency system

This would be the use case:

I have MyCoolLib that depends on Prototype and Scriptaculous.
MyCoolLib is broken into core, and sub-functionalities A and B. Scriptaculous and possibly Prototype are further broken up using this same model.

I want to be able to include MyCoolLib (any sub module) and everything that it requires to run without explicitly knowing assembly/file names of packages that are depended upon within the HTML file.

===================================
Prototype

+- prototype.js

Scriptaculous

+- scriptaculous.js

+- dragdrop.js

+- slider.js

MyCoolLibrary

+- coolstuff_core.js

+- coolstuff_a.js

+- coolstuff_b.js
===================================

Order matters for both dependencies and local files (assemblies). MyCoolLib might be one or more JS files, and the order of its own files matter--likewise for each dependency.

  • One possible solution could be to always assume that every artifact has only one assembly.
  • Another would be to add an intra-assembly dependency extension to the assembler document, in its own namespace.

===================================

<assembler xmlns:dep="http://mojo.codehaus.org/javascript-maven-tools/#assembly-dependency">
<scripts>
<script>
<dep:dep script="prototype.js" groupId="com.prototype" artifactId="prototype"/>
<fileName>coolstuff_core.js</fileName>
<includes><!-- ... --></includes>
</script>

<script>
<dep:dep script="coolstuff_core.js"/>
<!-- slider depends on dragdrop, depends on scriptaculous, depends on prototype (which is already depended on by core) -->
<dep:dep script="slider.js" groupId="com.scriptaculous" artifactId="scriptaculous"/>
<fileName>coolstuff_a.js</fileName>
<includes><!-- ... --></includes>
</script>

<script>
<dep:dep script="coolstuff_core.js"/>
<fileName>coolstuff_a.js</fileName>
<includes><!-- ... --></includes>
</script>
</scripts>
</assembler>

===================================

Activity

Hide
Christopher Hunt added a comment -

JS Import Maven plugin supports AMD which should solve this issue.

Show
Christopher Hunt added a comment - JS Import Maven plugin supports AMD which should solve this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: