mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Big refactoring of the build process, now entierly Gulp based.
This commit is contained in:
parent
36cb88de4d
commit
c8bc179928
19 changed files with 180 additions and 369 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
|
node_modules
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
6
.gitmodules
vendored
6
.gitmodules
vendored
|
@ -1,3 +1,3 @@
|
||||||
[submodule "build/jsdoc-toolkit"]
|
[submodule "jsdoc-toolkit"]
|
||||||
path = build/jsdoc-toolkit
|
path = jsdoc-toolkit
|
||||||
url = git://github.com/paperjs/jsdoc-toolkit.git
|
url = https://github.com/paperjs/jsdoc-toolkit.git
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
||||||
# http://paperjs.org/
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
|
|
||||||
# http://scratchdisk.com/ & http://jonathanpuckey.com/
|
|
||||||
#
|
|
||||||
# Distributed under the MIT license. See LICENSE file for details.
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
|
|
||||||
# Usage:
|
|
||||||
# build.sh MODE
|
|
||||||
#
|
|
||||||
# MODE:
|
|
||||||
# commented Preprocessed, still formated and commented
|
|
||||||
# stripped Preprocessed, formated but without comments
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]
|
|
||||||
then
|
|
||||||
MODE="stripped"
|
|
||||||
else
|
|
||||||
MODE=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create the dist folder if it does not exist yet.
|
|
||||||
if [ ! -d ../dist/ ]
|
|
||||||
then
|
|
||||||
mkdir ../dist/
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f ../dist/paper-full.js ]
|
|
||||||
then
|
|
||||||
rm ../dist/paper-full.js
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f ../dist/paper-node.js ]
|
|
||||||
then
|
|
||||||
rm ../dist/paper-node.js
|
|
||||||
fi
|
|
||||||
|
|
||||||
./preprocess.sh $MODE ../src/paper.js "-i '../src/constants.js'" ../dist/paper-full.js
|
|
||||||
./preprocess.sh $MODE ../src/paper.js "-o '{ \"paperScript\": false, \"palette\": false }' -i '../src/constants.js'" ../dist/paper-core.js
|
|
||||||
./preprocess.sh $MODE ../src/paper.js "-o '{ \"environment\": \"node\", \"legacy\": false }' -i '../src/constants.js'" ../dist/paper-node.js
|
|
|
@ -1,20 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
||||||
# http://paperjs.org/
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
|
|
||||||
# http://scratchdisk.com/ & http://jonathanpuckey.com/
|
|
||||||
#
|
|
||||||
# Distributed under the MIT license. See LICENSE file for details.
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
|
|
||||||
echo "Building paper.js"
|
|
||||||
./build.sh
|
|
||||||
echo "Minifying paper.js"
|
|
||||||
./minify.sh
|
|
||||||
echo "Building docs"
|
|
||||||
./docs.sh
|
|
||||||
echo "Zipping paperjs.zip"
|
|
||||||
./zip.sh
|
|
|
@ -1,35 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
||||||
# http://paperjs.org/
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
|
|
||||||
# http://scratchdisk.com/ & http://jonathanpuckey.com/
|
|
||||||
#
|
|
||||||
# Distributed under the MIT license. See LICENSE file for details.
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
|
|
||||||
# Generate documentation
|
|
||||||
#
|
|
||||||
# MODE:
|
|
||||||
# docs Generates the JS API docs - Default
|
|
||||||
# serverdocs Generates the website templates for the online JS API docs
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]
|
|
||||||
then
|
|
||||||
MODE="docs"
|
|
||||||
else
|
|
||||||
MODE=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd jsdoc-toolkit
|
|
||||||
# TODO: jsdoc2 -c=conf/$MODE.conf -D="renderMode:$MODE"
|
|
||||||
java -cp jsrun.jar:lib/* JsRun app/run.js -c=conf/$MODE.conf -D="renderMode:$MODE"
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
if [ $MODE = "docs" ]
|
|
||||||
then
|
|
||||||
# Build paper.js library for documentation
|
|
||||||
./preprocess.sh stripped ../src/paper.js "-i '../src/constants.js'" ../dist/docs/assets/js/paper.js
|
|
||||||
fi
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 00b7f8e4c2594620f58e03d3d1dd233548dab392
|
|
|
@ -1,28 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
||||||
# http://paperjs.org/
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
|
|
||||||
# http://scratchdisk.com/ & http://jonathanpuckey.com/
|
|
||||||
#
|
|
||||||
# Distributed under the MIT license. See LICENSE file for details.
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
|
|
||||||
# This script simply creates symbolic links to src/load.js from
|
|
||||||
# dist/paper-full.js and dist/paper-node.js, which loads the library from
|
|
||||||
# separate sources through Prepro.js both in the browser and in Node.js.
|
|
||||||
|
|
||||||
if [ -f ../dist/paper-full.js ]
|
|
||||||
then
|
|
||||||
rm ../dist/paper-full.js
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f ../dist/paper-node.js ]
|
|
||||||
then
|
|
||||||
rm ../dist/paper-node.js
|
|
||||||
fi
|
|
||||||
|
|
||||||
ln -s ../src/load.js ../dist/paper-full.js
|
|
||||||
ln -s ../src/load.js ../dist/paper-node.js
|
|
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
||||||
# http://paperjs.org/
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
|
|
||||||
# http://scratchdisk.com/ & http://jonathanpuckey.com/
|
|
||||||
#
|
|
||||||
# Distributed under the MIT license. See LICENSE file for details.
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
|
|
||||||
../node_modules/.bin/uglifyjs ../bower_components/acorn/acorn.js -o ../bower_components/acorn/acorn.min.js -c -m -b ascii_only=true,beautify=falsefy=false
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
||||||
# http://paperjs.org/
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
|
|
||||||
# http://scratchdisk.com/ & http://jonathanpuckey.com/
|
|
||||||
#
|
|
||||||
# Distributed under the MIT license. See LICENSE file for details.
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
|
|
||||||
../node_modules/.bin/uglifyjs ../dist/paper-full.js -o ../dist/paper-full.min.js -c unsafe=true -m -b ascii_only=true,beautify=false --comments /^!/
|
|
||||||
../node_modules/.bin/uglifyjs ../dist/paper-core.js -o ../dist/paper-core.min.js -c unsafe=true -m --comments /^!/
|
|
|
@ -1,44 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
||||||
# http://paperjs.org/
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
|
|
||||||
# http://scratchdisk.com/ & http://jonathanpuckey.com/
|
|
||||||
#
|
|
||||||
# Distributed under the MIT license. See LICENSE file for details.
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
|
|
||||||
# preprocess.sh
|
|
||||||
#
|
|
||||||
# A simple code preprocessing wrapper that uses a combination of cpp, jssrip.py
|
|
||||||
# and sed to preprocess JavaScript files containing C-style preprocess macros
|
|
||||||
# (#include, #ifdef, etc.). Three options offer control over whether comments
|
|
||||||
# are preserved or stripped and whitespaces are compressed.
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# preprocess.sh MODE SOURCE ARGUMENTS DESTINATION
|
|
||||||
#
|
|
||||||
# MODE:
|
|
||||||
# commented Preprocessed, still formated and commented
|
|
||||||
# stripped Preprocessed, formated but without comments
|
|
||||||
|
|
||||||
# Get the date from the git log:
|
|
||||||
DATE=$(git log -1 --pretty=format:%ad)
|
|
||||||
# Load __options from options.js and convert it to escaped JSON, to be passed on
|
|
||||||
# to prepro:
|
|
||||||
OPTIONS=$(printf '%q' $(node -e "
|
|
||||||
eval(require('fs').readFileSync('../src/options.js', 'utf8'));
|
|
||||||
process.stdout.write(JSON.stringify(__options));
|
|
||||||
"))
|
|
||||||
# Build the prepo.js command out of it, passing on version and date as defines:
|
|
||||||
COMMAND="../node_modules/.bin/prepro -o $OPTIONS -o '{ \"date\": \"$DATE\" }' $3 $2"
|
|
||||||
# Flags to pass to prepro
|
|
||||||
if [ $1 = "stripped" ]; then FLAGS="-c"; else FLAGS=""; fi
|
|
||||||
|
|
||||||
eval "$COMMAND $FLAGS" > $4
|
|
||||||
# Now convert 4 spaces to tabs, to shave of some bytes (quite a few KB actually)
|
|
||||||
unexpand -t 4 -a $4 > "$4-tabs" && mv "$4-tabs" $4
|
|
||||||
# Remove trailing white-space on each line
|
|
||||||
perl -p -i -e "s/[ \t]*$//g" $4
|
|
|
@ -1,90 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
||||||
# http://paperjs.org/
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
|
|
||||||
# http://scratchdisk.com/ & http://jonathanpuckey.com/
|
|
||||||
#
|
|
||||||
# Distributed under the MIT license. See LICENSE file for details.
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
|
|
||||||
# Extract the paper.js version from options.js:
|
|
||||||
VERSION=$(printf '%q' $(node -e "
|
|
||||||
eval(require('fs').readFileSync('../src/options.js', 'utf8'));
|
|
||||||
process.stdout.write(__options.version);
|
|
||||||
"))
|
|
||||||
|
|
||||||
# Helper function that updates paper.js vesion in JSON files
|
|
||||||
function update_version()
|
|
||||||
{
|
|
||||||
node -e "
|
|
||||||
var data = require('$1');
|
|
||||||
data.version = '$VERSION';
|
|
||||||
require('fs').writeFile('$1',
|
|
||||||
JSON.stringify(data, null, ' ') + require('os').EOL);
|
|
||||||
"
|
|
||||||
}
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
PAPER_DIR=`PWD`
|
|
||||||
cd ../paperjs.org
|
|
||||||
SITE_DIR=`PWD`
|
|
||||||
DIST_FILE=content/11-Download/paperjs-v$VERSION.zip # Relative to $SITE_DIR
|
|
||||||
|
|
||||||
cd $PAPER_DIR
|
|
||||||
# Make sure we're in the right branch
|
|
||||||
git checkout develop
|
|
||||||
cd $PAPER_DIR/build
|
|
||||||
./dist.sh
|
|
||||||
cd $PAPER_DIR
|
|
||||||
echo "Commiting Version"
|
|
||||||
# Update versions
|
|
||||||
update_version './package.json'
|
|
||||||
update_version './component.json'
|
|
||||||
# Add changed json configuration files
|
|
||||||
git add -u src/options.js # Commit as well, since it was manually bumped.
|
|
||||||
git add -u package.json
|
|
||||||
git add -u component.json
|
|
||||||
# Add all changed files in dist
|
|
||||||
git add -u dist
|
|
||||||
# Commit version
|
|
||||||
git commit -m "Release version v$VERSION"
|
|
||||||
# Tag version
|
|
||||||
git tag "v$VERSION"
|
|
||||||
# Merge develop into master
|
|
||||||
git checkout master
|
|
||||||
git merge develop -X theirs
|
|
||||||
# Push commits on both branches and tags
|
|
||||||
git push origin master develop
|
|
||||||
git push --tags
|
|
||||||
# Publish
|
|
||||||
npm publish
|
|
||||||
# Go back to develop branch and switch to using load.js again
|
|
||||||
git checkout develop
|
|
||||||
cd $PAPER_DIR/build
|
|
||||||
./load.sh
|
|
||||||
cd $PAPER_DIR
|
|
||||||
# Add all changed files in dist
|
|
||||||
git add -u dist
|
|
||||||
# Commit version
|
|
||||||
git commit -m "Switch back to load.js versions for development."
|
|
||||||
git push origin develop
|
|
||||||
|
|
||||||
# Copy paperjs.zip to the website's download folder
|
|
||||||
cd $SITE_DIR
|
|
||||||
git pull
|
|
||||||
cp $PAPER_DIR/dist/paperjs.zip $DIST_FILE
|
|
||||||
# Update the online version of paper.js
|
|
||||||
cp $PAPER_DIR/dist/paper-full.js assets/js/paper.js
|
|
||||||
# Commit to paperjs.org
|
|
||||||
git add -A $DIST_FILE
|
|
||||||
git add -u assets/js/paper.js
|
|
||||||
git commit -m "Release version v$VERSION"
|
|
||||||
# Tag & Push
|
|
||||||
git tag "v$VERSION"
|
|
||||||
git push
|
|
||||||
git push --tags
|
|
||||||
|
|
||||||
cd "$PAPER_DIR/build"
|
|
|
@ -1,17 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
||||||
# http://paperjs.org/
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
|
|
||||||
# http://scratchdisk.com/ & http://jonathanpuckey.com/
|
|
||||||
#
|
|
||||||
# Distributed under the MIT license. See LICENSE file for details.
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
|
|
||||||
# Generates TypeScript declaration file
|
|
||||||
|
|
||||||
cd jsdoc-toolkit
|
|
||||||
java -jar jsrun.jar app/run.js -c=conf/typescript.conf
|
|
||||||
cd ..
|
|
40
build/zip.sh
40
build/zip.sh
|
@ -1,40 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
||||||
# http://paperjs.org/
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
|
|
||||||
# http://scratchdisk.com/ & http://jonathanpuckey.com/
|
|
||||||
#
|
|
||||||
# Distributed under the MIT license. See LICENSE file for details.
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
|
|
||||||
# Create a temporary folder to copy all files in for zipping
|
|
||||||
mkdir zip
|
|
||||||
cd zip
|
|
||||||
BASE=../..
|
|
||||||
|
|
||||||
# Copy license over
|
|
||||||
cp $BASE/LICENSE.txt .
|
|
||||||
# Make library folder and copy paper.js there
|
|
||||||
mkdir dist
|
|
||||||
# Copy all versions
|
|
||||||
cp $BASE/dist/paper-full.js dist
|
|
||||||
cp $BASE/dist/paper-full.min.js dist
|
|
||||||
cp $BASE/dist/paper-core.js dist
|
|
||||||
cp $BASE/dist/paper-core.min.js dist
|
|
||||||
# Copy examples over
|
|
||||||
cp -r $BASE/examples .
|
|
||||||
# Copy docs over
|
|
||||||
cp -r $BASE/dist/docs .
|
|
||||||
# Erase the old Zip file
|
|
||||||
if [ -f $BASE/dist/paperjs.zip ]
|
|
||||||
then
|
|
||||||
rm $BASE/dist/paperjs.zip
|
|
||||||
fi
|
|
||||||
# Zip the whole thing
|
|
||||||
zip -9 -r $BASE/dist/paperjs.zip * LICENSE.txt -x "*/.DS_Store"
|
|
||||||
cd ..
|
|
||||||
# Remove the temporary folder again
|
|
||||||
rm -fr zip
|
|
155
gulpfile.js
155
gulpfile.js
|
@ -11,9 +11,160 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var gulp = require('gulp'),
|
var gulp = require('gulp'),
|
||||||
qunit = require('gulp-qunit');
|
qunit = require('gulp-qunit'),
|
||||||
|
prepro = require('gulp-prepro'),
|
||||||
|
rename = require('gulp-rename'),
|
||||||
|
rimraf = require('gulp-rimraf'),
|
||||||
|
shell = require('gulp-shell'),
|
||||||
|
symlink = require('gulp-symlink'),
|
||||||
|
uglify = require('gulp-uglify'),
|
||||||
|
uncomment = require('gulp-uncomment'),
|
||||||
|
whitespace = require('gulp-whitespace'),
|
||||||
|
zip = require('gulp-zip'),
|
||||||
|
merge = require('merge-stream'),
|
||||||
|
gitty = require('gitty')('.'),
|
||||||
|
fs = require('fs');
|
||||||
|
|
||||||
|
// Options to be used in Prepro.js preprocessing through the global __options
|
||||||
|
// object.
|
||||||
|
var buildOptions = {
|
||||||
|
full: { paperScript: true },
|
||||||
|
core: { paperScript: false },
|
||||||
|
node: { environment: 'node', paperScript: true }
|
||||||
|
};
|
||||||
|
|
||||||
|
var docOptions = {
|
||||||
|
local: 'docs', // Generates the offline docs
|
||||||
|
server: 'serverdocs' // Generates the website templates for the online docs
|
||||||
|
};
|
||||||
|
|
||||||
|
var uglifyOptions = {
|
||||||
|
output: {
|
||||||
|
// ascii_only: true,
|
||||||
|
comments: /^!/
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var buildNames = Object.keys(buildOptions);
|
||||||
|
var docNames = Object.keys(docOptions);
|
||||||
|
|
||||||
|
gulp.on('error', function(err) {
|
||||||
|
console.error(err.toString());
|
||||||
|
gulp.emit('end');
|
||||||
|
});
|
||||||
|
|
||||||
gulp.task('test', function() {
|
gulp.task('test', function() {
|
||||||
return gulp.src('./test/index.html')
|
return gulp.src('test/index.html')
|
||||||
.pipe(qunit({ timeout: 20, noGlobals: true }));
|
.pipe(qunit({ timeout: 20, noGlobals: true }));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
docNames.forEach(function(name) {
|
||||||
|
gulp.task('docs:' + name, shell.task([
|
||||||
|
'java -cp jsrun.jar:lib/* JsRun app/run.js -c=conf/' + name + '.conf ' +
|
||||||
|
'-D="renderMode:' + docOptions[name] + '"',
|
||||||
|
], {
|
||||||
|
cwd: 'jsdoc-toolkit'
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('docs', ['docs:local']);
|
||||||
|
|
||||||
|
gulp.task('load', ['clean:load'], function() {
|
||||||
|
return gulp.src('src/load.js')
|
||||||
|
.pipe(symlink('dist/paper-full.js'))
|
||||||
|
.pipe(symlink('dist/paper-node.js'));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('clean:load', function() {
|
||||||
|
return gulp.src([
|
||||||
|
'dist/paper-full.js',
|
||||||
|
'dist/paper-node.js'
|
||||||
|
], { read: false })
|
||||||
|
.pipe(rimraf());
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('build',
|
||||||
|
buildNames.map(function(name) {
|
||||||
|
return 'build:' + name;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task('minify', ['build'], function() {
|
||||||
|
return gulp.src([
|
||||||
|
'dist/paper-full.js',
|
||||||
|
'dist/paper-core.js'
|
||||||
|
])
|
||||||
|
.pipe(uglify(uglifyOptions))
|
||||||
|
.pipe(rename({
|
||||||
|
suffix: '.min'
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest('dist'));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('dist', ['minify', 'docs'], function() {
|
||||||
|
return merge(
|
||||||
|
gulp.src([
|
||||||
|
'dist/paper-full*.js',
|
||||||
|
'dist/paper-core*.js',
|
||||||
|
'LICENSE.txt',
|
||||||
|
'examples/**/*',
|
||||||
|
], { base: '.' }),
|
||||||
|
gulp.src([
|
||||||
|
'dist/docs/**/*'
|
||||||
|
], { base: 'dist' })
|
||||||
|
)
|
||||||
|
.pipe(zip('/paperjs.zip'))
|
||||||
|
.pipe(gulp.dest('dist'));
|
||||||
|
});
|
||||||
|
|
||||||
|
buildNames.forEach(function(name) {
|
||||||
|
// Get the date of the last commit from git.
|
||||||
|
var logData = gitty.logSync('-1');
|
||||||
|
gulp.task('build:' + name, ['build:start'], function() {
|
||||||
|
return gulp.src('src/paper.js')
|
||||||
|
.pipe(prepro({
|
||||||
|
evaluate: ['src/constants.js', 'src/options.js'],
|
||||||
|
setup: function() {
|
||||||
|
var options = buildOptions[name];
|
||||||
|
options.date = logData[0].date;
|
||||||
|
// This object will be merged into the Prepro.js VM scope,
|
||||||
|
// which already holds a __options object from the above
|
||||||
|
// include statement.
|
||||||
|
return { __options: options };
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
.pipe(uncomment({
|
||||||
|
mergeEmptyLines: true
|
||||||
|
}))
|
||||||
|
.pipe(whitespace({
|
||||||
|
spacesToTabs: 4,
|
||||||
|
removeTrailing: true
|
||||||
|
}))
|
||||||
|
.pipe(rename({
|
||||||
|
suffix: '-' + name
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest('dist'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('build:start', ['clean:build', 'minify:acorn']);
|
||||||
|
|
||||||
|
gulp.task('clean:build', function() {
|
||||||
|
return gulp.src('dist/paper-*.js', { read: false })
|
||||||
|
.pipe(rimraf());
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('minify:acorn', function() {
|
||||||
|
var path = 'bower_components/acorn/';
|
||||||
|
// Only compress acorn if the compressed file doesn't exist yet.
|
||||||
|
try {
|
||||||
|
fs.accessSync(path + 'acorn.min.js');
|
||||||
|
} catch(e) {
|
||||||
|
return gulp.src(path + 'acorn.js')
|
||||||
|
.pipe(uglify(uglifyOptions))
|
||||||
|
.pipe(rename({
|
||||||
|
suffix: '.min'
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest(path));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
1
jsdoc-toolkit
Submodule
1
jsdoc-toolkit
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 29d942966af938da861181e87ee98b6e91c92073
|
10
node_modules/.gitignore
generated
vendored
10
node_modules/.gitignore
generated
vendored
|
@ -1,10 +0,0 @@
|
||||||
.bin
|
|
||||||
canvas
|
|
||||||
grunt*
|
|
||||||
gulp*
|
|
||||||
jsdom
|
|
||||||
jshint
|
|
||||||
prepro
|
|
||||||
qunitjs
|
|
||||||
request
|
|
||||||
uglify-js
|
|
14
package.json
14
package.json
|
@ -36,11 +36,21 @@
|
||||||
"canvas": ">=1.2.9 <2.0.0"
|
"canvas": ">=1.2.9 <2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"gitty": "^3.3.3",
|
||||||
"gulp": "^3.9.0",
|
"gulp": "^3.9.0",
|
||||||
|
"gulp-prepro": "^2.0.0",
|
||||||
"gulp-qunit": "git://github.com/lehni/gulp-qunit.git#459c5603ceac460327a40dc89df6f19c786dc61b",
|
"gulp-qunit": "git://github.com/lehni/gulp-qunit.git#459c5603ceac460327a40dc89df6f19c786dc61b",
|
||||||
|
"gulp-rename": "^1.2.2",
|
||||||
|
"gulp-rimraf": "^0.2.0",
|
||||||
|
"gulp-shell": "^0.5.1",
|
||||||
|
"gulp-symlink": "^2.1.3",
|
||||||
|
"gulp-uglify": "^1.5.1",
|
||||||
|
"gulp-uncomment": "^0.2.0",
|
||||||
|
"gulp-whitespace": "^0.1.0",
|
||||||
|
"gulp-zip": "^3.0.2",
|
||||||
"jshint": "2.8.x",
|
"jshint": "2.8.x",
|
||||||
"prepro": "~0.9.1",
|
"merge-stream": "^1.0.0",
|
||||||
"uglify-js": "~2.4.24"
|
"prepro": "^2.0.0"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"vector",
|
"vector",
|
||||||
|
|
13
src/load.js
13
src/load.js
|
@ -41,10 +41,15 @@ if (typeof window === 'object') {
|
||||||
// Step out and back into src in case this is loaded from dist/paper-node.js
|
// Step out and back into src in case this is loaded from dist/paper-node.js
|
||||||
prepro.include('../src/options.js');
|
prepro.include('../src/options.js');
|
||||||
// Override node specific options.
|
// Override node specific options.
|
||||||
prepro.setOptions({
|
prepro.setup(function() {
|
||||||
environment: 'node',
|
// This object will be merged into the Prepro.js VM scope, which already
|
||||||
legacy: false,
|
// holds a __options object from the above include statement.
|
||||||
version: 'dev'
|
return {
|
||||||
|
__options: {
|
||||||
|
version: 'dev',
|
||||||
|
environment: 'node'
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
// Load Paper.js library files.
|
// Load Paper.js library files.
|
||||||
prepro.include('../src/paper.js');
|
prepro.include('../src/paper.js');
|
||||||
|
|
Loading…
Reference in a new issue