-
-
Notifications
You must be signed in to change notification settings - Fork 106
feat: generate type declarations #389
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
Conversation
.gitignore
Outdated
@@ -29,8 +29,7 @@ yarn-error.log* | |||
node_modules/ | |||
bower_components/ | |||
|
|||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | |||
.grunt | |||
dist/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really a good idea? I have to check locally first...
I'm also doing more tests about this. Not about adding dist folder to gitignore, but about the way types are exported to be used from other modules. I think the standard way will be not the one used here, but adding a index.ts class that re-export all types like
and set this as the "typings": "dist/src/index.d.ts" entrypoint for the package. This will allow to use import each class as
But of course all this need to be tested in the different kinds of project to check it works correctly for all. |
1bee24e
to
2f1a05a
Compare
As said in the previous comment I have changed the way types are exported. In practical terms this means that to import some class instead of having to define each class path in the library as
now all classes can be imported from @materializecss/materialize as
For projects that are using typescript and importing types this is a big difference: without this change, using materialize from a typescript project is NOT complete. As a side note I need also those changes to use materialize as a monorepo. I think "monorepo" is a very interesting option to work MUCH faster of materialize, as you don't need to deploy nothing, you change the compo and you see the change immediately. |
Sure, that sounds nice! We can discuss everything here. The only thing why i did not merge your change was because you added the dist folder into the gitignore. This will cause errors during the release process. |
Ok, I see, sorry for the confusion... Adding dist to gitignore seems normal, following the common practice of not including build generated files in the source control. One solution could be just adding "dist/src" to .gitignore. But maybe we will face the same problem in the package distribution files. Maybe this is the solution for this issue. I would prepare an update:
What do you think? |
2f1a05a
to
1bdf4a0
Compare
As commented I have changed gitignore to "dist/src" and added a .npmignore file exactly like gitignore but including all dist. |
What is the first commit? It contains Styles and I like it, but why is it in this PR? |
Can you make the style changes and the Type-Changes in seperate PRs? |
1bdf4a0
to
634da81
Compare
Sorry, this was unintended... I have updated the PR including only the type declarations commit. |
Haha ok thats fine. Also I talked recently with the old team members and one of them told me it would be a good idea to start as a new repo to avoid distraction from the old materializecss. That would also give the possibility to clean many things up or remove (maybe grunt). Also i would suggest to give you @danice and @mauromascarenhas more rights, in order to check in PRs faster. What do you or others think about this? Oh sorry not old team member. I ment inactive from this team here. |
Created PR for M3 styles. About the new repo question, please have a look to the "Modern development environment using a vite monorepo with materialize as a package" discussion. I would suggest removing from the materialize repo all the website stuff, and creating a separated repo for the website that would include materialize repo as a "monorepo" package and also as git submodule (see the linked project as an example of how it will look). This "monorepo" is a very practical development environment, but of course it requires to be familiar with git submodules. My experience is that for this is better to use (at least a as complement) some git client like git extensions as - at least for me- Visual Studio is not very friendly with submodules. |
Yes, that sounds good! The only concerns i have: Does handlebars also work serverside to pre-compile all the pages? I will make a new Repo in the next days and then we can continue splitting the project step by step. |
Yes, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, is it ready for merging?
I have done some fixes for ts type errors and to maintain M import as default ("import M from ...", without { M } ) to keep backward compatibility. |
That are some serious pro-moves dude! Haha awesome, I'll merge it. |
Proposed changes
Generate typescript .d.ts type files. This allows vs code intellisense.
Screenshots (if appropriate) or codepen:
Types of changes
Checklist: