Commit graph

10 commits

Author SHA1 Message Date
Ron de las Alas
352acb9700 ci: ts-definition-test from gitignore and add the file 2023-10-31 09:54:34 -04:00
Ron de las Alas
597c18c04a ci: add paperjs build workflow 2023-10-30 16:12:18 -04:00
Jürg Lehni
db82f41151 Update year, author email addresses and links 2020-05-23 22:24:42 +02:00
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
Samuel Asensi
0c885964d3 Add support for nullable in documentation 2019-07-12 11:52:53 +02:00
Samuel Asensi
b24e9b3835 Fix typescript definition issues (#1669)
Closes #1667
Closes #1664
Closes #1663
Closes #1659
2019-06-22 13:46:05 +02:00
sapics
be4199b6eb Update copyright year to 2019 2018-12-27 16:13:01 +09:00
sasensi
b8a0743e3d Avoid using _ as parameter name. 2018-12-03 14:41:47 +01:00
sasensi
f25690aa91 Rename type definition file to paper.d.ts. 2018-12-03 14:41:47 +01:00
sasensi
bbd65324bc Add typescript definition generation
This add a gulp task (`gulp docs:typescript`) to automatically generate
a typescript definition for the library. This should solve the problem
of having an out of sync type definition when we change the API.

This task takes advantage of existing JSDoc parsing to generate a
temporary file which is later formatted through a mustache template to
generate the final definition. This definition is then tested by
compiling a typescript file that use it.
The generated definition is added to the `gulp zip` task in order to be
published along with the bundled library.

So 2 new dev-dependencies are added with this change: `mustache` and
`typescript` packages. Using node and mustache to generate the
definition instead of relying on existing templating system is
motivated by a better development experience, with easier debugging
possibilities... through the usage of more modern tools.

As a side note, support of "rest parameters" (when a parameter can be
present multiple times) is added to existing JSDoc parser in order to
support this pattern on typescript side (E.g. for `Color#set()` method
which accept any sequence of parameters that is supported by `Color`
constructors).
2018-12-03 14:41:47 +01:00