diff --git a/.circleci/config.yml b/.circleci/config.yml index e140409c4..1e22885ff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -57,6 +57,7 @@ jobs: command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - run: git config --global user.email circleci@circleci - run: git config --global user.name CircleCI + - run: npm run build:types - run: name: Publish package command: "./node_modules/.bin/lerna publish --message 'chore: release new versions' --exact --yes" diff --git a/.gitignore b/.gitignore index 1df5c5078..c0ec93709 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,10 @@ yarn-error.log /build/ /bundlesize/dist/ +## types +*.d.ts +!packages/*/types/* + ## temp folders /.tmp/ /coverage/ diff --git a/package.json b/package.json index 4f19dcd20..3ee31dc1a 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "packages/*" ], "scripts": { + "build:docs": "wca analyze \"packages/tabs/**/*.js\"", + "build:types": "tsc -p tsconfig.build.types.json", "bundlesize": "rollup -c bundlesize/rollup.config.js && bundlesize", "dev-server": "es-dev-server", "format": "npm run format:eslint && npm run format:prettier", @@ -16,6 +18,7 @@ "lint:eslint": "eslint --ext .js,.html .", "lint:markdownlint": "git ls-files '*.md' | xargs markdownlint --ignore '**/CHANGELOG.md'", "lint:prettier": "prettier \"**/*.js\" --list-different || (echo '↑↑ these files are not prettier formatted ↑↑' && exit 1)", + "lint:types": "tsc", "lint:versions": "node ./scripts/lint-versions.js", "start": "npm run storybook", "storybook": "start-storybook -p 9001", @@ -33,10 +36,11 @@ "@open-wc/building-rollup": "^1.2.1", "@open-wc/demoing-storybook": "^2.0.2", "@open-wc/eslint-config": "^1.0.0", - "@open-wc/testing": "^2.5.0", + "@open-wc/testing": "^2.5.18", "@open-wc/testing-helpers": "^1.0.0", "@storybook/addon-a11y": "~5.0.0", "@web/test-runner": "^0.6.18", + "@types/chai-dom": "^0.0.8", "@webcomponents/webcomponentsjs": "^2.2.5", "babel-eslint": "^8.2.6", "babel-polyfill": "^6.26.0", @@ -56,6 +60,8 @@ "rimraf": "^2.6.3", "rollup": "^2.0.0", "sinon": "^7.2.2", + "typescript": "^3.8.3", + "web-component-analyzer": "^1.0.3", "webpack-merge": "^4.1.5", "whatwg-fetch": "^3.0.0" }, diff --git a/tsconfig.build.types.json b/tsconfig.build.types.json new file mode 100644 index 000000000..eb0daa6a4 --- /dev/null +++ b/tsconfig.build.types.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "emitDeclarationOnly": true, + "noEmit": false + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..02514af21 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "lib": ["es2017", "dom"], + "allowJs": true, + "checkJs": true, + "noEmit": true, + "strict": true, + "noImplicitThis": true, + "alwaysStrict": true, + "types": ["node", "mocha"], + "esModuleInterop": true + }, + "include": ["packages/core/**/*.js", "packages/tabs/**/*.js"], + "exclude": [ + "node_modules", + "**/node_modules/*", + "**/coverage/*", + "**/dist/**/*", + "packages/**/test-helpers" + ] +} diff --git a/yarn.lock b/yarn.lock index 496fcb7a9..869c7b1d3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2413,11 +2413,16 @@ "@open-wc/semantic-dom-diff" "^0.13.16" "@types/chai" "^4.1.7" -"@open-wc/dedupe-mixin@^1.2.1", "@open-wc/dedupe-mixin@^1.2.17": +"@open-wc/dedupe-mixin@^1.2.17": version "1.2.17" resolved "https://registry.yarnpkg.com/@open-wc/dedupe-mixin/-/dedupe-mixin-1.2.17.tgz#50fb903fc8785639487d7987caae45d7bba08ec7" integrity sha512-9A3WohqNxEloJa4y1DuBL5zH12cNRNW1vsrkiaLMnOGuQdhibs2XY1oliudsKpvIeNjDXRVRPUdIIzn65BypCw== +"@open-wc/dedupe-mixin@^1.2.18": + version "1.2.18" + resolved "https://registry.yarnpkg.com/@open-wc/dedupe-mixin/-/dedupe-mixin-1.2.18.tgz#2a86672fb3558fe2a2e1c5587dbaa0b485567ef1" + integrity sha512-1HpblP5edeENi0SKms7B+PKYdxHMBIQpaf0nAgTVsZeYgM9OJ3r9nrK/0MOUBZODAOZ1quvO3wlpuljq2hZPWA== + "@open-wc/demoing-storybook@^2.0.2": version "2.3.11" resolved "https://registry.yarnpkg.com/@open-wc/demoing-storybook/-/demoing-storybook-2.3.11.tgz#4c4887760591c6e58fb25852c92f0357c3445246" @@ -2516,7 +2521,7 @@ lit-element "^2.2.1" lit-html "^1.0.0" -"@open-wc/testing@^2.5.0": +"@open-wc/testing@^2.5.18": version "2.5.18" resolved "https://registry.yarnpkg.com/@open-wc/testing/-/testing-2.5.18.tgz#b05215535a22515fbd98183eface1c33fd804a5d" integrity sha512-poFIaGEsHseNEbAE/pGjzZGbSksxqsL4CRr+MSPUEotzhbVa3BzA3JzPHfn3FD1zVGlBcNEU0kFa0jj/Goc52w== @@ -2807,6 +2812,13 @@ resolved "https://registry.yarnpkg.com/@types/caniuse-api/-/caniuse-api-3.0.0.tgz#af31cc52062be0ab24583be072fd49b634dcc2fe" integrity sha512-wT1VfnScjAftZsvLYaefu/UuwYJdYBwD2JDL2OQd01plGmuAoir5V6HnVHgrfh7zEwcasoiyO2wQ+W58sNh2sw== +"@types/chai-dom@^0.0.8": + version "0.0.8" + resolved "https://registry.yarnpkg.com/@types/chai-dom/-/chai-dom-0.0.8.tgz#832b68d78390c80030e64d8fd4990e514484e91d" + integrity sha512-F5vAuz2hp7VY+0UmkFLgTwyeHDddIw1c/JbAQZp2lgpZOd3ujlHFijWO4sHdo7sun9HrzwnSJlZfINdKrUwI+w== + dependencies: + "@types/chai" "*" + "@types/chai-dom@^0.0.9": version "0.0.9" resolved "https://registry.yarnpkg.com/@types/chai-dom/-/chai-dom-0.0.9.tgz#77379354efec2568284ca355fff6a4f85f5a66f4" @@ -6438,6 +6450,18 @@ fast-glob@^2.2.6: merge2 "^1.2.3" micromatch "^3.1.10" +fast-glob@^3.1.0: + version "3.2.4" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.4.tgz#d20aefbf99579383e7f3cc66529158c9b98554d3" + integrity sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.0" + merge2 "^1.3.0" + micromatch "^4.0.2" + picomatch "^2.2.1" + fast-glob@^3.1.1: version "3.2.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.2.tgz#ade1a9d91148965d4bf7c51f72e1ca662d32e63d" @@ -13026,6 +13050,11 @@ try-to-catch@^1.0.2: resolved "https://registry.yarnpkg.com/try-to-catch/-/try-to-catch-1.1.1.tgz#770162dd13b9a0e55da04db5b7f888956072038a" integrity sha512-ikUlS+/BcImLhNYyIgZcEmq4byc31QpC+46/6Jm5ECWkVFhf8SM2Fp/0pMVXPX6vk45SMCwrP4Taxucne8I0VA== +ts-simple-type@~0.3.6: + version "0.3.7" + resolved "https://registry.yarnpkg.com/ts-simple-type/-/ts-simple-type-0.3.7.tgz#1e77222c3d90d7093f80a954e74c725fd99c911c" + integrity sha512-bDXWURwpDpe1mA5E9eldmI0Mpt9zGprhtN/ZTLOJjsAMyeMy1UT7WvGRQghYewIYBYxDZurChhe4DrsPbcCVrA== + tsconfig-paths@^3.9.0: version "3.9.0" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" @@ -13127,10 +13156,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.6.4: - version "3.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" - integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== +typescript@^3.5.3, typescript@^3.8.3: + version "3.9.6" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.6.tgz#8f3e0198a34c3ae17091b35571d3afd31999365a" + integrity sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw== typical@^4.0.0: version "4.0.0" @@ -13629,6 +13658,16 @@ wcwidth@^1.0.0, wcwidth@^1.0.1: dependencies: defaults "^1.0.3" +web-component-analyzer@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/web-component-analyzer/-/web-component-analyzer-1.0.3.tgz#da73dff15d6a8f4864311664476f0f436274e97d" + integrity sha512-QA6GVVJrKRPHLVqPv4evY0H+du1yY+E1q8c82bdY5e10+pWsRfeYA+Hsh2r8yl1EGQVC55SeV3tGvJ6+CxaH/Q== + dependencies: + fast-glob "^3.1.0" + ts-simple-type "~0.3.6" + typescript "^3.5.3" + yargs "^15.0.2" + web-namespaces@^1.0.0, web-namespaces@^1.1.2: version "1.1.4" resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-1.1.4.tgz#bc98a3de60dadd7faefc403d1076d529f5e030ec"