Skip to content
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

Move JavaScript Controllers to javascript Folder, Configure ESLint, and Create rbui-js NPM Package #69

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,37 @@ jobs:
name: StandardRB Check Action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec standardrb --format progress
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec standardrb --format progress
eslint:
name: Run ESLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
cache-dependency-path: ./javascript/package-lock.json
- name: Install packages
run: yarn install --immutable
working-directory: ./javascript
- name: Run ESLint
run: yarn eslint .
working-directory: ./javascript
tests:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
ruby-version:
- "3.2"
- "3.3"
- "head"
fail-fast: false
matrix:
os: ["ubuntu-latest"]
ruby-version:
- "3.2"
- "3.3"
- "head"
name: Running minitest
runs-on: ubuntu-latest
steps:
Expand All @@ -36,6 +52,5 @@ jobs:
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: false

- run: bundle install
- run: bundle exec rake test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
.DS_Store
javascript/node_modules
8 changes: 8 additions & 0 deletions javascript/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import globals from "globals";
import pluginJs from "@eslint/js";


export default [
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
];
68 changes: 68 additions & 0 deletions javascript/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Load and export all of the stimulus controllers
import { application } from "./rbui/application"

// Import all controller files
import AccordionController from './rbui/accordion_controller'
import AlertDialogController from './rbui/alert_dialog_controller'
import CalendarController from './rbui/calendar_controller'
import ChartController from './rbui/chart_controller'
import ClipboardController from './rbui/clipboard_controller'
import CollapsibleController from './rbui/collapsible_controller'
import CommandController from './rbui/command_controller'
import DialogController from './rbui/dialog_controller'
import DismissableController from './rbui/dismissable_controller'
import InputController from './rbui/input_controller'
import PopoverController from './rbui/popover_controller'
import SelectController from './rbui/select_controller'
import TabsController from './rbui/tabs_controller'
import TextController from './rbui/text_controller'
import ToggleThemeController from './rbui/toggle_theme_controller'
import SheetController from './rbui/sheet_controller'
import ComboboxController from './rbui/combobox/combobox_controller'
import ComboboxContentController from './rbui/combobox/combobox_content_controller'
import ComboboxItemController from './rbui/combobox/combobox_item_controller'

// Register all controllers
application.register('accordion', AccordionController)
application.register('alert-dialog', AlertDialogController)
application.register('calendar', CalendarController)
application.register('chart', ChartController)
application.register('clipboard', ClipboardController)
application.register('collapsible', CollapsibleController)
application.register('command', CommandController)
application.register('dialog', DialogController)
application.register('dismissable', DismissableController)
application.register('input', InputController)
application.register('popover', PopoverController)
application.register('select', SelectController)
application.register('tabs', TabsController)
application.register('text', TextController)
application.register('toggle-theme', ToggleThemeController)
application.register('sheet', SheetController)
application.register('phlexui--combobox', ComboboxController)
application.register('phlexui--combobox-content', ComboboxContentController)
application.register('phlexui--combobox-item', ComboboxItemController)

// Export all controllers so user of npm package can lazy load controllers
export { default as AccordionController } from './rbui/accordion_controller'
export { default as AlertDialogController } from './rbui/alert_dialog_controller'
export { default as CalendarController } from './rbui/calendar_controller'
export { default as ChartController } from './rbui/chart_controller'
export { default as ClipboardController } from './rbui/clipboard_controller'
export { default as CollapsibleController } from './rbui/collapsible_controller'
export { default as CommandController } from './rbui/command_controller'
export { default as DialogController } from './rbui/dialog_controller'
export { default as DismissableController } from './rbui/dismissable_controller'
export { default as InputController } from './rbui/input_controller'
export { default as PopoverController } from './rbui/popover_controller'
export { default as SelectController } from './rbui/select_controller'
export { default as TabsController } from './rbui/tabs_controller'
export { default as TextController } from './rbui/text_controller'
export { default as ToggleThemeController } from './rbui/toggle_theme_controller'
export { default as SheetController } from './rbui/sheet_controller'
export { default as ComboboxController } from './rbui/combobox/combobox_controller'
export { default as ComboboxContentController } from './rbui/combobox/combobox_content_controller'
export { default as ComboboxItemController } from './rbui/combobox/combobox_item_controller'

// Export application
export { application }
Loading