Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

state build script fails on Windows #1

Closed
MichaPau opened this issue Jul 11, 2022 · 4 comments
Closed

state build script fails on Windows #1

MichaPau opened this issue Jul 11, 2022 · 4 comments

Comments

@MichaPau
Copy link

This is due the UNIX bash style copy-to-public script.

Workaround:

  • use WSL on windows
  • or add a windows style copy-to-public script

e.g.

"copy-to-public:win": "powershell copy .\\package.json .\\public\\package -Force && powershell copy .\\README.md .\\public\\README.md -Force && powershell mkdir .\\public\\docs -Force && powershell copy .\\docs\\* .\\public\\docs -Force -Recurse",
"analyze:win": "npm run analyze-md && npm run analyze-json && npm run copy-to-public:win",
"build:win": "npm run ts && npm run analyze:win && npm run copy-to-public:win ",

This works with my npm and default-shell settings.

@christophe-g
Copy link
Contributor

Merci beaucoup - was not expecting an issue to be reported that soon !

The copy to public script might go away altogether.

@MichaPau
Copy link
Author

MichaPau commented Jul 11, 2022

I am just eager to try it out.
But it may be too early..

I manged to add it to a project with .yalc (I had to change "main": "src/index" to "main": "dist/index.js" inside package.json).
It finds all the exports/classes

but I get an error in the browser:

Uncaught TypeError: import_meta.env is undefined
    <anonymous> storage.ts:13

I tried it in a vite lit-ts default template project. (just added a store and a StateController as described in your example element)
I might just have to configure my project in the right way but I am not a crack with npm or vite ...

Also, when I import property from "@lit-app/state" I cannot use property from "lit/decorators.js" anymore.... (Duplicate identifier 'property')
Will there be a way to mix 'lit reactive properties' with 'state reactive properties' in the future ?
Because an element might use a store but still have 'common lit' properties like attributes to render...

Edit: I guess I just have to move the state class in a new file to avoid the duplicate identifier...

all the best

@christophe-g
Copy link
Contributor

christophe-g commented Jul 11, 2022

It is soon, but it should work nevertheless.

but I get an error in the browser

Just pushed a new commit to get rid of this situation.

I cannot use property from "lit/decorators.js" anymore
guess I just have to move the state class in a new file to avoid the duplicate identifier

Indeed, state declaration should be in different files ideally.

Even if they are not, you can always rename your imports:

import {property as litprop} from 'lit/decorators.js'

@christophe-g
Copy link
Contributor

Closed by public release of this package (pnpm add @lit-app/state).

@MichaPau - tell me if it is not working for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants