Permalink
Browse files

Update to 1.7.1 and 1.7 build profile.

  • Loading branch information...
1 parent 3ad813b commit fde4faa8dbe670088474ea2b22b134fc9a609d77 @csnover committed Dec 28, 2011
View
@@ -1,2 +1 @@
-www/js/dojo-release-1.6.0-src
dist
View
@@ -1,12 +1,12 @@
-[submodule "src/js/dojo"]
- path = src/js/dojo
+[submodule "src/dojo"]
+ path = src/dojo
url = https://github.com/dojo/dojo.git
-[submodule "src/js/dijit"]
- path = src/js/dijit
+[submodule "src/dijit"]
+ path = src/dijit
url = https://github.com/dojo/dijit.git
-[submodule "src/js/dojox"]
- path = src/js/dojox
+[submodule "src/dojox"]
+ path = src/dojox
url = https://github.com/dojo/dojox.git
-[submodule "src/js/util"]
- path = src/js/util
+[submodule "src/util"]
+ path = src/util
url = https://github.com/dojo/util.git
@@ -2,53 +2,51 @@
set -e
-UTILDIR=$(cd $(dirname $0) && pwd)
-
# Base directory for this entire project
-BASEDIR=$(cd "$UTILDIR/.." && pwd)
+BASEDIR=$(cd $(dirname $0) && pwd)
# Source directory for unbuilt code
SRCDIR="$BASEDIR/src"
# Directory containing dojo build utilities
-TOOLSDIR="$SRCDIR/js/util/buildscripts"
+TOOLSDIR="$SRCDIR/util/buildscripts"
# Destination directory for built code
DISTDIR="$BASEDIR/dist"
-# Main application package
-PACKAGEDIR="$BASEDIR/src/js/app"
-
# Main application package loader configuration
-LOADERCONF="$PACKAGEDIR/run.js"
+LOADERCONF="$SRCDIR/app/run.js"
+
+# Main application package build configuration
+PROFILE="$SRCDIR/app/app.profile.js"
if [ ! -d "$TOOLSDIR" ]; then
echo "Can't find Dojo build tools -- did you initialise submodules? (git submodule update --init --recursive)"
exit 1
fi
-echo "Building application at $PACKAGEDIR."
+echo "Building application with $PROFILE to $DISTDIR."
-# clean the old distribution files
echo -n "Cleaning old files..."
rm -rf "$DISTDIR"
echo " Done"
cd "$TOOLSDIR"
if which node >/dev/null; then
- node ../../dojo/dojo.js load=build --require "$LOADERCONF" --package "$PACKAGEDIR" --releaseDir "$DISTDIR" "$@"
+ node ../../dojo/dojo.js load=build --require "$LOADERCONF" --profile "$PROFILE" --releaseDir "$DISTDIR" "$@"
elif which java >/dev/null; then
- java -Xms256m -Xmx256m -cp ../shrinksafe/js.jar:../closureCompiler/compiler.jar:../shrinksafe/shrinksafe.jar org.mozilla.javascript.tools.shell.Main ../../dojo/dojo.js baseUrl=../../dojo load=build --require "$LOADERCONF" --package "$PACKAGEDIR" --releaseDir "$DISTDIR" "$@"
+ java -Xms256m -Xmx256m -cp ../shrinksafe/js.jar:../closureCompiler/compiler.jar:../shrinksafe/shrinksafe.jar org.mozilla.javascript.tools.shell.Main ../../dojo/dojo.js baseUrl=../../dojo load=build --require "$LOADERCONF" --profile "$PROFILE" --releaseDir "$DISTDIR" "$@"
else
echo "Need node.js or Java to build!"
exit 1
fi
-cd "$UTILDIR"
+cd "$BASEDIR"
-# copy the index.html and make it production-friendly
+# copy index.html and make it production-friendly
cp "$SRCDIR/index.html" "$DISTDIR/index.html"
sed -i "s/, *isDebug: *1//" "$DISTDIR/index.html"
+sed -i -e :a -re 's/<!--.*?-->//g;/<!--/N;//ba' "$DISTDIR/index.html"
echo "Build complete"
@@ -1,55 +0,0 @@
-/**
- * Build profiles look mostly the same in Dojo 1.7 as they do in previous versions of the toolkit.
- */
-dependencies = {
- // Builds a new release.
- action: 'release',
-
- // Strips all comments from CSS files.
- cssOptimize: 'comments',
-
- // Excludes tests, demos, and original template files from being included in the built version.
- mini: true,
-
- // Uses Closure Compiler as the JavaScript minifier. This can also be set to "shrinksafe" to use ShrinkSafe.
- optimize: 'closure',
-
- // This is the directory within the output directory that built JavaScript will be placed.
- releaseName: 'js',
-
- // Strips all calls to console functions within the code.
- stripConsole: 'all',
-
- // The default selector engine is not included by default in a dojo.js build in order to make mobile builds
- // smaller. We add it back here to avoid that extra HTTP request.
- selectorEngine: 'acme',
-
- // Builds can be split into multiple different JavaScript files called "layers". This allows applications to
- // defer loading large sections of code until they are actually required. Note that, at the moment, module IDs
- // in "dependencies" are still written using dots instead of slashes.
- layers: [
- // This is our main application layer. This layer will normally contain most or all of your application code.
- { name: '../app/main.js', dependencies: [ 'app.main' ] },
-
- // In the demo application, we conditionally require app/Dialog on the client-side, so we're building a
- // separate layer containing just that client-side code.
- { name: '../app/Dialog.js', dependencies: [ 'app.Dialog' ] }
- ],
-
- // Each package requires a defined prefix so that the builder can find and combine modules into a single file.
- // The first string in each array is the package name, and the second string is the path to that package, relative
- // to the directory containing dojo.js.
- prefixes: [
- [ 'dijit', '../dijit' ],
- [ 'dojox', '../dojox' ],
- [ 'app', '../app' ],
- [ 'dbp', '../dbp' ]
- ],
-
- // Providing hints to the build system allows code to be conditionally removed on a more granular level than
- // simple module dependencies can allow. This is especially useful for creating tiny mobile builds.
- // Keep in mind that dead code removal only happens in minifiers that support it! Currently, ShrinkSafe does not
- // support dead code removal; Closure Compiler and UglifyJS do.
- staticHasFeatures: {
- }
-}
File renamed without changes.
@@ -4,22 +4,21 @@
// This function is used to determine whether or not a resource should be tagged as copy-only. See the resourceTags
// property below for more information.
-function copyOnly(mid){
-
- // Ensures that our boot script is not transformed by the build system.
- return mid in {
- 'app/run': 1
- };
+function copyOnly(mid) {
+ // Ensures that our boot script is not transformed by the build system.
+ return mid in {
+ 'app/run': 1
+ };
}
var profile = {
- // basePath is relative to the directory containing this profile file; in this case, it is being set to the
- // src/js directory, which is the same place as the baseUrl directory in the loader configuration.
- basePath: '..',
+ // basePath is relative to the directory containing this profile file; in this case, it is being set to the
+ // src/ directory, which is the same place as the baseUrl directory in the loader configuration.
+ basePath: '..',
// This is the directory within the release directory where built packages will be placed. The release directory
- // itself is defined by util/build.sh.
- releaseName: 'js',
+ // itself is defined by util/build.sh.
+ // releaseName: '',
// Builds a new release.
action: 'release',
@@ -31,7 +30,7 @@ var profile = {
mini: true,
// Uses Closure Compiler as the JavaScript minifier. This can also be set to "shrinksafe" to use ShrinkSafe.
- optimize: 'closure',
+ optimize: 'shrinksafe',
// Strips all calls to console functions within the code.
stripConsole: 'all',
@@ -42,15 +41,15 @@ var profile = {
// Builds can be split into multiple different JavaScript files called "layers". This allows applications to
// defer loading large sections of code until they are actually required while still allowing multiple modules to
- // be compiled into a single file.
+ // be compiled into a single file.
layers: {
// This is our main application layer. This layer will normally contain most or all of your application code.
'app/main': { include: [ 'app/main' ] },
// In the demo application, we conditionally require app/Dialog on the client-side, so we're building a
// separate layer containing just that client-side code.
'app/Dialog': { include: [ 'app/Dialog' ] }
- },
+ },
// Providing hints to the build system allows code to be conditionally removed on a more granular level than
// simple module dependencies can allow. This is especially useful for creating tiny mobile builds.
@@ -59,27 +58,29 @@ var profile = {
staticHasFeatures: {
},
- // Resource tags are functions that provide hints to the compiler about a given file. The first argument is the
- // filename of the file, and the second argument is the module ID for the file.
- resourceTags:{
- // Files that contain test code.
- test: function(filename, mid){
- return false;
- },
-
- // Files that should be copied as-is without being modified by the build system.
- copyOnly: function(filename, mid){
- return copyOnly(mid);
- },
-
- // Files that are AMD modules.
- amd: function(filename, mid){
- return !copyOnly(mid) && /\.js$/.test(filename);
- },
-
- // Files that should not be copied when the "mini" compiler flag is set to true.
- miniExclude: function(filename, mid){
- return false;
- }
- }
+ // Resource tags are functions that provide hints to the compiler about a given file. The first argument is the
+ // filename of the file, and the second argument is the module ID for the file.
+ resourceTags: {
+ // Files that contain test code.
+ test: function (filename, mid) {
+ return false;
+ },
+
+ // Files that should be copied as-is without being modified by the build system.
+ copyOnly: function (filename, mid) {
+ return copyOnly(mid);
+ },
+
+ // Files that are AMD modules.
+ amd: function (filename, mid) {
+ return !copyOnly(mid) && /\.js$/.test(filename);
+ },
+
+ // Files that should not be copied when the "mini" compiler flag is set to true.
+ miniExclude: function (filename, mid) {
+ return mid in {
+ 'app/profile': 1
+ };
+ }
+ }
};
View
@@ -0,0 +1,50 @@
+/**
+ * This file is your application's main JavaScript file. It is listed as a dependency in run.js and will
+ * automatically load when run.js loads.
+ *
+ * Because this file has the special filename "main.js", and because we've registered the "app" package in run.js,
+ * whatever object this module returns can be loaded by other files simply by requiring "app" (instead of "app/main").
+ *
+ * Our first dependency is to the "dojo/has" module, which allows us to conditionally execute code based on
+ * configuration settings or environmental information. Unlike a normal conditional, these branches can be compiled
+ * away by the build system; see staticHasFeatures in profiles/main.profile.js for more information.
+ *
+ * Our second dependency is to the special module "require"; this allows us to make additional require calls using
+ * relative module IDs within the body of our define function.
+ *
+ * In all cases, whatever function is passed to define() is only invoked once, and the return value is cached.
+ *
+ * More information about everything described about the loader throughout this file can be found at
+ * http://livedocs.dojotoolkit.org/loader/amd.
+ */
+define([ 'dojo/has', 'require' ], function (has, require) {
+ var app = {};
+
+ if (has('host-browser')) {
+ /*
+ * This require call's first dependency, "./Dialog", uses a relative module identifier; you should use this
+ * type of notation for dependencies *within* a package in order to ensure the package is fully portable. It
+ * works like a path, where "./" refers to the current directory and "../" refers to the parent directory. If
+ * you are referring to a module in a *different* package, you should *not* use a relative module identifier.
+ *
+ * The second dependency is a plugin dependency; in this case, it is a dependency on the special functionality
+ * of the "dojo/domReady" plugin, which waits until the DOM is ready before finishing loading.
+ * The "!" after the module name indicates you want to use special plugin functionality; if you were to
+ * require just "dojo/domReady", it would load that module just like any other module, without any of the
+ * special plugin functionality.
+ */
+ require([ './Dialog', 'dojo/domReady!' ], function (Dialog) {
+ app.dialog = new Dialog().placeAt(document.body);
+
+ // It is important to remember to always call startup on widgets after you have added them to the DOM.
+ // It won't hurt if you do it twice, but things will often not work right if you forget to do it.
+ app.dialog.startup();
+
+ // And now…
+ app.dialog.show();
+ });
+ }
+ else {
+ console.log('Hello from the server!');
+ }
+});
View
@@ -0,0 +1,26 @@
+{
+ "name": "app",
+ "version": "1.0",
+ "main": "main",
+ "dependencies": {
+ "dojo": "current",
+ "dijit": "current",
+ "dojox": "current",
+ "util": "current"
+ },
+ "description": "Dojo Boilerplate Example Application. A quick-start application that demonstrates basic usage of the Dojo Toolkit.",
+ "licenses": [
+ {
+ "type": "AFLv2.1",
+ "url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L43"
+ },
+ {
+ "type": "BSD",
+ "url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L13"
+ }
+ ],
+ "bugs": "https://github.com/csnover/dojo-boilerplate/issues",
+ "keywords": ["JavaScript", "Dojo", "Boilerplate", "Example", "Howto"],
+ "homepage": "https://github.com/csnover/dojo-boilerplate",
+ "dojoBuild": "app.profile.js"
+}
@@ -2,6 +2,8 @@
* If you are developing a project that makes use of Dijit widgets, you will probably want to include the two files
* below; otherwise, you can remove them. When building for release, Dojo will automatically combine all of your
* @imported CSS files into a single file.
+ *
+ * It is highly, highly recommended that you develop your CSS using LESS: http://lesscss.org.
*/
@import '../../dojo/resources/dojo.css';
@@ -9,18 +9,23 @@
require({
// The base path for all packages and modules. If you don't provide this, baseUrl defaults to the directory
// that contains dojo.js.
- baseUrl: 'js/',
+ baseUrl: '',
// A list of packages to register. Strictly speaking, you do not need to register any packages,
// but you can't require "app" and get app/main.js if you do not register the "app" package (the loader will look
// for a module at <baseUrl>/app.js instead). Unregistered packages also cannot use the packageMap feature, which
- // might be important to you if you need to relocate dependencies.
+ // might be important to you if you need to relocate dependencies. TL;DR, register all your packages all the time:
+ // it will make your life easier.
packages: [
- { name: 'dojo', location: 'dojo' },
- { name: 'dijit', location: 'dijit' },
- { name: 'dojox', location: 'dojox' },
- { name: 'app', location: 'app' },
- { name: 'dbp', location: 'dbp' }
+ // If you are registering a package that has an identical name and location, you can just pass a string
+ // instead, and it will configure it using that string for both the "name" and "location" properties. Handy!
+ 'dojo',
+ 'dijit',
+ 'dojox',
+ 'app',
+
+ // For reference, this is what a more verbose package declaration looks like.
+ { name: 'dbp', location: 'dbp', packageMap: {} }
]
// Require 'app'. This loads the main application file, app/main.js.
}, [ 'app' ]);
File renamed without changes.
File renamed without changes.
File renamed without changes.
Submodule dijit added at afb02f
Submodule dojo added at e051bf
Submodule dojox added at 9097d6
Oops, something went wrong.

0 comments on commit fde4faa

Please sign in to comment.