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

cannot install on Windows #222

Open userquin opened 10 months ago

userquin commented 10 months ago

Description

Check issue title.

There are also some sh usages in this repo, you can use rimraf to remove files and folders.

Expected outcome

Dependencies should be installed

Actual outcome

node_modules/.pnpm/lit-ntml@3.0.6/node_modules/lit-ntml: Running postinstall script, failed in 17ms
.../lit-ntml@3.0.6/node_modules/lit-ntml postinstall$ bash postinstall.bash                        
│ "bash" no se reconoce como un comando interno o externo,
│ programa o archivo por lotes ejecutable.
└─ Failed in 17ms at D:\work\userquin\app-datepicker\node_modules\.pnpm\lit-ntml@3.0.6\node_modules\lit-ntml
 ELIFECYCLE  Command failed with exit code 1.

Live Demo

NA

Steps to reproduce

Run pnpm install on Windows OS

Browsers Affected

NA

userquin commented 10 months ago

I need to renamepostinstall scripts in .pnpm folder for lit-html and nodemod to xpostinstall

motss commented 10 months ago

@userquin Thanks for reporting this. The postinstall should not be run for published package as it is only required for local development. Let me look into it and raise a PR to fix that.

userquin commented 10 months ago

I run pnpm install --frozen-lockfile from root folder.

EDIT: you should add "packageManager": "pnpm@8.14.1" to your package.json

userquin commented 10 months ago

I'm going to fix package exports, this package should have package exports properly configured, it has some missing node10 types for some subpackages, check for example lit here https://arethetypeswrong.github.io/?p=lit%403.1.1

You can check this package here: https://arethetypeswrong.github.io/?p=app-datepicker%405.1.1 or latest 6 rc33 here https://arethetypeswrong.github.io/?p=app-datepicker%406.0.0-rc.33

motss commented 10 months ago

@userquin Thanks for raising this issue. IIUC node10 means node v10 which is a pretty old version of node. Not sure if that is still needed. Correct me if I'm wrong.

Feel free to raise a PR to fix the exports.

userquin commented 10 months ago

It is still being used, it it about compilerOptions.moduleResolution in tsconfig.json file (legacy):

"moduleResolution": "node", // or node10

imagen

userquin commented 10 months ago

Feel free to raise a PR to fix the exports.

I need to build the package and the tgz to check it, and it is failing when running pnpm tsc:

pnpm tsc output ```shell pnpm tsc error TS2688: Cannot find type definition file for 'vite/client'. The file is in the program because: Entry point of type library 'vite/client' specified in compilerOptions tsconfig.json:12:7 12 "vite/client" ~~~~~~~~~~~~~ File is entry point of type library specified here. src/date-picker-dialog/date-picker-dialog-base.ts:8:26 - error TS2742: The inferred type of 'styles' cannot be named without a reference to '.pnpm/lit@2.8.0/node _modules/lit'. This is likely not portable. A type annotation is necessary. 8 public static override styles = [ ~~~~~~ src/date-picker-input-surface/date-picker-input-surface.ts:16:26 - error TS2742: The inferred type of 'styles' cannot be named without a reference to '.pnpm/lit@ 2.8.0/node_modules/lit'. This is likely not portable. A type annotation is necessary. 16 public static override styles = [ ~~~~~~ src/date-picker-input/date-picker-input.ts:30:26 - error TS2742: The inferred type of 'styles' cannot be named without a reference to '.pnpm/lit@2.8.0/node_modul es/lit'. This is likely not portable. A type annotation is necessary. 30 public static override styles = [ ~~~~~~ src/year-grid-button/year-grid-button.ts:8:19 - error TS2742: The inferred type of 'styles' cannot be named without a reference to '.pnpm/lit@2.8.0/node_modules/ lit'. This is likely not portable. A type annotation is necessary. 8 static override styles = [ ~~~~~~ TSFILE: D:/work/userquin/app-datepicker/dist/icon-button/constants.js TSFILE: D:/work/userquin/app-datepicker/dist/icon-button/constants.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/icon-button/constants.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/icon-button/icon-button.js TSFILE: D:/work/userquin/app-datepicker/dist/icon-button/icon-button.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/icon-button/icon-button.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/icon-button/app-icon-button.js TSFILE: D:/work/userquin/app-datepicker/dist/icon-button/app-icon-button.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/icon-button/app-icon-button.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/constants.js TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/constants.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/constants.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/focus-element.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/focus-element.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/focus-element.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/is-in-current-month.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/is-in-current-month.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/is-in-current-month.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-closest-target.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-closest-target.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-closest-target.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-date-string.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-date-string.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-date-string.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/key-values.js TSFILE: D:/work/userquin/app-datepicker/dist/key-values.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/key-values.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-day-diff-inclusive.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-day-diff-inclusive.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-day-diff-inclusive.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-next-selectable-date.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-next-selectable-date.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-next-selectable-date.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-next-selected-date.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-next-selected-date.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-next-selected-date.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/mixins/element-mixin.js TSFILE: D:/work/userquin/app-datepicker/dist/mixins/element-mixin.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/mixins/element-mixin.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/root-element/root-element.js TSFILE: D:/work/userquin/app-datepicker/dist/root-element/root-element.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/root-element/root-element.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/stylings.js TSFILE: D:/work/userquin/app-datepicker/dist/stylings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/stylings.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/stylings.js TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/stylings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/stylings.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/typings.js TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/typings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/typings.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/month-calendar.js TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/month-calendar.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/month-calendar.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/app-month-calendar.js TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/app-month-calendar.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/month-calendar/app-month-calendar.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/constants.js TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/constants.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/constants.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-year-list.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-year-list.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-year-list.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/stylings.js TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/stylings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/stylings.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/clamp-value.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/clamp-value.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/clamp-value.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/typings.js TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/typings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/typings.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/to-next-selected-year.js TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/to-next-selected-year.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/to-next-selected-year.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/year-grid.js TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/year-grid.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/year-grid.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/app-year-grid.js TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/app-year-grid.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/year-grid/app-year-grid.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/date-validator.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/date-validator.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/date-validator.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/split-string.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/split-string.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/split-string.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-formatters.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-formatters.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-formatters.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/icons.js TSFILE: D:/work/userquin/app-datepicker/dist/icons.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/icons.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/nullish-attribute-converter.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/nullish-attribute-converter.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/nullish-attribute-converter.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/mixins/date-picker-min-max-mixin.js TSFILE: D:/work/userquin/app-datepicker/dist/mixins/date-picker-min-max-mixin.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/mixins/date-picker-min-max-mixin.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/mixins/date-picker-mixin.js TSFILE: D:/work/userquin/app-datepicker/dist/mixins/date-picker-mixin.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/mixins/date-picker-mixin.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/stylings.js TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/stylings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/stylings.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/typings.js TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/typings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/typings.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/date-picker.js TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/date-picker.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/date-picker.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/utility-typings.js TSFILE: D:/work/userquin/app-datepicker/dist/utility-typings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/utility-typings.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/typings.js TSFILE: D:/work/userquin/app-datepicker/dist/typings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/typings.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/mixins/typings.js TSFILE: D:/work/userquin/app-datepicker/dist/mixins/typings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/mixins/typings.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/typings.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/typings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/typings.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-resolved-date.js TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-resolved-date.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/helpers/to-resolved-date.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/constants.js TSFILE: D:/work/userquin/app-datepicker/dist/constants.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/constants.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/setup-test.js TSFILE: D:/work/userquin/app-datepicker/dist/setup-test.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/setup-test.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/constants.js TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/constants.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/constants.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/app-date-picker.js TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/app-date-picker.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/date-picker/app-date-picker.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/date-picker-input/constants.js TSFILE: D:/work/userquin/app-datepicker/dist/date-picker-input/constants.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/date-picker-input/constants.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/date-picker-input-surface/constants.js TSFILE: D:/work/userquin/app-datepicker/dist/date-picker-input-surface/constants.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/date-picker-input-surface/constants.d.ts.map TSFILE: D:/work/userquin/app-datepicker/dist/date-picker-input-surface/stylings.js TSFILE: D:/work/userquin/app-datepicker/dist/date-picker-input-surface/stylings.d.ts TSFILE: D:/work/userquin/app-datepicker/dist/date-picker-input-surface/stylings.d.ts.map Found 5 errors in 4 files. Errors Files 1 src/date-picker-dialog/date-picker-dialog-base.ts:8 1 src/date-picker-input-surface/date-picker-input-surface.ts:16 1 src/date-picker-input/date-picker-input.ts:30 1 src/year-grid-button/year-grid-button.ts:8 ```
motss commented 10 months ago

I don't remember seeing these errors. Let me check that later when I'm with my laptop.

userquin commented 10 months ago

We need to add a few entries to "typesVersions" and add some missing .js extension in some module, for example in src/date-picker-dialog/typings.ts L3 and fix app-datepicker/date-picker-input (dts not being generated)

imagen

imagen

motss commented 10 months ago

@userquin, I'm considering if it's beneficial to reference https://arethetypeswrong.github.io. It seems that the issues it uncovers aren't consistently the same, as it uses different TypeScript versions for validation. Yesterday it was 4.4.4 and today it's 5.3.3, if I'm not mistaken. Interestingly, I didn't find any errors in yesterday's check, but today's results vary. Additionally, I'm skeptical about the need for typesVersions since exports should be the definitive source for types exports (See here). Also, app-datepicker doesn't support older TypeScript versions, much like lit.

motss commented 10 months ago

@userquin, could you kindly share the version you attempted to install? From what I can see, it's only v5 that has the typing issues that are confusing TypeScript.

userquin commented 10 months ago

exports should be the definitive source for types exports

This is when using Node16 module resolution, if using "Node" or "Node10" the subpackages exports dts files should be present in the root directory of the package.

typesVersions has been used in the draft PR to avoid to copy those dts files (or create them in the root folder).

Check https://github.com/motss/app-datepicker/pull/223#issuecomment-1900101535

userquin commented 10 months ago

@userquin, could you kindly share the version you attempted to install? From what I can see, it's only v5 that has the typing issues that are confusing TypeScript.

I'm using main branch

motss commented 10 months ago

I did some checking on https://arethetypeswrong.github.io/?p=app-datepicker%406.0.0-rc.33 again not long while ago.

arethetypeswrong github io__p=app-datepicker%406 0 0-rc 33

By referring to the above screenshot, you can see that it is clearly different from the screenshot in https://github.com/motss/app-datepicker/issues/222#issuecomment-1898572994. You can see that some do not have typing issues while some do have internal resolution error which seems like an internal issue happening under the hood which might or might not related to my exports in package.json.

I'm particularly curious to find out more on why not all having the exact same issue because the trace shows that the dts file can be resolved correctly but it ended up with some internal resolution error which does not make sense to me and the tool does not show any other helpful error message for us to understand more.

I haven't tried running npm pack then upload to verify the package. Will do it later to find out more.

userquin commented 10 months ago

By referring to the above screenshot, you can see that it is clearly different from the screenshot in https://github.com/motss/app-datepicker/issues/222#issuecomment-1898572994. You can see that some do not have typing issues while some do have internal resolution error which seems like an internal issue happening under the hood which might or might not related to my exports in package.json.

It is the same result with proper types when using "node/node10" (missing types in app-datepicker/date-picker-input subpackage in 222 is only because the dts not being generated in my local).

You can create a simple lit-ts app with app-datepicker in StackBlitz changing tsconfig file to use node instead bundler importing some subpackage.

The problem is about subpackages exports when using "node" module resolution, app-datepicker is fine.

I'm particularly curious to find out more on why not all having the exact same issue because the trace shows that the dts file can be resolved correctly but it ended up with some internal resolution error which does not make sense to me and the tool does not show any other helpful error message for us to understand more.

Missing .js extensions in static imports in some typings.ts modules, check files changed in the draft PR.