gautamsi / keystone-ts

typescript version for keystone js
MIT License
4 stars 0 forks source link

Parity with keystonejs #1

Open webteckie opened 6 years ago

webteckie commented 6 years ago

Hey...does this have parity with the latest version of keystonejs? If not, how much is it lagging behind?

gautamsi commented 6 years ago

this is full port of keystone, including the latest 2 pull request merged. I have a branch keystone-compat which has 2 small commit with minimal changes to make it drop in replacement (after building).

currently, the javascript cache generation is disabled so that I could fix most issues with admin site.

I have tested this with keystone-generator and sydjs site (https://github.com/gautamsi/sydjs-ts), I have also fixed my sydjs-ts to use this codebase as keystone (fixing import statements), see latest commit https://github.com/gautamsi/sydjs-ts/commit/a24e66a4ab4f2b7336303f9af59406ac53bf6d07

if you are interested, you can help taking this forward, we may merge this in keystone when they are ready or rename this to something meaningful.

some ideas:

currently I a stuck on how to make List more like this

Let User = new List({options});
User.addField(new FieldType.Text('name'))
.addField(.....)
.addHeading(...)
.addField(...)

instead of how it is done here - https://github.com/gautamsi/sydjs-ts/blob/f8b0496632c3f039e853411724347b36aa6c4569/src/models/User.ts#L25

do you like this idea?

Build Instruction (for now)

tsc
npm run build-dev
npm run copy-static-assets

you can link this globally or install using file path, still using keystone name for now.

I have also fixed tests try running npm run test-admin and npm run test-unit, some tests failing, I am clueless on few of them.

webteckie commented 6 years ago

hmmm...interesting. have you transformed all to TS? I mean no just file renames but also added type checking for function parameters? yeah, if I was implementing the above List.Add() in .Net I would probably do what you're trying to do. it's probably the right thing to do with TS to also make use of its benefits like type checking. as is the problem with keystonejs that it's a bit complicated to contribute to, it probably makes sense to attempt to revisit the overall design and to try to simplify it to not only make it easier to understand and contribute to but also to make it more extensible and pluggable. but in the other hand this is a huge undertaking and likely to fail without plenty of support :-) but I believe that TS can simplify keystone a tone as well as make it easier to eliminate/detect obscure bugs. let me think about this :-)

gautamsi commented 6 years ago

its not just renames. Some type checking is done but not extensive, I was planning to make it in phases, public api goes first and then private one's 2nd. There I got stuck on how to fix the List.add, its quiet extensive and dynamic type checking needed, hopefully TS 2.7 may help with some of dynamic typing generation.

I did convert all of code to full TS Class where it was possible. There is some type checking added there.

I still have to convert some of the functions with correct parameters, some functions are declared without any parameter and tracked with arguments.length.

I am open to chat on this

webteckie commented 6 years ago

shoot me an email: webteckie at gmail dot com

ghost commented 6 years ago

How are you guys going with this project out of curiosity?

gautamsi commented 6 years ago

not doing much yet, it may pick up pace depending upon how keystone vNext is coming along.

ghost commented 6 years ago

Thanks. What is keystone vNext? Google didn't find anything