paper.js/gulp/tasks/dist.js
Samuel Asensi 43bbb249ab Allow paper core import in TypeScript (#1716)
* Allow paper core import in TypeScript

Typings were missing when importing paper core version with:
`import * as paper from 'paper/dist/paper-core'` syntax.
This changes the generated TypeScript definition so that it exports two
modules: `paper` and `paper/dist/paper-core`. In the same logic,
`paper-core.d.ts` file is added to make sure that the corresponding
definition is automatically loaded.
This also takes care of the fact that `PaperScript` class is not
available in paper core version, by removing it from the corresponding
TypeScript definition.
Finally, this also simplifies existing definition by directly exporting
a `PaperScope` instance as the module instead of duplicating all
`PaperScope` properties and methods on the module itself.
Closes #1713
2019-11-07 12:12:14 +01:00

43 lines
1.1 KiB
JavaScript

/*
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
*
* Copyright (c) 2011 - 2019, Juerg Lehni & Jonathan Puckey
* http://scratchdisk.com/ & https://puckey.studio/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*/
var gulp = require('gulp'),
del = require('del'),
merge = require('merge-stream'),
zip = require('gulp-zip');
gulp.task('dist', ['build', 'minify', 'docs']);
gulp.task('zip', ['clean:zip', 'dist'], function() {
return merge(
gulp.src([
'dist/paper-full*.js',
'dist/paper-core*.js',
'dist/paper.d.ts',
'dist/paper-core.d.ts',
'dist/node/**/*',
'LICENSE.txt',
'examples/**/*',
], { base: '.' }),
gulp.src([
'dist/docs/**/*'
], { base: 'dist' })
)
.pipe(zip('paperjs.zip'))
.pipe(gulp.dest('dist'));
});
gulp.task('clean:zip', function() {
return del([
'dist/paperjs.zip'
]);
});