dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

Fix esm plugin typings and add test.

Open mshima opened this issue 4 years ago • 8 comments

Generated esm plugins are generated like plugin/duration/index.js, but import still points to import dayjs from '../index', but it should be import dayjs from '../../index'.

  • Fix imports.
  • Add tests.
  • Update babel to release.

mshima avatar Jun 21 '21 15:06 mshima

Codecov Report

Merging #1544 (05e1da4) into dev (c5688f3) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##               dev     #1544   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          176       177    +1     
  Lines         1980      1986    +6     
  Branches       502       503    +1     
=========================================
+ Hits          1980      1986    +6     
Impacted Files Coverage Δ
src/locale/sv-fi.js 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c5688f3...05e1da4. Read the comment docs.

codecov[bot] avatar Jun 26 '21 20:06 codecov[bot]

e.g. in file esm/locale/af.js,import dayjs from '../index' means to import root/esm/index.js, should correct don't we?

iamkun avatar Jun 28 '21 06:06 iamkun

e.g. in file esm/locale/af.js,import dayjs from '../index' means to import root/esm/index.js, should correct don't we?

Yes, it’s just changing plugin directories. I think locales folder should be ok.

mshima avatar Jun 28 '21 23:06 mshima

e.g. in file esm/locale/af.js,import dayjs from '../index' means to import root/esm/index.js, should correct don't we?

Yes, it’s just changing plugin directories. I think locales folder should be ok.

seems we don't have to change the path here?

iamkun avatar Jun 29 '21 07:06 iamkun

seems we don't have to change the path here?

Locale is ok, plug-ins generates a folder due to typings.

mshima avatar Jun 29 '21 10:06 mshima

seems we don't have to change the path here?

Locale is ok, plug-ins generates a folder due to typings.

Can you please detail it? Seems there's no plugin has the import statement import ../index.js

iamkun avatar Jun 29 '21 11:06 iamkun

Honestly I don’t know why Babel adds it. Look at esm/plugins/*/index.js.

Probably due to typings. https://github.com/iamkun/dayjs/blob/8e32164855cff724642e24c37a631eb4c4d760c8/types/plugin/duration.d.ts#L2 Changing that to dayjs may fix the problem too I will test.

mshima avatar Jun 29 '21 11:06 mshima

The error is just with duration plugin. Do you want me to drop the tests?

mshima avatar Jun 29 '21 21:06 mshima