Skip to content

Commit

Permalink
Generate Typescript Type Definitions (#779)
Browse files Browse the repository at this point in the history
* Publish typecript types

* Fix unnamed things

* put back

* Put backs. version was for old build tooling

* create a Mobiledoc type

* privatize

* more
  • Loading branch information
gpoitch committed Sep 1, 2022
1 parent 4b225fa commit 28809c3
Show file tree
Hide file tree
Showing 21 changed files with 223 additions and 141 deletions.
149 changes: 107 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -6,6 +6,7 @@
"module": "dist/mobiledoc.js",
"main": "dist/mobiledoc.cjs",
"style": "dist/mobiledoc.css",
"types": "dist/mobiledoc.d.ts",
"exports": {
".": {
"import": "./dist/mobiledoc.js",
Expand Down Expand Up @@ -70,6 +71,7 @@
"qunit": "^2.19.1",
"rollup": "^2.79.0",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-glob-import": "^0.5.0",
"rollup-plugin-serve": "^2.0.1",
"saucie": "^3.3.3",
Expand Down
9 changes: 9 additions & 0 deletions rollup.config.js
Expand Up @@ -6,6 +6,7 @@ import commonjs from '@rollup/plugin-commonjs'
import serve from 'rollup-plugin-serve'
import copy from 'rollup-plugin-copy'
import typescript from '@rollup/plugin-typescript'
import dts from 'rollup-plugin-dts'

function commonPlugins() {
return [
Expand Down Expand Up @@ -67,6 +68,14 @@ export default args => [
sourcemap: true,
},
},
{
input: 'src/js/index.ts',
plugins: [dts()],
output: {
file: 'dist/mobiledoc.d.ts',
format: 'es',
},
},
{
input: 'tests/index.ts',
plugins: [
Expand Down
6 changes: 4 additions & 2 deletions src/js/cards/image.ts
Expand Up @@ -5,7 +5,7 @@ interface ImagePayload {
src?: string
}

export default {
const ImageCard: CardData = {
name: 'image',
type: 'dom',

Expand All @@ -14,4 +14,6 @@ export default {
img.src = payload.src || placeholderImageSrc
return img
},
} as CardData
}

export default ImageCard

0 comments on commit 28809c3

Please sign in to comment.