Coder Social home page Coder Social logo

browner12 / alpinejs-devtools-fork Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alpine-collective/alpinejs-devtools

0.0 0.0 0.0 2.32 MB

Chrome/Firefox DevTools extension for debugging Alpine.js applications.

License: MIT License

Shell 0.05% JavaScript 88.26% CSS 0.66% HTML 11.04%

alpinejs-devtools-fork's Introduction

Chrome Web Store Chrome Web Store Mozilla Add-on Mozilla Add-on

Alpine.js devtools

Screenshot of Alpine.js devtools

Alpine.js devtools is a simple extension to help you debug Alpine.js components easily.

This extension is heavily inspired by Vue devtools, but customized for a unique Alpine.js developer experience.

Installation

Note: if you are using Google Chrome, Alpine.js devtools will not work with local files unless you configure the extension to be allowed Access to File URLs.

You can allow it by following these steps:

  1. Open chrome settings
  2. Go to extensions tab
  3. Choose Alpine.js devtools and press details
  4. Enable Allow access to file URLs

Allow access to file URLs permission

Identifying Components

Unlike other frameworks, Alpine does not include named components. Therefore by default, Alpine.js devtools will attempt to identify component names from the following attributes, in order: id, name, aria-label, x-data (the function name), role, and finally the tagName.

You may also override these with either x-title or x-id.

Development

Prerequisites

  • Node ^14.x
  • npm ^6.x

Chrome

  1. Clone this repo
  2. Run npm install
  3. Run npm run build:dev (or npm run build to test a production build)
  4. Load unpacked extension inside dist/chrome directory
  5. Open any HTML file that imports Alpine.js then inspect with Chrome DevTools. You should now have an Alpine.js panel available.

Firefox

  1. Follow the Development instructions to get a development build.
  2. Go to about:debugging#/runtime/this-firefox in Firefox
  3. Ensure you are on the "This Firefox" tab (see the left side nav)
  4. Click "Load Temporary Add-on..."
  5. Open any of the files in the built extension folder (./dist/chrome)
  6. Open any HTML file that imports Alpine.js then inspect with Firefox DevTools. You should now have an Alpine.js panel available.

Running the Alpine.js devtools simulator

A devtools simulator is provided in order to run tests and have an easier development workflow.

Note that when using the simulator all Chrome/Firefox devtools/Extension APIs are faked so it's useful if working on the Extension Backend (which runs in the end user's window, see packages/shell-chrome/src/backend.js) or the Alpine.js app which runs in the devtools panel (entrypoint: packages/shell-chrome/src/devtools/app.js).

  1. Clone this repo
  2. Run npm install
  3. Run npm start
  4. Open http://locahost:8080 (default port is 8080, you can override the port using the PORT environment variable. eg. PORT=5000 npm start will start the simulator on http://localhost:5000)
  5. You'll see a page with our sample Alpine.js app, example.html, running in the top half of the screen and the devtools simulator running in the bottom half of the screen.

Testing

We have 2 levels of tests in the project:

  • unit tests in ./tests, written and run with uvu
    • The command to run them is npm test.
  • E2E tests that run against the devtools simulator, in ./cypress, using Cypress.
    • The command to run Cypress tests is npm run cy:run
    • The command to open the Cypress UI is npm run cy:open
    • Note in order to run any Cypress tests, you'll need the simulator running (see Running the Alpine.js devtools simulator).

Formatting/Linting

Code is auto-formatted using Prettier, see the config at .prettierrc.js.

On push, a GitHub Action will auto-format your changes.

On commit, there's a husky + lint-staged hook that runs and auto-formats your changes (unless you disable pre-commit hooks).

License

MIT

alpinejs-devtools-fork's People

Contributors

amaelftah avatar dependabot[bot] avatar hugodf avatar kevinbatdorf avatar mabdalmoniem avatar ryangjchandler avatar stephenoldham avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.