@profoundry-us/loco_motion 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +99 -67
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  Crazy fast Rails development with modern tools and components leveraging
5
5
  ViewComponent, TailwindCSS, DaisyUI and more!
6
6
 
7
- ![image](./docs/assets/images/loco-chats.png)
7
+ <img src="//loco-motion-docs.profoundry.us/images/loco-chats.png" width="500px" style="border: 1px solid #bbb; padding: 2px; border-radius: 10px;">
8
8
 
9
9
  _**DISCLAIMER**_
10
10
 
@@ -13,10 +13,12 @@ In particular, new Daisy components are being added frequently and older
13
13
  components are being updated with new features meaning the APIs are very likely
14
14
  to change!
15
15
 
16
- We plan to publish the docs site to a publicly available URL soon, but until
17
- then, you can run the docs by cloning the repository and running `make all` (or
18
- `make all-quick` if you've already run `make all` or `make rebuild` previously)
19
- and visiting http://localhost:3000/ in your browser.
16
+ We expect to settle on and purchase a real domain name in the near future, but
17
+ for the time being, the latest documentation is available at the links below.
18
+
19
+ - [Docs / Demo (Latest Release)][1]
20
+ - [API Docs (Latest Release)][2]
21
+ - [Docs / Demo (Main Branch / Staging)][3]
20
22
 
21
23
  Please reach out by opening an
22
24
  [Issue](https://github.com/profoundry-us/loco_motion/issues) if you've found a
@@ -42,7 +44,6 @@ your solution is aligned with our goals.
42
44
  - [LocoMotion Components](#locomotion-components)
43
45
  - [Install](#install)
44
46
  - [Using Components](#using-components)
45
- - [Setting a Base Component Class](#setting-a-base-component-class)
46
47
  - [Developing](#developing)
47
48
  - [Tooling](#tooling)
48
49
  - [TODO / Next Steps](#todo--next-steps)
@@ -460,16 +461,23 @@ recommned Rspec with [factory_bot](https://github.com/thoughtbot/factory_bot)
460
461
  and [Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers).
461
462
 
462
463
  Finally, although both libraries offer some functionality for testing your user
463
- interface, we recommend utilizing [Cypress](https://www.cypress.io/) instead as
464
- it more closely mimics the real user experience in a browser and it allows you
465
- to see in real-time what is happening, including in-browser debugging!
464
+ interface, we recommend utilizing [Playwright](https://playwright.dev/) instead
465
+ as it more closely mimics the real user experience in a browser and it allows
466
+ you to see in real-time what is happening, including in-browser debugging!
467
+
468
+ Although the common setup is to write your specs in JavaScript or TypeScript,
469
+ you can actually write your End to End tests in Ruby / Rspec by utilizing the
470
+ [playwright-ruby-client](https://playwright-ruby-client.vercel.app/)!
471
+
472
+ We'll have some guides and examples for this coming soon!
466
473
 
467
474
  > [!NOTE]
468
- > One thing to note about Cypress, however, is that it is Javascript-based and
469
- > thus requires you to write tests in Javascript. If you are only famililar with
470
- > Ruby, you might want to stick with Rspec or Minitest when you first start your
471
- > project, and expand into using Cypress once you are comfortable learning a new
472
- > lanugage / framework.
475
+ > We used to recommend [Cypress](https://www.cypress.io) for End-to-End tests,
476
+ > but it's reliance on JavaScript and sometimes flakey tests caused us to search
477
+ > out a new solution / recommendation.
478
+ >
479
+ > We plan to have a writeup soon (an ADR specifically) on exactly why we made
480
+ > the switch.
473
481
 
474
482
  ## Authentication
475
483
 
@@ -670,9 +678,9 @@ a full set of UI components to help you build robust and full-featured apps.
670
678
 
671
679
  > [!CAUTION]
672
680
  > The LocoMotion components are being actively developed and are NOT ready for
673
- > production / public use (currently they are just some example components while
674
- > I get everything setup). I'm mainly adding the docs here so that I remember
675
- > how to set them up properly when they are ready for release.
681
+ > production / public use! We have finished basic versions of the DaisyUI
682
+ > Actions, DataDisplay, Navigation, and Feedback components, but we expect these
683
+ > to change (possibly quite a bit) as we begin to use them in projects.
676
684
 
677
685
  ### Install
678
686
 
@@ -681,7 +689,11 @@ Add the following to your `Gemfile` and re-run `bundle`:
681
689
  ```Gemfile
682
690
  # Gemfile
683
691
 
684
- gem "loco_motion", github: "profoundry-us/loco_motion", branch: "main"
692
+ gem "loco_motion", github: "profoundry-us/loco_motion", branch: "main", require: "loco_motion"
693
+
694
+ # or
695
+
696
+ gem "loco_motion-rails", "0.0.7", require: "loco_motion"
685
697
  ```
686
698
 
687
699
  Next add the following lines to the `contents` section of your
@@ -703,8 +715,8 @@ Next add the following lines to the `contents` section of your
703
715
 
704
716
  > [!WARNING]
705
717
  > Note that this will not output anything if it fails to find the right
706
- > directory, so your CSS may stop working if you update the gem and forget to
707
- > update this setting.
718
+ > directory, so your CSS may not compile properly if this command fails or finds
719
+ > the wrong gem or an older gem.
708
720
 
709
721
  Next, if you're using any of the components that require JavaScript (like the
710
722
  Countdown component), you'll need to add the library as a dependency and include
@@ -758,57 +770,35 @@ the following code and refresh your page.
758
770
  You should see a few buttons and the user info that we saved from OmniAuth
759
771
  represented as a Ruby hash! Any other content you have will be rendered below.
760
772
 
761
- ### Setting a Base Component Class
762
-
763
- Sometimes, you may want to override the way that LocoMotion handles things, or
764
- provide some functionality yourself in a sub-class of our components. Since you
765
- can't have a class inherit from two classes, we give you a way to override the
766
- base class that all of our components inherit from.
767
-
768
- This allows you to define a class that inherits from `LocoMotion::BaseComponent`
769
- and then adds any special methods or overrides to our default components.
770
-
771
- Create a file called `app/components/application_component.rb` with the following
772
- contents:
773
-
774
- ```ruby
775
- class ApplicationComponent < LocoMotion::BaseComponent
776
- end
777
- ```
778
-
779
- Then add the following to `config/initializers/loco_motion.rb`.
780
-
781
-
782
- ```ruby
783
- LocoMotion.configure do |config|
784
-
785
- # Override the base component class to inherit from our ApplicationComponent
786
- # so that we can add our own overrides / methods.
787
- Rails.application.config.after_initialize do
788
- config.base_component_class = ApplicationComponent
789
- end
790
-
791
- end
792
- ```
793
-
794
- > [!NOTE]
795
- > It doesn't have to inherit from `ApplicationComponent`, you can use any class
796
- > you want, so you could create a separate `CustomizedLocoMotionComponent` class
797
- > so that you don't have any conflicts with your `ApplicationComponent`.
798
-
799
773
  ## Developing
800
774
 
801
775
  To work on LocoMotion, first clone the repository and make sure you have Docker
802
776
  installed and running on your machine.
803
777
 
778
+ Next, create a `.env.local` file with the following contents, making sure to
779
+ replace the Unsplash keys with real ones (you can create your own account or ask
780
+ Topher for his keys).
781
+
782
+ ```.env
783
+ # .env.local
784
+ UNSPLASH_ACCESS_KEY="<< INSERT ACCESS KEY >>"
785
+ UNSPLASH_SECRET_KEY="<< INSERT SECRET KEY >>"
786
+ ```
787
+
804
788
  You should then be able to run `make rebuild` in the project directory and then
805
789
  `make all-quick` to start the services.
806
790
 
807
791
  > [!NOTE]
808
792
  >
809
- > We use `npm link` within the `docs/demo/bin/dev` script to enable quick
810
- > editing of the JavaScript library files so you don't have to publish a new
811
- > package during testing.
793
+ > We use `yarn link` in the `docs/demo/bin/setup` script to enable quick editing
794
+ > of the Javascript files so you don't have to publish new packages during
795
+ > testing.
796
+ >
797
+ > For the Ruby gem, we point directly to it via the `:path` option in the
798
+ > `Gemfile`. This means that we have a custom Heroku buildpack when we publish
799
+ > the demo site to move the files into the appropriate places.
800
+ >
801
+ > See https://github.com/profoundry-us/loco_motion-buildpack for more info.
812
802
 
813
803
  From here, you can access the demo site at http://localhost:3000 and the YARD
814
804
  docs at http://localhost:8808/docs/yard
@@ -850,6 +840,37 @@ TailwindCSS Intellisense working properly.
850
840
  ],
851
841
  ```
852
842
 
843
+ And because whitespace is important when developing inline components, you
844
+ should also add the following which prevents VSCode from adding a newline to the
845
+ bottom of your HAML files. This helps ensure that inline components don't have
846
+ trailing whitespace when using something like the `succeed` helper.
847
+
848
+ ```json
849
+ "[haml]": {
850
+ "editor.formatOnSave": false
851
+ }
852
+ ```
853
+
854
+ Alternatively, if your component is simple enough, moving the template inside
855
+ the `_component.rb` file's `call` method can also alleviate this problem.
856
+
857
+ So instead of
858
+
859
+ ```haml
860
+ - # This file has a newline at the bottom which can cause problems
861
+ = part(:component) do
862
+ = content
863
+
864
+ ```
865
+
866
+ you could do something like this:
867
+
868
+ ```ruby
869
+ def call
870
+ part(:component) { content }
871
+ end
872
+ ```
873
+
853
874
  ## TODO / Next Steps
854
875
 
855
876
  There is a LOT left to be done. We're not currently seeking assistance, but if
@@ -859,18 +880,29 @@ the GitHub Discussions feature and let us know!
859
880
  - [x] Basic versions of DaisyUI Actions
860
881
  - [x] Basic versions of DaisyUI Data Display
861
882
  - [x] Basic versions of DaisyUI Navigation
862
- - [ ] Basic versions of DaisyUI Feedback
883
+ - [x] Basic versions of DaisyUI Feedback
863
884
  - [ ] Basic versions of DaisyUI Data Input
864
885
  - [ ] Basic versions of DaisyUI Layout
865
886
  - [ ] Basic versions of DaisyUI Mockup
866
- - [ ] Get YARD docs rendering with (better) Markdown
887
+ - [ ] ~~Get YARD docs rendering with (better) Markdown~~ _**Working for now**_
867
888
  - [x] Extract relevant pieces into a yard-loco_motion plugin
868
- - [ ] Publish Gem
889
+ - [x] Publish Gem
869
890
  - [x] Publish NPM package
870
- - [ ] Update YARD plugin to add `@part`s
891
+ - [x] Update YARD plugin to add `@part`s
892
+ - [x] Update YARD plugin to add `@loco_example`s with language support
871
893
  - [x] Extract doc callouts into a doc component (and / or the Daisy component)
872
- - [ ] Choose and recommend / document a pagination gem
894
+ - [ ] Choose, recommend, and document a pagination gem
873
895
  - [ ] Discuss caching techniques / setup
896
+ - [x] Create / publish a staging version of the demo site ([Demo Staging][2])
897
+ - [ ] Create / publish a staging version of the docs site
874
898
  - [ ] Create / publish a production version of the demo site
875
899
  - [ ] Create / publish a production version of the docs site
876
- - [ ] Update demo site to allow for a different docs site using ENV var
900
+ - [x] Update demo site to allow for a different docs site using ENV var
901
+ - [x] Update README to suggest Playwright
902
+ - [ ] Build some have docs / guides / examples for using playwright-ruby-client
903
+ - [x] See if we can build a `Tippable` concern that relevant components can
904
+ include to automatically add the tooltip param and classes where possible
905
+
906
+ [1]: https://loco-motion.profoundry.us/
907
+ [2]: https://loco-motion-demo-staging.profoundry.us/
908
+ [3]: https://loco-motion-demo-staging.profoundry.us/api-docs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profoundry-us/loco_motion",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Crazy fast Rails development!",
5
5
  "main": "index.js",
6
6
  "repository": {