motss / app-datepicker

Datepicker element built with Google's lit and Material Design 2021
https://npm.im/app-datepicker
MIT License
180 stars 51 forks source link

fix: move package to ESM-Only and fix package exports #223

Open userquin opened 10 months ago

userquin commented 10 months ago

I cannot build date-picker-input on my local, once the corresponding dts generated, the subpackage types should be fixed: dist/date-picker-input/date-picker-input.d.ts missing.

Lit is using ESM-Only, you can check latest and 2.8.0 versions (v2.8.0 being used in 6 rc33):

Check screenshot in this comment: https://github.com/motss/app-datepicker/issues/222#issuecomment-1898572994

pnpm build && pnpm pack, go to https://arethetypeswrong.github.io/ and upload the tgz file: refresh page between builds.

EDIT: I can also include "packageManager": "pnpm@8.14.1" in the package.json

codecov[bot] commented 10 months ago

Codecov Report

Attention: 31 lines in your changes are missing coverage. Please review.

Comparison is base (3582b2c) 100.00% compared to head (e504a68) 92.82%. Report is 8 commits behind head on main.

Files Patch % Lines
src/date-picker-input/date-picker-input.ts 82.50% 7 Missing and 7 partials :warning:
src/year-grid/year-grid.ts 57.14% 9 Missing and 3 partials :warning:
src/month-calendar/month-calendar.ts 90.00% 1 Missing and 3 partials :warning:
src/date-picker/date-picker.ts 98.78% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #223 +/- ## =========================================== - Coverage 100.00% 92.82% -7.18% =========================================== Files 58 58 Lines 3305 711 -2594 Branches 238 155 -83 =========================================== - Hits 3305 660 -2645 - Misses 0 32 +32 - Partials 0 19 +19 ``` | [Flag](https://app.codecov.io/gh/motss/app-datepicker/pull/223/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+web+walker) | Coverage Δ | | |---|---|---| | [unit_tests](https://app.codecov.io/gh/motss/app-datepicker/pull/223/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+web+walker) | `92.82% <88.92%> (-7.18%)` | :arrow_down: | | [unit_tests_helpers](https://app.codecov.io/gh/motss/app-datepicker/pull/223/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+web+walker) | `?` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+web+walker#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

userquin commented 10 months ago

You can use a bundler instead using tsc, for example you can use rollup, tsup or unbuild, this way you can write the build in the corresponding folders.

As an example, you can check lit (using rollup) package, the corresponding dts files in the root folder and subpackage exports with the corresponding folders (index.dts, decorators.d.ts, async-directive.d.ts, directives.d.ts... in root folder, decorators folder with the corresponding dts inside. This way when using Node/Node10, Node 16 or Bundler TS will not complain when resolving types:

imagen