diff --git a/.gitignore b/.gitignore index f846c68..6047073 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules package-lock.json yarn.lock +dist \ No newline at end of file diff --git a/package.json b/package.json index bd2c802..adb334b 100644 --- a/package.json +++ b/package.json @@ -6,19 +6,29 @@ "type": "git", "url": "https://github.com/storybookjs/testing-library.git" }, - "browser": "index.js", + "browser": "dist/index.js", + "main": "dist/index.js", "license": "MIT", + "scripts": { + "build": "tsc", + "prepublish": "npm run build" + }, "files": [ - "./index.js" + "dist/**/*" ], + "types": "dist/index.d.ts", "publishConfig": { "access": "public" }, "dependencies": { - "@storybook/client-logger": "6.4.0-alpha.35", - "@storybook/instrumenter": "6.4.0-alpha.35", + "@storybook/client-logger": "6.4.0-beta.9", + "@storybook/instrumenter": "6.4.0-beta.9", "@testing-library/dom": "^8.3.0", "@testing-library/user-event": "^13.2.1", "ts-dedent": "^2.2.0" + }, + "devDependencies": { + "tsc": "^2.0.3", + "typescript": "^4.4.3" } } diff --git a/index.js b/src/index.ts similarity index 96% rename from index.js rename to src/index.ts index a07f590..b6f0ced 100644 --- a/index.js +++ b/src/index.ts @@ -29,7 +29,6 @@ testingLibrary.screen = Object.entries(testingLibrary.screen).reduce( get() { once.warn(dedent` You are using Testing Library's \`screen\` object. Use \`within(canvasElement)\` instead. - More info: https://storybook.js.org/docs/react/essentials/interactions `); return val; @@ -38,7 +37,6 @@ testingLibrary.screen = Object.entries(testingLibrary.screen).reduce( testingLibrary.screen ); -// console.log(Object.keys(domTestingLibrary).join(',\n')); export const { buildQueries, configure, @@ -114,4 +112,4 @@ export const { prettyFormat, } = testingLibrary; -export const { userEvent } = instrument({ userEvent: _userEvent }, { intercept: true }); +export const { userEvent } = instrument({ userEvent: _userEvent }, { intercept: true }); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..1d6ed24 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "outDir": "./dist/", + "noImplicitAny": true, + "module": "es6", + "target": "es5", + "allowJs": true, + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "declaration": true + }, + "include": ["src/*.ts"], + "exclude": ["node_modules"] +}