-
Notifications
You must be signed in to change notification settings - Fork 110
Feature angular #426
base: develop
Are you sure you want to change the base?
Feature angular #426
Conversation
Included: 1. au-color-palette directive 2. au-outline directive
1. Changed au-color-palette to be a directive. 2. Managed to get a working test page from core project. 3. Added an option to dynamically change the color palette
* Fixed lerna bootstrap build by adding ignore to ngx project * Changed karma config to use single test runs
Changed Angular project namespace to ngx
package.json
Outdated
"scaffolding": "node ./scripts/helper.js scaffolding", | ||
"bootstrap": "lerna bootstrap", | ||
"bootstrap": "lerna bootstrap --loglevel verbose", |
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.
I think this might be an oversight? Meaning is is probably not meant for everyone to get a verbose output and was probably not meant to make it into this PR. Good for debugging, bad for performance and day-to-day use :)
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.
yeap... my bad. I think it was from right at the beginning when I was trying to understand how lerna works
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.
Hi @shakilsiraj
Thank you for your PR. This looks like a lot of work. thank you for that. I don't think the DS team have the capacity to maintain yet another framework besides vanilla, react and jquery. I let them speak to that though.
Here just some feedback on my initial review:
- The way we have used this mono repo is by adding each entry point for each framework to each component rather than creating new ones. That way we can reuse css etc. The way you added this in one monolithic chuck breaks this unfortunately
- Introducing several new ways of building this is probably not the best strategy if you do that only in one single component. If we want to move to karma/jasmine we should do that everywhere not in one component and end up with several testing frameworks that all do the same. I for one would suggest staying with Jest and adding cypress for e2e tests to cover everything.
- typescript, while awesome and amazing, is also something we should have a discussion about. I like typed languages but should probably pick one that does not diverge from the standard so we're not locked into an ecosystem (typescript has a commenting syntax that would help here)
- Most of the changes in the helper are white-space changes. Best to avoid those :)
- Also in general a PR with 83 files changed is probably a bit much to be merged unless clearly communicated before hand with the team. I do however totally appreciate the effort you put into this.
I let the team pick up the rest here but my personal suggestion here would be to sketch out a more aligned approach to add angular as a framework starting with the discussion how much work that adds to the design system overall. We can talk about how we might use the existing pathways to add it to each packages from there. I'm sure if that goes well we can reuse some of the work you have here.
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space |
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.
To have a conflicting editor config is probably the wrong thing to do here... Maybe we can just add prettier?
|
||
## Release History | ||
|
||
* v0.4.0 - added directives |
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.
why the jump by 4 minor versions?
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.
That was after adding few directives in the same checkin ..
@@ -0,0 +1,34 @@ | |||
// Karma configuration file, see link for more information | |||
// https://karma-runner.github.io/1.0/config/configuration-file.html |
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.
Can we stay with jest rather than adding yet another test framework?
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.
That's default test framework with Angular CLI .. nothing I can do about there ..
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.
Angular leaves you no choice in test framework? I was not aware. That'll cause some friction later :(
packages/ngx/package.json
Outdated
"design guide", | ||
"design system", | ||
"Angular", | ||
"Angular Component Development Kit", |
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.
mix of tabs and spaces?
@@ -0,0 +1,12 @@ | |||
/*! PANCAKE v1.2.0 PANCAKE-SASS v1.3.0 */ |
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.
pancake files and folder are artifacts of the script and need to be ignored
@@ -0,0 +1,14 @@ | |||
import { Component, ContentChildren, OnInit, QueryList } from "@angular/core"; | |||
import { CdkAccordion } from "@angular/cdk/accordion"; | |||
// import { AuAccordionItemBase } from "./au-accordion-item"; |
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.
#clean-me-up
exportAs: "auAccordionGroup" | ||
}) | ||
export class AuAccordionGroup extends CdkAccordion implements OnInit { | ||
// @ContentChildren(AuAccordionItemBase) contentChildren: QueryList<AuAccordionItemBase>; |
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.
#clean-me-up
|
||
<h1>JQuery test: ngx</h1> | ||
|
||
code here |
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.
since this is a angular only package it probably doesn't need jquery entry files?
scripts/helper.js
Outdated
if( pkg.pancake['pancake-module'].react ) { | ||
react = `<a class="link" href="packages/${ module }/tests/react/">react</a>`; | ||
const pkg = require(Path.normalize(`${__dirname}/../packages/${module}/package.json`)); | ||
if (pkg.name.indexOf('ngx') === -1) { |
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.
I'm not convinced name spacing is the best way to id packages... We have used config options in each package.json file before.
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.
Yeah .. that one .. I had to find a way not to make an Angular library look like a React library. That was a quick and dirty solution :).
"@gov.au/body": "^2.0.0", | ||
"@gov.au/link-list": "^2.0.0" | ||
}, | ||
"peerDependencies": {}, |
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.
dependencies have to be mirrored inside peerDependencies for pancake to work
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.
@dominikwilkowski on your points ..
The way we have used this mono repo is by adding each entry point for each framework to each component rather than creating new ones. That way we can reuse css etc. The way you added this in one monolithic chuck breaks this unfortunately
-
I thought about doing the same but it would have doubled up on the packages for little benefit. Let's not even mention that there will be an angular cli build project in each of the libraries. So I have taken angular material approach - one project with multiple exportable library packages. Have a look at https://github.com/angular/material2.
-
This library does does not create alternative CSS for the other libraries, rather it requires those CSS files to be included manually (https://github.com/shakilsiraj/uikit/blob/feature-angular/packages/ngx/src/sass/_module.scss) into Angular projects that use this library. So, I don't think it's an issue.
Introducing several new ways of building this is probably not the best strategy if you do that only in one single component. If we want to move to karma/jasmine we should do that everywhere not in one component and end up with several testing frameworks that all do the same. I for one would suggest staying with Jest and adding cypress for e2e tests to cover everything.
- If you are going to support Angular cli based projects then there is no other way but to go with Karma/Jasmine. A single project with this exception(not using Jest and use the appropriate libraries that are required) will keep it under control. Jest is a good framework no doubt but it's an added library that you will need to support on top of what Angular is providing. In Angular world, you can try to not use Karma/Jasmin, but you will be doing extra work and will need to maintain that work for yourself.
typescript, while awesome and amazing, is also something we should have a discussion about. I like typed languages but should probably pick one that does not diverge from the standard so we're not locked into an ecosystem (typescript has a commenting syntax that would help here)
- Angular does not support vanilla JS (directives, enums, proper OOP, etc. are missing there). So, there is not alternative.
Also in general a PR with 83 files changed is probably a bit much to be merged unless clearly communicated before hand with the team. I do however totally appreciate the effort you put into this.
- Thanks for that and sorry for not communicating before hand. Most of those files in this PR would be standard from angular CLI when you start a project. The bit that you should be focusing on is https://github.com/shakilsiraj/uikit/tree/feature-angular/packages/ngx/src/app/modules. Next PRs from anyone should be small.
Happy to discuss.
Thanks for the PR @shakilsiraj, we really appreciate all the work that's gone into this! And thanks for the review @dominikwilkowski :) Our lead developer is back from holiday in a couple days and we'll have a more detailed look at the code then. This will be a great opportunity to discuss how we might support another JS framework in the design system. I know there are a few agencies that are currently using Angular so this is a good conversation to have. |
Hey @alex-page, thanks for your comment. I had a close look at the other tools (furnace, pancake) that you have been talking about and now I understand how they hang together. Some cool stuff you guys have there :). Unfortunately, with this setup, I can't see how you can integrate Angular without bloating the existing packages. Angular is a beast by itself and requires an entire CLI project to be created just for a small library. If I go with the Angular pancake module, I will need to create a separate CLI project like the ngx one in each of the modules. That will slow down installation and build speed significantly especially for those who are not working with Angular. A better alternative perhaps is to start fresh with a separate Angular project and pull in the required UIKIT projects via npm dependencies. That would be cleaner and easy to maintain. This can be hosted on a separate repo on its own. I'm sure there are enough people to support the project. Happy to discuss. |
Thanks for the positive vibes and understanding @shakilsiraj definitely keen to talk more about this. Feel free to send an email to [email protected] and we can organise a meeting in person or on the phone! I'm about to head off for the day, so i'll try give you a better reply about the approach for angular components on Monday 👍 |
@shakilsiraj Ok I have some time to reply now. Again this pull request is awesome and really appreciate all of your hard work.
So this shouldn't be as big of an issue as you think. We have ways to enable and disable the build pipelines in pancake. This means that a user who wants angular would be able to get angular components in a folder. Users who do not want angular will not be affected. The components themselves and the libraries that make them work are actually separated. When we deliver a react component we deliver pure component code but no library to make it work. When a user downloads a component and wants to use the react pipeline in pancake, they would literally only get the component file ( I'll see if I can do a similar thing with a simple angular component and share it back to you and see what you think. One thing we do is create a test page for each component. This would require angular to be added as a developer dependency. This would not be included as a dependency when installing the components.
I think this is a valid solution, however I would love angular to be in this library and supported by the community. Splitting the projects for now may mean that you can work faster and are not blocked by us. If you do choose to go down this path I would love to one day soon sit down and discuss your approach and learnings and see how/if we can merge the two together. |
Hey @alex-page, I did send you an email with my contact number to [email protected]. Just wondering if you have received it or not? Love to have a chat. Thanks. |
@shakilsiraj received cheers 👍 |
Hey @shakilsiraj thanks for the chat today. For everyone else's benefit here are somethings that came out of it. We need the components to work with whatever bundler the user is using. This means it should work with For our test pages we will need to use a build pipeline to actually render the angular component to the page, something like Things we and @shakilsiraj will try and do this sprint:
|
Hi guys, It was nice chatting with you yesterday. I think I have a good idea now in terms of bundling Angular components with rollup and test with jest. But I would like to get clarification re the build process that will generate the angular package to be consumed by apps. When I looked into @gov.au/accordian, I can see that the main entry in package.json points to 'lib/js/react.es5.js' even though the actual lib directory has the JQuery version. I guess for JQuery, you can just refer this file from html script tag, but it will be better to point to the angular lib file so the compiler can do a proper AOT compilation in the consuming app. How would you manage other library files (for example, lib/js/ngx.es5.js) to be exposed as the main entry point? Is there going to be another package created like @gov.au/accordian-ngx by the furnace tool? The other option is to use a proper Angular library generator like this one - https://www.npmjs.com/package/ng-packagr. It will create an entire dist directory with the required bundles (es5, es2015, esm5, package.json, etc.) that can be used for publishing to npm directly. Can furnace create a separate angular package from this dist directory? Happy to discuss. Thanks. |
Hey @shakilsiraj you make a really good point! I think for now we can just import it with the path to the file, as we can only have one default file for now 😢 . Happy to look into other solutions to make this easier in the future. 👍 |
I think(????) I have managed to get a good crack at it. Check out the the commit 0eeb2b4 in regards to #471 and #472. Gist:
I'm guessing you guys would be able to work out #470 and #473 from the fork? I might have missed something here, so would appreciate you guys having a go at it. Please let me know if you have any questions. |
Thanks @shakilsiraj I'm going to look at your work over the next few days and see what we can do to get this integrated correctly! |
👍 |
Hi @shakilsiraj I think I have an idea about how this might be able to work from a simple approach. Let me know what you think. The uikit could provide a template html and css file for ingestion by angular. This means that the html file could look like:
Together they could be ingested like:
Then our test pages could be a simple The main thing I am not sure about is dynamic components, we can provide the spot for the class to go Let me know if you have any suggestions or ideas, i'm trying to keep the changes as minimal as possible so we can get this work in easily. |
Hey @alex-page, I think I have done something very similar. Have a look at the following: The angular module: The test application ( a barebone version of an ng cli project: And the changes to package.json(https://github.com/shakilsiraj/uikit/blob/feature-angular/packages/direction-links/package.json) along with the new build targets: test:angular and build:angular. What do you think? |
@shakilsiraj Yeah exactly something like this, I might try making a new branch with your code and see if I can make it a little bit smaller. Thanks again for all your work and feedback! |
c343bcc
to
1b6a5f2
Compare
@sukhrajghuman are you able to remove me as reviewer 🙏 |
@alex-page doesn't look like I can... :( @shakilsiraj might be able to |
@alex-page you're not a reviewer (or what GitHub calls it assignee) anymore and it only shows your last review on the top. You can just mute the issues for yourself. :) |
Angular 5 implementation of the uikit project. Has the core and accordion features implemented so far.
Comes with the following feature:
More component implementation in Angular to come I hope ...