Cannot find module 'feathers-chat' or its corresponding type declarations.
lukvermeulen opened this issue · 5 comments
Steps to reproduce
- Pull repo
- Go into
./typescript-api
and runnpm install
- Go into
./react-chat
and runnpm install
- Running
npm start
for the react app throws the error from the title
I might be overlooking something stupid here, however also trying to add project references does not really make the compiler happy.
This indeed needs to be documented a bit better. It should work after you run npm run compile
in the typescript-api
folder.
Run compile should probably be a postinstall script at the root of the client. I just gave up.
Side note, what happened to the Javascript feathers-chat app?
Feathers-chat-ts is missing from that list, that can convert itself to a vanilla Javascript app with one command. Why is it missing from the list? Is the list sorted in most recommended to least recommended? Its not alphabetical or by GH stars/Npm downloads popularity.
How to convert TS and keep comments
I managed to get passed about 6 hurdles, but I'm stuck setting up the database... I haven't used SQL in 4 years and SQLite in over 10. SQL should not be required knowledge to learn FeathersJs.
Here's as far as I got:
https://replit.com/@fossprime/feathers-chat
It's a beta but I should not be struggling.
Compare that with the one click:
View: Sandbox with Feathers guestbook example app
As for SQL, you can choose MongoDB in the guide. @marshallswain and I have been debating of also having mongodb-memory-server as an option. If you are using the Replit setup, I think the problem might be the file system access that it needs (and the npm run migrate
command that needs to be executed before startup).
As for the repos, the plan is to consolidate them all (including a React and Vue example frontend) into this repository as a monorepo. The JavaScript chat is in https://github.com/feathersjs/feathers-chat/tree/dove/typescript-api/public (I'm thinking of renaming typescript-api
to just typescript
but that doesn't really indicate the frontend is in there either 🤔
Having javascript client be at top level makes most sense, and is easy to do by changing the feathers config to point serveStatic to ../javascript
.
The lack of npm run migrate
is plausible, as they might use pnpm, nx or turborepo.
I don't think mongodb-memory would be as helpful as NeDB was or LowDB could be. For learning, prototyping and rapid debugging looking at the real data without learning/installing more tools is important.
The SQL in feathers-chat isn't being used in a way that makes a difference, aside from proactively hydrating messages. But that's necessary to demonstrate resolvers, even if in a good NoSQL schema, that would not be necessary/best practice.
In vite-chat I moved the server to /api, which makes it easier to have a monorepo with a client in source, like vue/react use. The JavaScript client is in TypeScript, for the faint of heart, we can always include a command to transpile with --removeComments false
.
sidenote:
NeDB is too IO heavy for the project directory of most sandboxes, but lowDB in my experience is gentle enough. We can save to /tmp but that reduces discover ability.
unrelated marketing copy we could borrow:
mongodb-memory-server seems like a somewhat better choice than knex+sqlite3 solely because it doesn't depend on node-gyp and 14+ other dependencies. Each one of those cause issues with compatibility, vulnerabilities, warnings, peer dependency conflicts and more problems that are an unnecessary hurdle for this example project.
My vote for the Example/MVP database:
- LowDB
- @seald/NeDB
- mongodb-memory-server
- sql.js
- others
I would be willing to put in work for updating the adapter to LowDB@3, which is much faster and has a better API, but is so drastically different than version 1, that uptake is still waay behind version 1.
This should now be working using the new client package. #235 has a React chat example that uses it.