Skip to content
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

Add TypeScript definitions. #269

Merged
merged 1 commit into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist-*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep – this is precautionary. When a user runs yarn dev it'll generate the bundle.js file for the built fixture (whichever one they use). Rather than relying on a user to delete that file in order to pass local linting scripts, I figured we'd just tell ESLint to ignore these files altogether. Does that make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
!README.md
!package.json
!index.js
!index.d.ts
24 changes: 24 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Type definitions for webpack-dashboard 2.x.x
// Project: https://github.com/FormidableLabs/webpack-dashboard
// Definitions by: Parker Ziegler <https://github.com/parkerziegler>
// TypeScript Version: 3.2

declare module 'webpack-dashboard/plugin' {
interface IMessage {
type: string;
value: string | number | { [key: string]: any }
error?: boolean;
}

interface IDashboardOptions {
port?: number;
host?: string;
handler?: (dataArray: IMessage[]) => void;
}

class DashboardPlugin {
constructor(options?: IDashboardOptions);
}

export = DashboardPlugin;
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"engines": {
"node": ">=6.0.0"
},
"types": "index.d.ts",
"scripts": {
"test": "mocha 'test/**/*.spec.js'",
"test-cov": "nyc mocha 'test/**/*.spec.js'",
"lint": "eslint .",
"check": "npm run lint && npm run test",
"check-ci": "npm run lint && npm run test-cov",
"check": "npm run lint && npm run test && npm run check-ts",
"check-ci": "npm run lint && npm run test-cov && npm run check-ts",
"check-ts": "tsc index.d.ts --noEmit",
"dev": "cross-env EXAMPLE=duplicates-esm node bin/webpack-dashboard.js -- webpack-cli --config examples/config/webpack.config.js --watch"
},
"repository": {
Expand Down Expand Up @@ -58,6 +60,7 @@
"nyc": "^11.8.0",
"sinon": "^5.0.7",
"sinon-chai": "^3.0.0",
"typescript": "^3.2.4",
"webpack": "^4.8.3",
"webpack-cli": "^2.1.3",
"webpack-stats-plugin": "^0.2.1"
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6163,6 +6163,11 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@^3.2.4:
version "3.2.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.4.tgz#c585cb952912263d915b462726ce244ba510ef3d"
integrity sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg==

uglify-es@^3.3.4:
version "3.3.9"
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677"
Expand Down