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

Version 3.0 #234

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
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
25 changes: 0 additions & 25 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
github: permafrost-dev
custom: https://permafrost.dev/open-source
14 changes: 7 additions & 7 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
codecov:
branch: main
require_ci_to_pass: yes
require_ci_to_pass: true

coverage:
status:
project:
default:
informational: true
target: auto
# this allows a 10% drop from the previous base commit coverage
threshold: 20%
patch:
default:
informational: true
precision: 2
round: up
range: "40...80"
range: "70...100"

parsers:
javascript:
Expand All @@ -33,12 +32,13 @@ comment:
require_changes: true

ignore:
- ".husky/"
- "build/"
- "dist/"
- "coverage/"
- "src/index.ts"
- "src/index-standalone.ts"
- ".eslintrc.js"
- "jest.config.js"
- "eslint.config.js"
- "prettier.config.js"
- "rollup.config.js"
- "rollup.standalone-config.js"
- "vite.config.js"
- "vite.config.standalone.js"
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
labels:
- "dependencies"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
allow:
- dependency-type: "direct"
commit-message:
Expand Down
39 changes: 2 additions & 37 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
#push:
# branches: [ main ]
#pull_request:
# # The branches below must be a subset of the branches above
# branches: [ main ]
push:
branches: [ main ]
schedule:
- cron: '24 2 * * 1'

Expand All @@ -29,39 +15,18 @@ jobs:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
16 changes: 8 additions & 8 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Auto-merge Dependabot PRs for semver-minor updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}

- name: Dependabot auto-merge minor & patch updates
if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Auto-merge Dependabot PRs for semver-patch updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}

- name: Dependabot auto-merge actions major updates (if compat >= 90%)
if: ${{steps.metadata.outputs.package-ecosystem == 'github_actions' && steps.metadata.outputs.update-type == 'version-update:semver-major' && steps.metadata.outputs.compatibility-score >= 90}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
32 changes: 9 additions & 23 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ on:
branches:
- main
pull_request:
branches:
- main
pull_request_target:

jobs:
tests:

runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
node-version: [14, 16]
node-version: [20, 22]

steps:
- name: Checkout repository
Expand All @@ -28,31 +27,18 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Get yarn cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache dependencies
uses: actions/[email protected]
id: npm-cache
- uses: oven-sh/setup-bun@v2
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node-version }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-npm-
bun-version: latest

- name: Install dependencies
run: npm install

- name: Run the tests
run: npm run test
run: bun install

- name: Run the tests with coverage
run: npm run test -- --coverage --coverageReporters json
run: bun run test:coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.6.0
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/coverage-final.json

files: coverage/coverage.json
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/.vscode
/node_modules
/dist
/dist-temp*
/coverage

package-lock.json
Expand Down
1 change: 0 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint:staged
22 changes: 11 additions & 11 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
/.coverage
/.git
/.github
/.husky
/.vscode
/build
/coverage
/node_modules
/src
/tests
/dist-temp*
.editorconfig
.eslintrc.js
.gitattributes
.markdownlint.json
.prettierignore
.prettierrc
jest.config.js
bun.lockb
eslint.config.js
package-lock.json
prettier.config.js
SECURITY.md
tsconfig.json
*.sh
_*.txt
vite.config.js
vite.config.standalone.js
*.ignored
rollup.vue?-config.js
examples
rollup.*.js
.markdownlint.json
/.husky
prettier.config.js
rollup.config.mjs
rollup.standalone-config.mjs
*.log
*.sh
10 changes: 6 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
node_modules/*
dist/*
.coverage/*
build/*
*.yml
*.yaml
dist-temp*
dist/*
node_modules/*
*.ignore
*.ignored
*.yaml
*.yml
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright © 2021 Permafrost Development
Copyright © 2024 Permafrost Software <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ The preferred way to use this package is to load it via CDN, which must be done
The `axios` library must be loaded prior to loading `alpinejs-ray` and `Alpine`:

```html

<script src="https://cdn.jsdelivr.net/npm/axios@latest/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/alpinejs-ray@2/dist/standalone.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/alpinejs-ray@2/dist/cdn/standalone.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3/dist/cdn.min.js" defer>
```

Expand All @@ -52,11 +51,11 @@ Although not the recommended way, the package can be imported as an ESM module a
```js
import Alpine from 'alpinejs';
import AlpineRayPlugin from 'alpinejs-ray';

window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
import axios from 'axios';

window.Alpine = Alpine;
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

Alpine.plugin(AlpineRayPlugin);
Alpine.start();
Expand All @@ -68,7 +67,6 @@ To configure `alpinejs-ray`, you must create an `alpineRayConfig` property on th
loading `alpinejs-ray`:

```html

<script>
window.alpineRayConfig = {
interceptErrors: true,
Expand Down Expand Up @@ -105,27 +103,23 @@ Use the `x-ray` directive within your HTML markup to easily send data to Ray. Th
javascript expression.

```html

<div x-data>
<!-- sends 'hello world' and the value of the 'mystore.somevalue' Alpine store to Ray -->
<div x-ray="'hello world'"></div>
<div x-ray="$store.mystore.somevalue"></div>
</div>
```

The `x-ray` directive values are reactive; if the value changes, the new data will be sent to and displayed in Ray
in-place.
The `x-ray` directive values are reactive; if the value changes, the new data will be sent to and displayed in Ray in-place.
The changed value will be momentarily highlighted in Ray to indicate that it was updated.

## Example Components

```html

<button @click="$ray('hello from alpine')">Send to Ray</button>
```

```html

<div x-data="onClickData()">
<div x-show="show">Hi There Ray!</div>

Expand Down
Loading