diff --git a/build/core.json b/build/core.json index 903230c8751..4b6fa024e19 100644 --- a/build/core.json +++ b/build/core.json @@ -3,7 +3,22 @@ "description": "The core of jQuery UI, required for all interactions and widgets.", "homepage": "http://jqueryui.com/", "demo": "http://jqueryui.com/", - "docs": "http://api.jqueryui.com/category/ui-core/" + "docs": "http://api.jqueryui.com/category/ui-core/", + "_": { + "docs": [ + "http://api.jqueryui.com/data-selector/", + "http://api.jqueryui.com/disableSelection/", + "http://api.jqueryui.com/enableSelection/", + "http://api.jqueryui.com/focus/", + "http://api.jqueryui.com/focusable-selector/", + "http://api.jqueryui.com/jQuery.ui.keyCode/", + "http://api.jqueryui.com/removeUniqueId/", + "http://api.jqueryui.com/scrollParent/", + "http://api.jqueryui.com/tabbable-selector/", + "http://api.jqueryui.com/uniqueId/", + "http://api.jqueryui.com/zIndex/" + ] + } }, "datepicker": { "description": "Displays a calendar from an input or inline for selecting dates.", @@ -31,7 +46,20 @@ "category": "effect", "homepage": "http://jqueryui.com/", "demo": "http://jqueryui.com/effect/", - "docs": "http://api.jqueryui.com/category/effects-core/" + "docs": "http://api.jqueryui.com/category/effects-core/", + "_": { + "docs": [ + "http://api.jqueryui.com/addClass/", + "http://api.jqueryui.com/color-animation/", + "http://api.jqueryui.com/effect/", + "http://api.jqueryui.com/hide/", + "http://api.jqueryui.com/removeClass/", + "http://api.jqueryui.com/show/", + "http://api.jqueryui.com/switchClass/", + "http://api.jqueryui.com/toggle/", + "http://api.jqueryui.com/toggleClass/" + ] + } }, "position": { "description": "Positions elements relative to other elements.", diff --git a/build/main.js b/build/main.js new file mode 100644 index 00000000000..3fd784da5ec --- /dev/null +++ b/build/main.js @@ -0,0 +1,3 @@ +module.exports = { + manifest: require( "./manifest" ) +}; diff --git a/build/manifest.js b/build/manifest.js new file mode 100644 index 00000000000..5df69568545 --- /dev/null +++ b/build/manifest.js @@ -0,0 +1,94 @@ +var categories, flatten, manifest, pkg; + +categories = { + core: { + name: "ui.{plugin}", + title: "jQuery UI {Plugin}" + }, + widget: { + name: "ui.{plugin}", + title: "jQuery UI {Plugin}", + dependencies: [ "core", "widget" ] + }, + interaction: { + name: "ui.{plugin}", + title: "jQuery UI {Plugin}", + dependencies: [ "core", "widget", "mouse" ] + }, + effect: { + name: "ui.effect-{plugin}", + title: "jQuery UI {Plugin} Effect", + keywords: [ "effect", "show", "hide" ], + homepage: "http://jqueryui.com/effect/", + demo: "http://jqueryui.com/effect/", + docs: "http://api.jqueryui.com/{plugin}-effect/", + dependencies: [ "effect" ] + } +}; + +flatten = function( flat, arr ) { + return flat.concat( arr ); +}; + +pkg = require( "../package.json" ); + +manifest = function( options ) { + options = options || {}; + + return Object.keys( categories ).map(function( category ) { + var baseManifest = categories[ category ], + plugins = require( "./" + category ); + + return Object.keys( plugins ).map(function( plugin ) { + var manifest, + data = plugins[ plugin ], + name = plugin.charAt( 0 ).toUpperCase() + plugin.substr( 1 ); + + function replace( str ) { + return str.replace( "{plugin}", plugin ).replace( "{Plugin}", name ); + } + + manifest = { + name: data.name || replace( baseManifest.name ), + title: data.title || replace( baseManifest.title ), + description: data.description, + keywords: [ "ui", plugin ] + .concat( baseManifest.keywords || [] ) + .concat( data.keywords || [] ), + version: pkg.version, + author: pkg.author, + maintainers: pkg.maintainers, + licenses: pkg.licenses, + bugs: pkg.bugs, + homepage: data.homepage || replace( baseManifest.homepage || + "http://jqueryui.com/{plugin}/" ), + demo: data.demo || replace( baseManifest.demo || + "http://jqueryui.com/{plugin}/" ), + docs: data.docs || replace( baseManifest.docs || + "http://api.jqueryui.com/{plugin}/" ), + download: "http://jqueryui.com/download/", + dependencies: { + jquery: ">=1.6" + }, + // custom + category: data.category || category + }; + + if ( options.extra ) { + Object.keys( data._ || {} ).forEach(function( prop ) { + manifest[ prop ] = data._[ prop ]; + }); + } + + (baseManifest.dependencies || []) + .concat(data.dependencies || []) + .forEach(function( dependency ) { + manifest.dependencies[ "ui." + dependency ] = pkg.version; + }); + + return manifest; + }); + }).reduce( flatten, [] ); +}; + +module.exports = manifest; diff --git a/build/tasks/build.js b/build/tasks/build.js index ca36ff998ed..ddda6b2b340 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -19,81 +19,8 @@ function expandFiles( files ) { } grunt.registerTask( "manifest", "Generate jquery.json manifest files", function() { - var pkg = grunt.config( "pkg" ), - base = { - core: { - name: "ui.{plugin}", - title: "jQuery UI {Plugin}" - }, - widget: { - name: "ui.{plugin}", - title: "jQuery UI {Plugin}", - dependencies: [ "core", "widget" ] - }, - interaction: { - name: "ui.{plugin}", - title: "jQuery UI {Plugin}", - dependencies: [ "core", "widget", "mouse" ] - }, - effect: { - name: "ui.effect-{plugin}", - title: "jQuery UI {Plugin} Effect", - keywords: [ "effect", "show", "hide" ], - homepage: "http://jqueryui.com/effect/", - demo: "http://jqueryui.com/effect/", - docs: "http://api.jqueryui.com/{plugin}-effect/", - dependencies: [ "effect" ] - } - }; - - Object.keys( base ).forEach(function( type ) { - var baseManifest = base[ type ], - plugins = grunt.file.readJSON( "build/" + type + ".json" ); - - Object.keys( plugins ).forEach(function( plugin ) { - var manifest, - data = plugins[ plugin ], - name = plugin.charAt( 0 ).toUpperCase() + plugin.substr( 1 ); - - function replace( str ) { - return str.replace( "{plugin}", plugin ).replace( "{Plugin}", name ); - } - - manifest = { - name: data.name || replace( baseManifest.name ), - title: data.title || replace( baseManifest.title ), - description: data.description, - keywords: [ "ui", plugin ] - .concat( baseManifest.keywords || [] ) - .concat( data.keywords || [] ), - version: pkg.version, - author: pkg.author, - maintainers: pkg.maintainers, - licenses: pkg.licenses, - bugs: pkg.bugs, - homepage: data.homepage || replace( baseManifest.homepage || - "http://jqueryui.com/{plugin}/" ), - demo: data.demo || replace( baseManifest.demo || - "http://jqueryui.com/{plugin}/" ), - docs: data.docs || replace( baseManifest.docs || - "http://api.jqueryui.com/{plugin}/" ), - download: "http://jqueryui.com/download/", - dependencies: { - jquery: ">=1.6" - }, - // custom - category: data.category || type - }; - - (baseManifest.dependencies || []) - .concat(data.dependencies || []) - .forEach(function( dependency ) { - manifest.dependencies[ "ui." + dependency ] = pkg.version; - }); - - grunt.file.write( manifest.name + ".jquery.json", - JSON.stringify( manifest, null, "\t" ) + "\n" ); - }); + require( "../manifest" )().forEach(function( manifest ) { + grunt.file.write( manifest.name + ".jquery.json", JSON.stringify( manifest, null, "\t" ) + "\n" ); }); }); diff --git a/package.json b/package.json index b561295b14b..0fddc280d63 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "name": "jQuery Foundation and other contributors", "url": "https://github.com/jquery/jquery-ui/blob/master/AUTHORS.txt" }, + "main": "build/main.js", "maintainers": [ { "name": "Scott González",