Skip to content

Commit 687dc39

Browse files
author
Lanny McNie
committed
Updated the build process to use NodeJS & Grunt.js.
Please refer to the readme in the build folder. Signed-off-by: Lanny McNie <lanny@gskinner.com>
1 parent 2b4cbbc commit 687dc39

File tree

13 files changed

+311
-209
lines changed

13 files changed

+311
-209
lines changed

VERSIONS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ CRITICAL (may break existing content):
2222
- fixed hasActiveTweens to return a Boolean consistently
2323
- added Timeline.getLabels() & getCurrentLabel()
2424
- Tween waits to add itself as a listener on Ticker until the first tween is started
25+
- Updated the build process to use NodeJS & Grunt.js. Please refer to the readme in the build folder.
2526

2627

2728
Version 0.4.1 [May 10, 2013]

build/Build_OSX.command

Lines changed: 0 additions & 47 deletions
This file was deleted.

build/Build_Win.bat

Lines changed: 0 additions & 41 deletions
This file was deleted.

build/Gruntfile.js

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
var path = require('path');
2+
var _ = require('lodash');
3+
4+
module.exports = function (grunt) {
5+
grunt.initConfig(
6+
{
7+
pkg: grunt.file.readJSON('package.json'),
8+
9+
// Default values
10+
version: 'NEXT',
11+
name: 'tweenjs',
12+
docsZip: "<%= pkg.name %>_docs-<%= version %>.zip",
13+
14+
// Setup doc names / paths.
15+
docsName: '<%= pkg.name %>_docs-<%= version %>',
16+
docsZip: "<%= docsName %>.zip",
17+
docsFolder: "./output/<%= docsName %>/",
18+
19+
// Setup Uglify for JS minification.
20+
uglify: {
21+
options: {
22+
banner: grunt.file.read('LICENSE'),
23+
preserveComments: "some",
24+
compress: {
25+
global_defs: {
26+
"DEBUG": false
27+
}
28+
},
29+
},
30+
build: {
31+
files: {
32+
'output/<%= pkg.name.toLowerCase() %>-<%= version %>.min.js': getConfigValue('source'),
33+
}
34+
}
35+
},
36+
37+
// Build docs using yuidoc
38+
yuidoc: {
39+
compile: {
40+
name: '<%= pkg.name %>',
41+
version: '<%= version %>',
42+
description: '<%= pkg.description %>',
43+
url: '<%= pkg.url %>',
44+
logo: '<%= pkg.logo %>',
45+
options: {
46+
paths: ['../src/'],
47+
outdir: '<%= docsFolder %>',
48+
linkNatives: true,
49+
attributesEmit: true,
50+
selleck: true,
51+
helpers: ["./path.js"],
52+
themedir: "createjsTheme/"
53+
}
54+
}
55+
},
56+
57+
compress: {
58+
build: {
59+
options: {
60+
mode:'zip',
61+
archive:'output/<%= docsZip %>'
62+
},
63+
files: [
64+
{expand:true, src:'**', cwd:'<%= docsFolder %>'}
65+
]
66+
}
67+
},
68+
69+
copy: {
70+
docsZip: {
71+
files: [
72+
{expand:true, cwd:'output/', src:'<%= docsZip %>', dest:'../docs/'}
73+
]
74+
},
75+
docsSite: {
76+
files: [
77+
{expand:true, cwd:'<%= docsFolder %>', src:'**', dest:getConfigValue('docs_out_path')}
78+
]
79+
},
80+
src: {
81+
files: [
82+
{expand: true, cwd:'./output/', src: '*.js', dest: '../lib/'}
83+
]
84+
}
85+
},
86+
87+
updateversion: {
88+
build: {
89+
file: '../src/tweenjs/version.js',
90+
version: '<%= version %>'
91+
},
92+
}
93+
}
94+
);
95+
96+
function getBuildConfig() {
97+
// Read the global settings file first.
98+
var config = grunt.file.readJSON('config.json');
99+
100+
// If we have a config.local.json .. prefer its values.
101+
if (grunt.file.exists('config.local.json')) {
102+
var config2 = grunt.file.readJSON('config.local.json');
103+
_.extend(config, config2);
104+
}
105+
106+
return config;
107+
}
108+
109+
function getConfigValue(name) {
110+
var config = grunt.config.get('buildConfig');
111+
112+
if (config == null) {
113+
config = getBuildConfig();
114+
grunt.config.set('buildConfig', config);
115+
}
116+
117+
return config[name];
118+
}
119+
120+
// Load all the tasks we need
121+
grunt.loadNpmTasks('grunt-contrib-uglify');
122+
grunt.loadNpmTasks('grunt-contrib-yuidoc');
123+
grunt.loadNpmTasks('grunt-contrib-compress');
124+
grunt.loadNpmTasks('grunt-contrib-copy');
125+
grunt.loadTasks('tasks/');
126+
127+
/**
128+
* Build the docs using YUIdocs.
129+
*/
130+
grunt.registerTask('docs', [
131+
"yuidoc", "compress", "copy:docsZip"
132+
]);
133+
134+
/**
135+
* Sets out version to the version in package.json (defaults to NEXT)
136+
*/
137+
grunt.registerTask('setVersion', function () {
138+
grunt.config.set('version', grunt.config.get('pkg').version);
139+
});
140+
141+
/**
142+
* Task for exporting a next build.
143+
*
144+
*/
145+
grunt.registerTask('next', [
146+
"coreBuild"
147+
]);
148+
149+
/**
150+
* Task for exporting a release build (version based on package.json)
151+
*
152+
*/
153+
grunt.registerTask('build', [
154+
"setVersion", "coreBuild", "copy:docsSite"
155+
]);
156+
157+
/**
158+
* Main build task, always runs after next or build.
159+
*
160+
*/
161+
grunt.registerTask('coreBuild', [
162+
"updateversion", "uglify", "docs", "copy:src"
163+
]);
164+
};
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
/*
2-
* TweenJS
1+
/*!
2+
* @license <%= pkg.name %>
33
* Visit http://createjs.com/ for documentation, updates and examples.
44
*
5-
* Copyright (c) 2011 gskinner.com, inc.
6-
*
5+
* Copyright (c) 2011-2013 gskinner.com, inc.
6+
*
77
* Distributed under the terms of the MIT license.
88
* http://www.opensource.org/licenses/mit-license.html
99
*
1010
* This notice shall be included in all copies or substantial portions of the Software.
1111
*/
12+
13+
/**!
14+
* SoundJS FlashPlugin also includes swfobject (http://code.google.com/p/swfobject/)
15+
*/
16+

build/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## We use grunt (http://gruntjs.com/) to manage our build process.
2+
3+
If you previously used an older process, you may want to clean up the node_modules and output folders.
4+
5+
## To use
6+
7+
### Install dependencies
8+
9+
Node (0.10.x or greater is required):
10+
11+
# check the version
12+
node -v
13+
14+
If your node is out of date, install the latest from:
15+
http://nodejs.org/
16+
17+
After node is setup, install the other dependencies:
18+
19+
# Install the grunt command line utility
20+
sudo npm install grunt-cli -g
21+
22+
# Install all the dependencies for this project.
23+
npm install
24+
25+
### Setup
26+
27+
You'll need to change the default settings to suit your work environment.
28+
We have 2 config files:
29+
30+
* config.json - Is meant to be in git and pushed to all developers.
31+
* config.local.json - Is added to .gitignore and and only for your local setup (any settings in here will override those in config.json)
32+
33+
Please adjust these settings to match your environment. All paths can either be relative from the build folder, or absolute paths.
34+
35+
* docs_out_path - Location of the created YUIdocs. (Will be in your CreateJS.com/Docs/ folder)
36+
37+
### Building
38+
To export a release build for this library run:
39+
40+
grunt build
41+
42+
This command will:
43+
44+
* Update the version.js file(s).
45+
* Create the {PROJECT_NAME}-{VERSION}.min.js file
46+
* Compile the docs to config.docs_out_path
47+
* Create a zip file of the docs/
48+
* Copy the docs zip to ../docs
49+
* Copy the built js file to ../lib
50+
* Copy All examples from ../examples to config.examples_out_path
51+
52+
To build the NEXT version run:
53+
54+
grunt next
55+
56+
Does the exact same process as above but uses NEXT as the version.
57+
58+
59+
### All commands
60+
61+
grunt build - Build everything based on the version in package.json
62+
grunt next - Build everything using the NEXT version.
63+
grunt docs - Build only the docs
64+
grunt uglify - Create the Easel and MovieClip min files. (Will use NEXT as the version)

0 commit comments

Comments
 (0)