Skip to content

Commit 0e16a33

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 36785f8 commit 0e16a33

18 files changed

+396
-1222
lines changed

VERSIONS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CRITICAL (may break existing content):
1212
- Added "use strict"; to everything.
1313
- Fixed clone on AlphaMapFilter
1414
- renamed BoxBlurFilter to BlurFilter
15+
- Updated the build process to use NodeJS & Grunt.js. Please refer to the readme in the build folder.
1516

1617
*****
1718
DEPRECATED (will be removed in a future version):

build/Build_MovieClip_OSX.command

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

build/Build_MovieClip_Win.bat

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

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: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
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: 'easeljs',
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('easel_source'),
33+
'output/movieclip-<%= version %>.min.js': getConfigValue('movieclip_source')
34+
}
35+
}
36+
},
37+
38+
// Build docs using yuidoc
39+
yuidoc: {
40+
compile: {
41+
name: '<%= pkg.name %>',
42+
version: '<%= version %>',
43+
description: '<%= pkg.description %>',
44+
url: '<%= pkg.url %>',
45+
logo: '<%= pkg.logo %>',
46+
options: {
47+
paths: ['../src/'],
48+
outdir: '<%= docsFolder %>',
49+
linkNatives: true,
50+
attributesEmit: true,
51+
selleck: true,
52+
helpers: ["./path.js"],
53+
themedir: "createjsTheme/"
54+
}
55+
}
56+
},
57+
58+
compress: {
59+
build: {
60+
options: {
61+
mode:'zip',
62+
archive:'output/<%= docsZip %>'
63+
},
64+
files: [
65+
{expand:true, src:'**', cwd:'<%= docsFolder %>'}
66+
]
67+
}
68+
},
69+
70+
copy: {
71+
docsZip: {
72+
files: [
73+
{expand: true, cwd:'output/', src:'<%= docsZip %>', dest:'../docs/'}
74+
]
75+
},
76+
docsSite: {
77+
files: [
78+
{expand:true, cwd:'<%= docsFolder %>', src:'**', dest:getConfigValue('docs_out_path')}
79+
]
80+
},
81+
src: {
82+
files: [
83+
{expand: true, cwd:'./output/', src: '*.js', dest: '../lib/'}
84+
]
85+
}
86+
},
87+
88+
updateversion: {
89+
easel: {
90+
file: '../src/easeljs/version.js',
91+
version: '<%= version %>'
92+
},
93+
movieclip: {
94+
file: '../src/easeljs/version_movieclip.js',
95+
version: '<%= version %>'
96+
}
97+
},
98+
}
99+
);
100+
function getHubTasks() {
101+
var arr = [
102+
getConfigValue('preload_path')+'build/Gruntfile.js',
103+
getConfigValue('tween_path')+'build/Gruntfile.js',
104+
getConfigValue('sound_path')+'build/Gruntfile.js'
105+
];
106+
return arr;
107+
}
108+
109+
function getBuildConfig() {
110+
// Read the global settings file first.
111+
var config = grunt.file.readJSON('config.json');
112+
113+
// If we have a config.local.json .. prefer its values.
114+
if (grunt.file.exists('config.local.json')) {
115+
var config2 = grunt.file.readJSON('config.local.json');
116+
_.extend(config, config2);
117+
}
118+
119+
return config;
120+
}
121+
122+
function getConfigValue(name) {
123+
var config = grunt.config.get('buildConfig');
124+
125+
if (config == null) {
126+
config = getBuildConfig();
127+
grunt.config.set('buildConfig', config);
128+
}
129+
130+
return config[name];
131+
}
132+
133+
// Load all the tasks we need
134+
grunt.loadNpmTasks('grunt-contrib-uglify');
135+
grunt.loadNpmTasks('grunt-contrib-yuidoc');
136+
grunt.loadNpmTasks('grunt-contrib-compress');
137+
grunt.loadNpmTasks('grunt-contrib-copy');
138+
grunt.loadTasks('tasks/');
139+
140+
/**
141+
* Build the docs using YUIdocs.
142+
*/
143+
grunt.registerTask('docs', [
144+
"yuidoc", "compress", "copy:docsZip"
145+
]);
146+
147+
/**
148+
* Sets out version to the version in package.json (defaults to NEXT)
149+
*/
150+
grunt.registerTask('setVersion', function () {
151+
grunt.config.set('version', grunt.config.get('pkg').version);
152+
});
153+
154+
/**
155+
* Task for exporting a next build.
156+
*
157+
*/
158+
grunt.registerTask('next', [
159+
"coreBuild"
160+
]);
161+
162+
/**
163+
* Task for exporting a release build (version based on package.json)
164+
*
165+
*/
166+
grunt.registerTask('build', [
167+
"setVersion", "coreBuild", "copy:docsSite"
168+
]);
169+
170+
/**
171+
* Main build task, always runs after next or build.
172+
*
173+
*/
174+
grunt.registerTask('coreBuild', [
175+
"updateversion", "uglify", "docs", "copy:src"
176+
]);
177+
};

build/license.txt renamed to build/LICENSE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/*
2-
* EaselJS
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
*

0 commit comments

Comments
 (0)