app-datepicker icon indicating copy to clipboard operation
app-datepicker copied to clipboard

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

Open userquin opened this issue 1 year ago • 2 comments

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):

  • lit v3.1.1 types: https://arethetypeswrong.github.io/?p=lit%403.1.1
  • lit v2.8.0 types: https://arethetypeswrong.github.io/?p=lit%402.8.0

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": "[email protected]" in the package.json

userquin avatar Jan 18 '24 15:01 userquin

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
@@             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 Coverage Δ
unit_tests 92.82% <88.92%> (-7.18%) :arrow_down:
unit_tests_helpers ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

codecov[bot] avatar Jan 18 '24 15:01 codecov[bot]

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

userquin avatar Jan 19 '24 10:01 userquin