-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate type definitions at build time #4
base: main
Are you sure you want to change the base?
Changes from all commits
7e64a0d
49c3f9f
96c5994
75f1d2a
de6b4c6
ba67020
6bf6236
b3f4ec0
78c80c5
2f77c25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/dist/ | ||
node_modules/ | ||
npm-debug.log | ||
/.rpt2_cache | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
"author": "Benedict Etzel <[email protected]>", | ||
"main": "./dist/index", | ||
"browser": "./dist/browser", | ||
"types": "./types.d.ts", | ||
"types": "./dist/index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/HearthSim/npm-deckstrings.git" | ||
|
@@ -42,12 +42,12 @@ | |
"karma-rollup-preprocessor": "^5.1.1", | ||
"mocha": "^5.0.0", | ||
"prettier": "^1.10.2", | ||
"rollup": "^0.55.1", | ||
"rollup": "^0.68.2", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the requirement of rollup-plugin-typescript2. |
||
"rollup-plugin-babel": "^3.0.3", | ||
"rollup-plugin-commonjs": "^8.3.0", | ||
"rollup-plugin-jscc": "^0.3.3", | ||
"rollup-plugin-node-resolve": "^3.0.2", | ||
"rollup-plugin-typescript": "^0.8.1", | ||
"rollup-plugin-typescript2": "^0.19.2", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since rollup-plugin-typescript seems to be unable to generate type definitions, I used rollup-plugin-typescript2. |
||
"typescript": "^2.7.1", | ||
"varint": "^5.0.0" | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,12 @@ | |
"compilerOptions": { | ||
/* Basic Options */ | ||
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ | ||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ | ||
"module": "ESNext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the requirement of rollup-plugin-typescript2. |
||
// "lib": [], /* Specify library files to be included in the compilation. */ | ||
// "allowJs": true, /* Allow javascript files to be compiled. */ | ||
// "checkJs": true, /* Report errors in .js files. */ | ||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ | ||
// "declaration": true, /* Generates corresponding '.d.ts' file. */ | ||
"declaration": true, /* Generates corresponding '.d.ts' file. */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By using this option, the following files are generated under the
For example, import { DeckDefinition, DeckList } from "../types";
import { FormatType } from "./constants";
export declare function encode(deck: DeckDefinition): string;
export declare function decode(deckstring: string): DeckDefinition;
export { FormatType, DeckDefinition, DeckList }; https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html |
||
// "sourceMap": true, /* Generates corresponding '.map' file. */ | ||
// "outFile": "./", /* Concatenate and emit output to single file. */ | ||
// "outDir": "./", /* Redirect output structure to the directory. */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,14 @@ | |
# yarn lockfile v1 | ||
|
||
|
||
"@types/[email protected]": | ||
version "0.0.39" | ||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" | ||
|
||
"@types/node@*": | ||
version "11.9.5" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.9.5.tgz#011eece9d3f839a806b63973e228f85967b79ed3" | ||
|
||
"@types/node@^9.4.0": | ||
version "9.4.0" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.4.0.tgz#b85a0bcf1e1cc84eb4901b7e96966aedc6f078d1" | ||
|
@@ -846,10 +854,6 @@ commander@^2.9.0: | |
version "2.14.1" | ||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa" | ||
|
||
[email protected]: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-2.0.1.tgz#1edc1f93687fd97a325c59f55e45a07db106aca6" | ||
|
||
[email protected]: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/component-bind/-/component-bind-1.0.0.tgz#00c608ab7dcd93897c0009651b1d3a8e1e73bbd1" | ||
|
@@ -1258,6 +1262,10 @@ estree-walker@^0.5.0: | |
version "0.5.1" | ||
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.1.tgz#64fc375053abc6f57d73e9bd2f004644ad3c5854" | ||
|
||
estree-walker@^0.5.2: | ||
version "0.5.2" | ||
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39" | ||
|
||
esutils@^2.0.2: | ||
version "2.0.2" | ||
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" | ||
|
@@ -1467,6 +1475,14 @@ fs-access@^1.0.0: | |
dependencies: | ||
null-check "^1.0.0" | ||
|
||
[email protected]: | ||
version "7.0.1" | ||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" | ||
dependencies: | ||
graceful-fs "^4.1.2" | ||
jsonfile "^4.0.0" | ||
universalify "^0.1.0" | ||
|
||
fs.realpath@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" | ||
|
@@ -1593,6 +1609,10 @@ graceful-fs@^4.1.2: | |
version "4.1.11" | ||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" | ||
|
||
graceful-fs@^4.1.6: | ||
version "4.1.15" | ||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" | ||
|
||
[email protected]: | ||
version "1.10.3" | ||
resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" | ||
|
@@ -2143,6 +2163,12 @@ json5@^0.5.1: | |
version "0.5.1" | ||
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" | ||
|
||
jsonfile@^4.0.0: | ||
version "4.0.0" | ||
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" | ||
optionalDependencies: | ||
graceful-fs "^4.1.6" | ||
|
||
jsonify@~0.0.0: | ||
version "0.0.0" | ||
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" | ||
|
@@ -2668,7 +2694,7 @@ oauth-sign@~0.8.1, oauth-sign@~0.8.2: | |
version "0.8.2" | ||
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" | ||
|
||
object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: | ||
object-assign@^4.1.0, object-assign@^4.1.1: | ||
version "4.1.1" | ||
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" | ||
|
||
|
@@ -3218,6 +3244,12 @@ [email protected]: | |
version "1.1.7" | ||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" | ||
|
||
[email protected]: | ||
version "1.8.1" | ||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" | ||
dependencies: | ||
path-parse "^1.0.5" | ||
|
||
resolve@^1.1.3, resolve@^1.1.4, resolve@^1.1.6, resolve@^1.4.0: | ||
version "1.5.0" | ||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" | ||
|
@@ -3268,17 +3300,23 @@ rollup-plugin-node-resolve@^3.0.2: | |
is-module "^1.0.0" | ||
resolve "^1.1.6" | ||
|
||
rollup-plugin-typescript@^0.8.1: | ||
version "0.8.1" | ||
resolved "https://registry.yarnpkg.com/rollup-plugin-typescript/-/rollup-plugin-typescript-0.8.1.tgz#2ff7eecc21cf6bb2b43fc27e5b688952ce71924a" | ||
rollup-plugin-typescript2@^0.19.2: | ||
version "0.19.2" | ||
resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.19.2.tgz#87d9c799cd6e02efbedbba25af12753a1e92b6c2" | ||
dependencies: | ||
compare-versions "2.0.1" | ||
object-assign "^4.0.1" | ||
rollup-pluginutils "^1.3.1" | ||
tippex "^2.1.1" | ||
typescript "^1.8.9" | ||
fs-extra "7.0.1" | ||
resolve "1.8.1" | ||
rollup-pluginutils "2.3.3" | ||
tslib "1.9.3" | ||
|
||
[email protected]: | ||
version "2.3.3" | ||
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.3.3.tgz#3aad9b1eb3e7fe8262820818840bf091e5ae6794" | ||
dependencies: | ||
estree-walker "^0.5.2" | ||
micromatch "^2.3.11" | ||
|
||
rollup-pluginutils@^1.3.1, rollup-pluginutils@^1.5.0, rollup-pluginutils@^1.5.2: | ||
rollup-pluginutils@^1.5.0, rollup-pluginutils@^1.5.2: | ||
version "1.5.2" | ||
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408" | ||
dependencies: | ||
|
@@ -3292,9 +3330,12 @@ rollup-pluginutils@^2.0.1: | |
estree-walker "^0.3.0" | ||
micromatch "^2.3.11" | ||
|
||
rollup@^0.55.1: | ||
version "0.55.1" | ||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.55.1.tgz#baf4f23abe3014b29e56dea7d72d9946e56ac7dd" | ||
rollup@^0.68.2: | ||
version "0.68.2" | ||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.68.2.tgz#c26afb5d981ca7a1a32f76087dbde9dad4fcc653" | ||
dependencies: | ||
"@types/estree" "0.0.39" | ||
"@types/node" "*" | ||
|
||
safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: | ||
version "5.1.1" | ||
|
@@ -3697,10 +3738,6 @@ [email protected]: | |
version "2.3.0" | ||
resolved "https://registry.yarnpkg.com/timespan/-/timespan-2.3.0.tgz#4902ce040bd13d845c8f59b27e9d59bad6f39929" | ||
|
||
tippex@^2.1.1: | ||
version "2.3.1" | ||
resolved "https://registry.yarnpkg.com/tippex/-/tippex-2.3.1.tgz#a2fd5b7087d7cbfb20c9806a6c16108c2c0fafda" | ||
|
||
[email protected], [email protected]: | ||
version "0.0.33" | ||
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" | ||
|
@@ -3750,6 +3787,10 @@ trim-right@^1.0.1: | |
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" | ||
|
||
[email protected]: | ||
version "1.9.3" | ||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" | ||
|
||
tsscmp@~1.0.0: | ||
version "1.0.5" | ||
resolved "https://registry.yarnpkg.com/tsscmp/-/tsscmp-1.0.5.tgz#7dc4a33af71581ab4337da91d85ca5427ebd9a97" | ||
|
@@ -3793,10 +3834,6 @@ typedarray@~0.0.5: | |
version "0.0.6" | ||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" | ||
|
||
typescript@^1.8.9: | ||
version "1.8.10" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-1.8.10.tgz#b475d6e0dff0bf50f296e5ca6ef9fbb5c7320f1e" | ||
|
||
typescript@^2.7.1: | ||
version "2.7.1" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.1.tgz#bb3682c2c791ac90e7c6210b26478a8da085c359" | ||
|
@@ -3830,6 +3867,10 @@ union-value@^1.0.0: | |
is-extendable "^0.1.1" | ||
set-value "^0.4.3" | ||
|
||
universalify@^0.1.0: | ||
version "0.1.2" | ||
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" | ||
|
||
[email protected], unpipe@~1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to ignore the cache directory generated by rollup-plugin-typescript2.
https://github.com/ezolenko/rollup-plugin-typescript2#plugin-options